Programming a 16F627 PIC microcontroller chip with PICBASIC Pro software and USB programmer.Programming the PIC microcontroller chips with Picbasic Pro . |
|||
Programming the Microchip PIC microcontroller chips for my machine controller project.A couple of years ago I picked up a PIC microchip programmer (see photo below) and a copy of PICBASIC PRO software for programming the chips in BASIC language instead of Assembly code, which is a bit more difficult in my opinion. The two chip types I will be using in my circuit and thus needing to program are a 12F675, and a 16F627. I picked the 16F627 for a couple of reasons. One reason is I needed more input/output pins than my fall-back chip the 12F675. Another reason is the 16F627 has a "capture" module that works with one of the timers built into the chip making it easy to measure the speed of the shaft encoder. One of the biggest reasons is that I had one in my junk box. I am kind of impatient at times and if there is a part in my junk box that I can use right away that is usually what I do. The other chip I am using is the 12F675. The optical sensor and delay system on the harvester uses 40 of them. They are a nice little 8 pin package and have timers, comparators, analog-to-digital converters, interrupts and more all built in. I'm using the 12F675 for the air regulation and will be using the built-in A/D converter for reading the pressure sensor, and for reading the pot used for adjusting the set point pressure. As for outputs I will be using two, one for the air valve and one for the alarm horn. Picture of my PIC programmer
The programmer has software of course, and using the programming I set the
configuration files in the configuration settings of the programming interface.
Programming the 16F627...
These are the settings I am using to configure the internal clock, the watchdog
timer, master clear brown out detector data protection etc. They are fully explained in the Manual.
The the programer interface has an area where you set the configurations. It's
quite easy consisting primarily of pull down choices.
' INTRC_OSC_NOCLKOUT Internal clock with no clock output pin
' WDT_OFF Turn the watchdog timer off ' PWRT_ON Enable Power-up reset ' MCLR_OFF Disable the master clear pin function ' BOD_ON Enable brown out reset ' LVP_OFF Disable the low voltage programming ' PROTECT_OFF Disable data protection
Then load the hex file the PicBasicPro program created assembled compiled or
whatever it did into the programer, pop in the chip and hit the program button.
A few seconds later the chip is programmed.
Here is the Pic Basic Pro program I wrote for this project.
If you are familiar with BASIC language for computers then you should be able to
understand the above program. Well, you may need to read up on the
microcontrollers as well.
As you can see, there isn't really much programming to do. I would say the
most diffcult thing to do is setting up the control registers correctly to get
the capture compare and timer modules working correctly.
Hopefully this little article has furnished you with at leas some idea about how
to go about programming a PIC microcontroller chip for your new invention.
I'll soon do another on the programming of the 12F675 and I will try to put more
detail into the programming.
If you are a novice and would like to get into programming PIC chips I would
suggest visiting
micro'enigneering Labs Inc. for everything you need. They are very helpful
and provide great customer service. Their website is:
http://www.melabs.com
Happy programming. Be careful it can be addictive.
|
File Your Provisional Patent Application Information Provisional Application Information
|
||