Jump to content

Recommended Posts

I am using the 16F737 in a model aircraft controller project, and I am battling to get it to run in debug mode. I am using the MPLAB IDE with the BoostC compiler for the PIC16 series. I find the integration with the ICD 2 quite nice with MPLAB. This way I can debug my code easily.

 

According to the Microship website you need to add a NOP after the ORG 0x0000 instruction. It is not clear whether this needs to happen at address 0x0000 or 0x0001. This problem is only evident when the clock speed exceeds 4MHz, mine is running at 16MHz with an external oscillator. I have submitted a webticket to Microchip to clarify this. I can insert a NOP using the #pragma DATA 0x0001, 0x0000 // NOP opcode. I still need to test this. If I add the NOP at address 0x0000, then there is no GOTO start of code instruction is not created, which is a problem, just the NOP is created.

Edited by jknickel
Link to post
Share on other sites

jknickel,

 

To make the first instruction a nop you will need to do two things:

1) Relocate the code, so that the first instruction in not used.

2) Ensure that a NOP is inserted at address 0x0000.

 

Todo this

1) Use linker -rb option to relocate the code so that it starts at address 0x0001.

-rb 0x0001

 

2) Insert NOPs

#pragma DATA 0x0000, 0

#pragma DATA 0x0004, 0

 

The second nop is required because shifting the code using -rb will also shift where the interrupt code starts, so we need to ensure that there is a NOP there to.

 

Let us know if this works for you.

 

Regards

Dave

Link to post
Share on other sites

Hi Dave

 

This solution did the trick. It now works as advertised.

 

The tech support people at Microchip say the HITECH compiler has an option to compile for the ICD which automatically inserts the required NOP at address 0x0000. This might be a good option to add to the compiler and SourceBoost IDE.

 

Regards

Jeff

Link to post
Share on other sites
Hi Dave

 

This solution did the trick. It now works as advertised.

 

The tech support people at Microchip say the HITECH compiler has an option to compile for the ICD which automatically inserts the required NOP at address 0x0000. This might be a good option to add to the compiler and SourceBoost IDE.

 

Regards

Jeff

 

 

Better would be to add it to the icd2.h header, so that the appropriate linker flags etc get added as pragma's. This would then mean that compiling for the icd2 would just mean including that file, not doing several things in different places :D I have a 18f2550 that gets the same error, hopefully I'll get time tonight to research and see if I need to do the same thing for this one.

 

Andy

Edited by andy4us
Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

Loading...
×
×
  • Create New...