Jump to content

Recommended Posts


Hi. Why do the breakpoints i set disappear when I enter debug mode? And I then get the "Can't locate source line for..."


If there is no target device code is produce for a give line of program the break point will be removed when the debugger is entered.

For example if a function is not called anywhere in a program no code is generated for it, and so if you try to set a break point on a line in the function that is not called then the breakpoint will be removed when the debugger is entered as there is no actual opcodes and therefore code address to put a breakpoint at.


The "Can't locate source line for..." message is generated if the program execution is paused and the address of the program counter (PC register) points at an address for which the debugger does not have source code, for example if you stop the code execution while it is in the delay_us() function, then you will get this message as no source code actuall exists for this function as it is a special one generated by the linker program when you code is linked.


I hope that helps.




Share this post

Link to post
Share on other sites

I tried adding a break to a couple of places in the code below, to no avail. Please advise. This is one of the examples online. I use a pic16F887.


void main()








trisb = 0; //configure port B pins as output

portb = 0;

while( 1 ) //endless loop


portb.0=1; // set portb pin0 to high.

portb.1=0; // set portb pin1 to low.

delay_ms( 500 ); // pause 0.5 seconds

portb=0x02; // shows hex notation for entering data.

delay_ms(500); // you can also write portb=2 in decimal



Share this post

Link to post
Share on other sites

This code will not compile without error therefore cannot be debugged.


Registers names should be in lower case e.g. osccon=0x71;


The delay_ms(X) must take a unsigned char value (0 - 255) otherwise it will be truncated to 8 bits.





Share this post

Link to post
Share on other sites

Your content will need to be approved by a moderator

You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.