MPLAB Stimulus

View: New views
6 Messages — Rating Filter:   Alert me  

MPLAB Stimulus

by Harry H. Arends :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
 
I defined a RAM address to act as a flag register;
 
; --- Flags
#define  NEW_PACKET FLAGS,0  ; New packet received
#define  NOCV  FLAGS,1  ; No CV found
#define  RDONLY  FLAGS,2  ; CV read only
#define  DCC4BYTE FLAGS,3  ; DCC command 4 bytes
#define  PWM_DIR  FLAGS,4  ;*Direction of travel, 1=Forward 0=Reverse
#define  CV513Plus FLAGS,5  ;*Signal if second address
#define  PROG_2X  FLAGS,6  ; 2x prog
#define  RESET_FLG FLAGS,7  ; reset packet
 
Is it possible that i can set or reset during debug one or more of the flags
using the stimulus or by other means.
 
Thanks
 
Harry
 
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB Stimulus

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Harry H. Arends wrote:
> I defined a RAM address to act as a flag register;

No you didn't, at least not according to the code you showed:

> ; --- Flags
> #define  NEW_PACKET FLAGS,0  ; New packet received
> #define  NOCV  FLAGS,1  ; No CV found
> #define  RDONLY  FLAGS,2  ; CV read only
> #define  DCC4BYTE FLAGS,3  ; DCC command 4 bytes
> #define  PWM_DIR  FLAGS,4  ;*Direction of travel, 1=Forward 0=Reverse
> #define  CV513Plus FLAGS,5  ;*Signal if second address
> #define  PROG_2X  FLAGS,6  ; 2x prog
> #define  RESET_FLG FLAGS,7  ; reset packet

This defines a few string substitution macros for particular bits in a byte
called FLAGS.  There are no RAM addresses being defined here at all.

> Is it possible that i can set or reset during debug one or more of
> the flags using the stimulus or by other means.

You can change values of RAM being watched in a watch window.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB Stimulus

by CDB-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



:: I defined a RAM address to act as a flag register;
::
:: ; --- Flags
:: #define  NEW_PACKET FLAGS,0  ; New packet received
:: #define  NOCV  FLAGS,1  ; No CV found
:: #define  RDONLY  FLAGS,2  ; CV read only
snip

I could be talking rubbish here, especially as I rarely use MPLAB, but if these 'flag definitions' are part of a 'C' program code, I'd suggest either declaring them as ENUM or make a struct called flags, which you could then set a watch on in my example SysFlag in binary format, which means you could then see which binary digit changes at a time.

An example of what I mean.

enum EventFlags{V_On=0x07,Tmr1=0x06,Tmr2=0x05,Tmr0=0x04,Rly_On=0x03,ChckE=0x02,KeyE=0x01, OvrdE=0x00};

struct SysFlags
{
bit OvrdE;
 bit KeyE;
 bit ChckE;
 bit Rly_On;
 bit Tmr0;
 bit Tmr2;
 bit Tmr1;
 bit V_On;
 };
 
 SysFlags SysFlag;

Note this is FORED C not uChip C

Colin

--
cdb, colin@... on 19/08/2008
 
Web presence: www.btech-online.co.uk  
 
Hosted by:  www.1and1.co.uk/?k_id=7988359

 
 
 

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB Stimulus

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

cdb wrote:
>> I defined a RAM address to act as a flag register;
>>
>> ; --- Flags
>> #define  NEW_PACKET FLAGS,0  ; New packet received
>> #define  NOCV  FLAGS,1  ; No CV found
>> #define  RDONLY  FLAGS,2  ; CV read only
>
> I could be talking rubbish here, especially as I rarely use MPLAB,
> but if these 'flag definitions' are part of a 'C' program ...

They're not.  See the semicolons?

********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB Stimulus

by CDB-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



:: They're not.  See the semicolons?

I do now!  $550 worth of spectacles down the drain :(

However, if I were assembling, I'd still make a byte register into a flag register and then either  equate the individual bits

NEW_PACKET equ 0

etc

 OR

 #define NEW_PACKET 0

etc

Colin
--
cdb, colin@... on 19/08/2008
 
Web presence: www.btech-online.co.uk  
 
Hosted by:  www.1and1.co.uk/?k_id=7988359
 

 
 
 

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

RE: MPLAB Stimulus

by Harry H. Arends :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You missed the question. I asked if it \was possible to influense a singe
bit in a byte in RAM.
But from the answer of Olin i now know that i have to use the complete byte
changed.

Harry

-----Oorspronkelijk bericht-----
Van: piclist-bounces@... [mailto:piclist-bounces@...] Namens cdb
Verzonden: dinsdag 19 augustus 2008 13:55
Aan: Microcontroller discussion list - Public.
Onderwerp: Re: [PIC]MPLAB Stimulus



:: I defined a RAM address to act as a flag register;
::
:: ; --- Flags
:: #define  NEW_PACKET FLAGS,0  ; New packet received
:: #define  NOCV  FLAGS,1  ; No CV found
:: #define  RDONLY  FLAGS,2  ; CV read only snip

I could be talking rubbish here, especially as I rarely use MPLAB, but if
these 'flag definitions' are part of a 'C' program code, I'd suggest either
declaring them as ENUM or make a struct called flags, which you could then
set a watch on in my example SysFlag in binary format, which means you could
then see which binary digit changes at a time.

An example of what I mean.

enum
EventFlags{V_On=0x07,Tmr1=0x06,Tmr2=0x05,Tmr0=0x04,Rly_On=0x03,ChckE=0x02,Ke
yE=0x01, OvrdE=0x00};

struct SysFlags
{
bit OvrdE;
 bit KeyE;
 bit ChckE;
 bit Rly_On;
 bit Tmr0;
 bit Tmr2;
 bit Tmr1;
 bit V_On;
 };
 
 SysFlags SysFlag;

Note this is FORED C not uChip C

Colin

--
cdb, colin@... on 19/08/2008
 
Web presence: www.btech-online.co.uk  
 
Hosted by:  www.1and1.co.uk/?k_id=7988359

 
 
 

--
http://www.piclist.com PIC/SX FAQ & list archive View/change your membership
options at http://mailman.mit.edu/mailman/listinfo/piclist


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
LightInTheBox - Buy quality products at wholesale price!