CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

dsPIC30F5015 in debug mode

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

dsPIC30F5015 in debug mode
PostPosted: Wed Dec 09, 2015 4:13 am     Reply with quote

Greetings! I'm using MPLab v8.91, CCS v5.025 and dsPIC30F5015. When I'm using the motor control unit and I'm experiencing a small problem - the debugger doesn't show the current state of PORTE. For example if I set the PCDs to 500 (pwm 2500) and I have this code:
Code:

if(PORTE!=0)
{
   delay_us(1);
}


When I set a breakpoint to the delay it triggers but in the view window PORTE is 0! I test on a pcb and I have proper pwm on the outputs! Why I don't see the changes in the debug mode ? I tested when the debugger is freezing all the peripherals and when it doesn't - no change!
Is this a bug or I'm doing something wrong ?
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Wed Dec 09, 2015 4:49 am     Reply with quote

Show us your definition of 'PORTE'.
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Dec 09, 2015 5:06 am     Reply with quote

Also, the debugger is not a hardware debugger, it's a software monitor. The peripherals are not "frozen" at a breakpoint, they stay running.

The values for peripherals, including timers/counters, shown while debugging are a snap shot of their values at the time the debugger code read them, which is quite a long time after the breakpoint happened. This means the value you see may not be consistent with the value at the breakpoint.
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Sat Dec 12, 2015 12:08 pm     Reply with quote

Code:

#word PORTE = getenv("SFR:PORTE")

This is bad! How can I be sure everything is configurated correctly. I can see the output pulse, but this is not the whole thing. I need to have correct update time, correct errors check and so on...
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Sat Dec 12, 2015 12:25 pm     Reply with quote

This is the 'snare' of the ICD. In the past you used to get genuine hardware ICE units, which actually could snapshot the memory, and ports at specific points. Unfortunately the ICD can't do this.
The way you can record things is to do it yourself. In your code, at the point where you read the port to test something, write the value read, into an array. You can then stop, and look at the array, and see what the code actually 'saw' at this instant....
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Sun Dec 13, 2015 10:37 am     Reply with quote

You mean I have to read the value of the register before the breakpoint occurs?!
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Sun Dec 13, 2015 11:46 am     Reply with quote

You read the port at the point in the code where you want to know what the code is seeing.
You can break at any point you want after this, and look at the value that was read.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group