A while ago I purchased a PIC24 starter kit from Sure electronics, code DB-DP500. I have just found some time to have a play with it. This is a blog post to remind me about the steps I took to get it going. It might be helpful to others using this board, or the PIC24 range of micro-controllers.
The starter board is based upon the PIC24FJ256 which is a 16-bit device with 256kB program memory and 16kB of RAM.
I started by downloading the sample code and the documentation from the Sure Electronics download centre. This included a pdf datasheet, an installer and the starter kit files. The code has been developed for the Microchip MPLAB IDE. I opened the installer zipped file and ran ‘setup.exe’. This did not seem to work, so I closed down and tried again. This time it worked and asked me to reboot. (I am using Windows XP, by the way).
It did seem to get confused, but this might be because I already had a version of MPLAB IDE installed (actually a newer version). I am not fully sure what happened at this stage.
I opened the starter kit files and opened the ‘PIC24F Starter Kit’ MPLAB file. This opened correctly. I plugged in the PIC24 starter board into the USB port and starter kit debugger said “Board connected”.
I built the code with no major problems and then ran the code. As we start off in debug mode then we can step through the code using the run, halt, step buttons. This is pretty great for debugging and I think I will be using this a lot.
This used the C30 C compiler, which I thought was limited by time (30 days with full optimisation then unlimited with no opimisation). I have since read that it is limited to 64kB of optimised code. I am unsure which at the moment.
Now I am going to try changing the code to do something more and see how it goes.
This board has examples for sampling data, displaying data onto a LCD graphic display and storing data to a USB flash drive – all things that I would like to be able to do.
I wanted to move the code to another location and change the code (to ensure I have a clean backup copy).
I copy and pasted the ‘PIC24 starter kit 1’ folder. I then tried to open the MPLAB project, but I got lots of warnings due to ‘File not located’. To solve this I needed to find the files, which was a big pain. basically the files are saved within the folder where the starter kit files had been installed, which in my case was: “C:\Microchip Starter Kits\PIC24F Starter Kit 1\Microchip”. I then needed to look within that file system to find all the missing files. This took a while – it should automatically find the files, but apparently not.
I then tried to build the file but it could not find the C30 link file. I now get loads of link errors.
This program (or myself) has got very confused. I am now removing the program and going to re-install everything.
So after a bit of fresh air I came back to try and re-install everything and get it all to work this time.
This time i found out that the Sure electronics kit is a clone of the actual Microchip PIC24F starter kit. This has its own download for the sample software and C30 C compiler. I chose to download this version as it should be the most up to date.
I then downloaded the MPLAB Starter Kit for the PIC24F Demo Application 1.1 and installed that.
I opened the PIC24F Starter Kit 1 MPLAB files from the installed folder. I built the application and tried to program the device. It came up with a ‘configuration bits invalid’ to which I said “allow”, but this might have been the wrong answer. The PIC24 starter board now does not do anything. It appears to get stuck in a loop. This might be due to a watchdog timer, or something else. I’ve got to admit I am a bit stuck.
After lots of fiddling I have managed to get back to the point at which I began.
I installed the newer download for the C30 C compiler (as mentioned above). This did not work with the MPLAB starter kit demo application, as their starter board is a little bit different (different screen and capacitative switches). Hence opening the Sure Electronics code but using the newer C30 C compiler works. It comes up with some error messages – two are about the new places to find the C30 linker code – make sure these go to the new place where the files are located. Also you will get a warning about the configuration bits. You do not want to change them and you want to set them in code, hence I clicked on the ‘set in code’ tick box and never click on the ‘default settings’ when the error comes up.
I am now back to a working demo. I now want to make some code which I can play around with, but maybe that is for another day.