Stephen D. Barnes
BSEE Electrical Engineering
Factory Automation and Controls - Whole Building Automation - Commercial HVAC Automation
PIC Beginner / Novice!
Current PIC experience:
· Constructed programmer based on Bojan Dobaj design and used in conjunction with IC-Prog by Bonny Gijzen
· Learned MPLab IDE and MPASM
· Successfully programmed several devices in the 16F series to include the following functions;
o Basic digital I/O
o RS232 comms between PIC and PC
o SPI comms between PIC's
o Table read/write
o Dallas 1-wire comms
The next phase of my PIC research will be:
· Stop lurking on the PICList and become a more active member
· Familiarize myself with 18F and dsPIC architectures
· Learn to write relocateable code (looking into Olin Lathrop's development environment)
· Learn embedded RTOS principles and practices
· Utilize the above in practical applications
3 February 2005
I have a need for a more professional programmer than what I have constructed. A production programmer is not required for my purposes (research and hobby) so I have ordered a Microchip Technologies ICD2 based on all of the info I have gathered. There are many opinions and preferences concerning programmers......I have read most of them, and the ICD2 fits my needs for the foreseeable future.
Currently learning to use Eagle editor for my PCB's and will be designing with ICSP in mind.
4 February 2005
I have been looking in all the wrong places for Eagle libraries for PIC's! The last time I was at Cadsoft's website, the variety of PIC libraries available was rather small. Posted to the PICList looking for libraries and Jinx kindly replied with a link to the Cadsoft site. I went there and much has been added since my last visit...thanks to Jinx, and those who contributed their efforts in library creation, I now have libraries I can use to get started on my projects with Eagle!


17 February 2005
ICD 2 arrived a few days ago. I am building a universal programming adapter for it with a 40 pin ZIF so I can start experimenting with programming and debugging with the ICD 2. Will post results here in a couple of days!
8 March 2005
That couple of days turned into almost three weeks due to workload! Built the universal programming module and it works great! Now I should make up a development board so I can really start some serious application work. I am setting up to do circuit board production on an extremely small scale and should be running positive resist exposure and development tests in a week or two.
Back to the subject of PIC's, I am working out on paper the functional requirements for a hobby robot supervisory controller so I will have most features defined before I begin the coding process. I will be using the PIC18F4320 for this purpose. More on the details next time I update this page.
18 October 2005
It has been seven months and some odd says since I have had any time to work with PIC programming or the projects I had envisioned. This was due to changes in work environment. My work required 95% travel with long workdays involved and mostly living in hotels during the week. I was home every weekend during which I spent my time with my Wife and family. Now I am working locally and will have much more time to spend learning PIC’s and working with my projects!
I will get started with some rudimentary code in the 18F and dsPIC30F series keeping in mind to follow rules for creating relocatable code!
23 October 2005
OK… Today I have been messing’ around with the dsPIC30F2010 because it has the architecture I need for a robotics project. This thing has a quadrature encoder interface, along with PWM. Great for my robot motor control. I have learned how to initialize the chip with the peripherals ready to operate. Now on to some real application programming that includes a serial interface to communicate with visual basic for debug and verification of the software and hardware interfaces.
25 October 2005
Made some actual progress with the 30F2010. Learned some of the differences between assembly for 16 /18 series chips and ASM30. Big difference. Also found that Microchip’s baud rate generator formula does not work with the last calculation of –1. Leave out the last subtraction and the baud rate generator works. I now have the PIC communication with the PC reliably!!!
This giant step will allow me to start coding and debugging (after I get ICSP going on the target board so I do not have to swap that chip back and forth). More updates as progress is made.


26 October 2005 2:08 AM
I have been working with this thing all night! I am enjoying the challenge. ICSP is functional on the target board and I have been fighting with transferring a 16-bit SFR across the serial connection. If I go back to what I was sending earlier (text) everything works fine. I believe that the problem lies in the difference between sending one byte at a time and sending a whole word. I am going to post to the PICList concerning this and see what happens!
29 October 2005 8:11 PM

I have solved a whole range of challenges over the past few days! I had numerous problems with ICD 2 losing USB communications during animation or single stepping. I was running MPLAB 7.20 and have upgraded to 7.22 and the problem is gone! This has sped up my development significantly.

Olin Lathrop has been an extraordinary resource and has offered code snippets through the PICList to help resolve my serial communication problems. These problems originated with my lack of knowledge in byte/word manipulation.

I have implemented the quadrature encoder interface without help (although I did post to the Microchip Forum and received no replies). I also have the PWM module up and running and connected to my home brew motor driver (LMD18200T). I can rotate a motor, change its speed, and change its direction.

I am now ready to delve into the world of PID motor control on a PIC! This is something I have done numerous times in the industrial automation world using servomotor controllers, VFD’s, and PLC’s. I am comfortable with PID equations and loop tuning. What I have never even tried before, is writing a PID application for a microcontroller. I am also working strictly with assembly language as I have next to no experience with C language (going to get some soon). For experimentation, I am going to look into Microchip’s Motor Control GUI and see if it can be adapted to my application.

8 November 2005 9:29 PM

Over the past week I have been working on setting up a test rig for my PID work. The setup includes a gear-head motor coupled to a U.S. Digital 256 CPR encoder, LMD18200T dual bridge motor driver, dsPIC30F2010, MAX233, and the ICD 2 connected to the target breadboard. I am using Terminal v1.9b by Bray for serial data communications with the dsPIC.

With this bench setup, I can now work with feedback based motion control software development. My first step will be to write code for the dsPIC that will allow me to send commands via the serial port. Theses commands will include, motor direction, motor speed, position, acceleration profile, etc. I will probably set this up to be a concatenated string sent from the PC and split up into respective registers in the dsPIC. This will require a bit of research so I will not be “reinventing the wheel” so to say! I have seen discussions of this on the PICList. More to come later!

22 November 2005 5:44 PM

Work has kept me from updating this journal for a couple of weeks. I have been doing research on the aspects of a serial command setup for my project as well as research on the PID algorithms required. These two areas are filled with diversity and will take some time to sort out what will be appropriate for my design. I am also on the hunt for some dumpster variety gear motors, most likely from a kid’s powered car. For the PID portion of my code, I am going to attempt to port some code provided by Microchip for brush DC motor control over to the dsPIC. This will provide a good learning experience to say the least!