Welcome! Log In Create A New Profile

Advanced

Creating Main() function

Posted by reesy73 
Creating Main() function
October 09, 2014 11:34AM
Hello

I have completed my project code and want to place it onto my PIC permanantly. I understand that I name my primary function main() and then save.

However when I attempt to upload my code to the PIC my BVSERIAL terminal says that "main isnt unique", (which I guess is the rookie code main?!?!?).

How do I get my main() function onto the PIC?? If I clear the pic first then there is no rookie code so PIC cant run?!??!

Any advice would help.

Ta
Re: Creating Main() function
October 09, 2014 02:23PM
There are two ways of doing this:
1) in your program include the line
#option only off
This will tell BV_COM2 not to ignore duplicate functions but to replace them, in this case main() so it will overwrite the rookie main(). Unfortunately there is a bug in BvSerial that ignores the #option only so will only work in BV_COMM

Method 2) Copy the last rookie part to a local directory and delete the main() function. The easiest way to do this using BvSerial is to copy the rookie URL (select and CTRL+C) and on the scripts menu in PsPad select "open URL in Clip", this will download a local copy of that rookie part so it can be edited. If you don't have a scripts menu then it is well worth checking out this link http://www.bypic.co.uk/index.php/IDE
Re: Creating Main() function
October 10, 2014 11:00AM
Hello thanks

It worked like a charm, however, I now am in a continuous main loop and cant get out of my main() function.

I have tried the \ on bootup in BVCOM2 but nothing and have tried .loopbreak in bvserial but again nothing.

Any other way to stop this running so I can amend some code?

Thanks
Re: Creating Main() function
October 10, 2014 04:10PM
Which processor is it?
Re: Creating Main() function
October 21, 2014 11:42AM
Hello

Sorry been off work for a while.

PIC is 32MX1 as part of the old BV500 PCB kit.

Thanks
Gareth
Re: Creating Main() function
October 21, 2014 12:38PM
If .loopbreak (dot loopbreak) from BvSerial doesn't work then its stuck there I am afraid. You can send it back to me for re-programming (no charge).

The newer MX170 has a boot loader so this is not a problem with that device. It is available for the Mini-Max but not yet available in DIL form.

Jim
Re: Creating Main() function
October 21, 2014 01:34PM
No probs! I may just buy another PIC as my code is changed now.
Sorry, only registered users may post in this forum.

Click here to login