Welcome! Log In Create A New Profile

Advanced

SD Card > PIC24 code

Posted by tofletcher 
SD Card > PIC24 code
July 02, 2008 12:17PM
PIC24 code the way forward?

I have attached the main modules of the PIC 24 code. This interfaces an SD card to the PIC and utilizes the Microchip AN1045 File system library. It also includes code for the joystick interface
and stepper controller.

Throughout the project I have been somewhat single minded in my approach, I have only implemented code that was required to solve the particular issue at hand. This approach has given a quick result but the casualty has been that there are many threads in the code that are only partly implemented. G Codes for instance, I have only included the ones that I needed to route the PCB's, in other areas I have left TODO notes where more development is needed. Error checking is also at a minimum, I have only sorted out the troublesome ones, many more traps could be written in.
Eventually they will get sorted but for now it works well.

The next stage for this code is to include the extended functions required to run the extruder, this should be done during the next couple of months as time permits, we will then have a true stand alone printer/router/engraving machine.

OK, confession time! I am a mechanical engineer by trade, more used to Hydraulics and fluid systems than software systems. This project is just a hobby for me, so for those with many more years of experience in these things I will apologise now for any major goof you may find.

I have included loads of comments alongside the code, some very obvious statements line by line, others comment blocks giving insight into how it runs or to highlight set up of registers.

I have probably gone OTT with all the modules, the aim was to split things out and make functions easy to find. I have tried (but may have missed a few) to prefix externally called functions by the module name, again so if you see that prefix you can easily find the function in question.

Development platform is Microchip MPLAB IDE V8.00 with the ICD2.
Compiler is C30 the free version downloaded from Microchip web site
Development hardware, Microchip Explorer 16 board with add on SD card

Enough of the general stuff.

The program operates in an open loop:
search SD Card for a file then select
Open file for input
Enter manual mode for initial tool positioning
Read the file
Translate the buffer from either G-code or Binary to output a pulse train for the stepper control board.
Close off files
End.

I have not included any of the AN1045 Library files, these are available for download on the Microchip web site.

I will try to answer any questions arising from this post but please bear with me if I don't get straight back to you.

Tony.
Attachments:
open | download - PIC24Files.zip (25.1 KB)
Re: SD Card > PIC24 code
July 02, 2008 12:24PM
Cool work! I'm really looking forward to the release of Oshonsoft's BASIC compiler for the Pic 24 family of controllers! smileys with beer
Re: SD Card > PIC24 code
July 06, 2008 06:30AM
Ow, too bad this PIC programmer is 218.97 euro (microchipdirect). I have a PICKIT 2, but I guess that won't fly with PIC 24's...

Would this ( [nl.farnell.com] ) be enough to be able to program these fella's?


Regards,

Erik de Bruijn
[Ultimaker.com] - [blog.erikdebruijn.nl]
Re: SD Card > PIC24 code
July 06, 2008 12:08PM
Erik,
I took this text off the Microchip web site, by this you can use the PICKIT 2 on all chip families.

Device support list:
[www.microchip.com]

Microchip:
PICkit 2 Development Programmer/Debugger

Part Number: DV164121


The PICkit

Edited 1 time(s). Last edit at 07/06/2008 12:19PM by tofletcher.
Re: SD Card > PIC24 code
July 06, 2008 01:19PM
If you don't have a programmer at all then a 'JDM' style programmer is very simple to make and works well. I built one to program the 16C's but it should work with PIC24's. For the software I've been using winpic but there are also progs for linux supporting JDM programmers.

[www.jdm.homepage.dk]

I think there is a description in the wiki somewhere of how to build one on strip-board.
Re: SD Card > PIC24 code
July 06, 2008 01:37PM
This one for sure will do the job...

melabs U2 Programmer with Accessories - $119.95

[melabs.com]

I've been using their USB programmer for several years now and have no complaints whatsoever. The only problem you have to watch out for is that a lot of the 24 family of microcontrollers aren't DIP. That can make for practical problems for a developer.
Re: SD Card > PIC24 code
July 15, 2008 03:34AM
I now have a PICkit-2 and can confirm it will programme the PIC24. The Explorer16 board even has a PICkit-2 header.

Tony.
Re: SD Card > PIC24 code
July 16, 2008 06:35PM
I'll definitely be ordering new samples soon smiling smiley
I hope the PIC24's are powerful. Now to get PCB milling working so I can prototype those boards to get the PIC24's working... (this is something I'm REALLY looking forward to be able to do!!!)

B.t.w. tofletcher: what kind of milling bit do you use for (fully) copper clad PCBs?


Regards,

Erik de Bruijn
[Ultimaker.com] - [blog.erikdebruijn.nl]
Re: SD Card > PIC24 code
January 05, 2012 05:15AM
memory card passward send me nomemo card this type (ME1GH128DACA-7A)Q8D170Q00643 by KOREA
Sorry, only registered users may post in this forum.

Click here to login