Newbie - definition watch and delay

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Newbie - definition watch and delay

3,245 Views
RichT
Contributor I
Hi
 
I've just got myself a demo9s08qg8 board and it looks just dandy, I'm having a couple of problems though and wondered if someone could help?
 
I've got some definitions set up such as;
 
#define SW1 PTAD_PTAD2
 
so I can refer to SW1 which works fine, but how can I watch this while debugging? Seems it won't let me add user definitions to the data watch window?
 
Also, I just set up a simple delay function for roughly 500mS.  Is there a trace time function in CW or some way of setting the delay exactly? 
 
sorry for the dumb questions
 
Thanks
 
Rich
Labels (1)
0 Kudos
4 Replies

395 Views
alex_spotw
Contributor III
Hi:

For the 500ms delay, I would suggest using the Timer to generate precise delays, instead of counting instruction cycles, which is very tedious and inprecise.

Use Processor Expert to create a TimerInt bean fixed at 500ms or variable according to yout needs.

Regards,

Alex
0 Kudos

395 Views
RichT
Contributor I
Alex
 
>Use Processor Expert to create a TimerInt bean fixed at 500ms
 
hhhm.  I'll have to have a read up on these. Thanks
Any ideas on the watch window?
 
Rich
0 Kudos

395 Views
RaghuSorab
Contributor I

Hello Rich,

If its a 500 ms Delay, you can just find the exact time by analyzing the instructions you use and flow of the program ( ex How many times a particular instruction is executed ).

Reciprocal of the bus frequency is the time for one Cycle.

If an instruction uses 3 cycles, time taken for execution is (3 * time for one Cycle ).

I dont know much about the IDE method to calculate.

Raghu Sorab

 

0 Kudos

395 Views
RichT
Contributor I
Raghu
 
Thanks, thats much as I thought, though I would have thought something as 'sophisticated' as CW would have trace time functions etc built in. (MPLAB has a nice stopwatch function which does similar too)  
 
Does anyone know how to set up a watch for SW1 after using #define SW1 PTAD_PTAD2?    I don't want to have to scroll through the data window looking for the port pin, I just want to add SW1 to the data2 window etc.  It would be fine doing it the hard way for just one or two pins, but not lots.  I just get an error
 
Thanks
 
Rich
0 Kudos