PIC Microcontrollers - first steps

PIC Microcontrollers - first steps

Postby RedTrain » 11.08.2015, 22:15

Hi all -

To build my Model-Railroad, I am using modules from GCA. I confess to be a big fan of the modules from Peter Giling http://wiki.rocrail.net/doku.php?id=gca:gca-index-en/ , who develops them jointly with the Rocrail team. I do appreciate the simple, yet clever design, the flexibility and the high quality. On some of those modules, PIC microcontrollers are being used.
And at a recent Rocrail Stammtisch 17 in Speyer, Germany, viewtopic.php?f=82&t=9430&start=45 there was a SMD-soldering-clinic, where we have built a PCB for LED lighting, using an SMD-PIC. This was a great starter in SMD technology for me.

So I decided to learn a bit about PICs, which would allow me to use versatile PIC controllers in my model railroad projects, in addition to the Arduinos that I am already using. As you know, PICs are available in many, many variants, down to the small but versatile 8-pin PIC 12F675, which is available for about 1$. This is the chip that is being used in the GCA102 module.

To enter the world of PICs, I have re-coded the short, simple firmware for the PIC in the module GCA102 Reverse loop controller http://wiki.rocrail.net/doku.php?id=gca102-en in C language.
Note: The existing PIC firmware for the GCA102 module is working perfectly and it needs absolutely no changes! My re-coding has one sole goal:
- to make first steps in the PIC world and to understand the basics of the PIC architecture
- to try the software from http://www.microchip.com , namely the Mplab X IDE Integrated Development Environment, XC8 C-compiler, as well as Mplab IPE standalone Programmer
- to use a PICkit3 adapter and ICSP programming
... and of course to have some fun! :)

You see the result in the attached small C source, that I have commented to hopefully let you understand the various steps and functions... :?
If some of you wants to give it a try, you should be able to successfully make your own first steps with PICs. Of course some reading is required regarding PIC, IDE and C. Of help to me were among others the MPLAB XC8 Getting Started Guide http://www.microchip.com/DevelopmentToo ... %20License and, of course, the data sheet of the PIC 12F675 http://www.microchip.com/TechDoc.aspx?t ... uct=12F675 . If you desire, you can easily compile and flash the source using Mplab X IDE. Additionally, I have added two adapted functions for a bit of finger stretching with understanding the PIC chip:
1. Delay function: done with timer and interrupts, as non-blocking delay.
2. EEPROM: Lifecycle management of the EEPROM storage cells by writing round-robin into a 20-byte buffer.

Reading stuff on the rocrail, microchip and other websites has payed off for me and I feel ready now to tackle some of my own projects with PICs...!

:rr_for_ever:
You do not have the required permissions to view the files attached to this post.
Beste Grüsse / kind regards - Carlo

[H0m 2L DCC] Layout "Rhaetian Flyer" Swiss Proto-Freelance RhB+FO+zB; 6% completed, partly operational
W10, Ubuntu 16.04, Rocweb, andRoc; CANbus GC1e, GC3-ORD3, GC2, GC6; Bemo, Peco, handlaid;
RedTrain
 

Return to Smalltalk