Wednesday, 2 September 2015

Sams first PIC project

Today I sat Sam down and introduced him to the MikroBasic software for PICs, and to the PICkit2 software. I also talked him through some basics of the PIC chips themselves, and how to use the data sheet to decide on pin connections and the like. We then had a go at creating a program.

At first, although it compiled fine, I was stumped how to configure the chips. It turned out to be my own error - i'd modified the example program, which meant that since I hadnt started a new project, it didnt bring up the configuration window! Once i'd found that out, I could set the internal oscillator as we wanted. Next, I found that the Mikroelektronica software is not directly compatible with the MPLAB PICkit2. I had to find where it stored the .hex files and import them.

Ok, so our program isnt going to win any coding awards! -


its just a simple LED traffic lights sequence. And it took me a couple of hours to fathom turning the Port A analog comparitors off! But the point is that between us, Sam and I coded this without any help, and it works!


From now on, I will let Sam work the necessary programming out to improve the project. His next task is to add a second set of LEDs, following the reverse sequence - essentially a set of roadworks traffic lights! Oh, and to get a flashing amber!

No comments: