Beginning with the PIC 24 16-bit devices

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.

Next steps:

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.

7 responses to “Beginning with the PIC 24 16-bit devices

  1. Hi Matthew,
    I have a db-dp500v110 board. It did work with pre-programmed code but since I started compiling the source (PIC24F Starter Kit) it never worked again. I spent plenty of time trying to play with all possible settings, I never changed the configuration bits and whey were allways taken from the code. As a programmer or debugger I can only use Starter Kits, they always connect to the board.
    What is worrying me is a fact that after ‘build all’ I remove the hex file from the project folder and can still click on ‘program’ and it comes with no error, showing the progress and after a few seconds a completion of the task? I also trie to swap the generated file with one provided by sure electronics but as you may now expect with no difference. I would appreciate any help, I am in the blind spot right now….

  2. Hi Jack and KC7NOA,
    As you can probably guess this project has stalled for a bit.
    I have had a few other things to focus on recently, but its still sat under my workbench.
    If I do any more work on this then I will ensure I document it. Sorry I cant be much more help at the moment – too many projects…

    Quoting KC7NOA:Jack .. ever get it going .. mine is now not doing much ….

  3. I didn’t see a compiled hex for the dp500 on … where did you find it?

    BTY … with mplab 8.11(can’t seem to get 8.81torun) I can run through the code and set break points … but the display shows nothing most of the time.

    I changed the a setting from debug to release and o did get something that looked like morse code …. not like the original displayed stuff.

  4. I finally got it back to working like original .!!!!!

    Im now looking for a hardware profile for it …. to be used with a UBW32 firmware — i hope.

Leave a Reply

Your email address will not be published. Required fields are marked *