PIC12F629 Data Sheet (.pdf 4,926KB)
Instruction Set for PIC12F675
See more projects using micros:
This project is a miniature Audio CRO. For those not familiar with the abbreviation “CRO,” it means “Cathode Ray Oscilloscope” and this is sometimes shortened to “SCOPE or O-Scope.”
A “CRO” is a piece of test equipment with a screen. It produces a visual indication of a waveform, via a probe, when the waveform is connected to the input terminal of the CRO.
If you connect a microphone to the probe and whistle into the mic, the CRO will produce a picture (trace) of the waveform. It will be in the shape of a sinewave. The screen is very similar to an old-style TV set (called a “picture-tube”) and the picture is created by firing a beam of electrons from the back of the tube (called the “neck’”) to the front of the tube where a layer of phosphorescent material glows when the beam hits it.
The beam of electrons is diverted from left to right via an electromagnetic field or an electrostatic field and this produces a line across the screen.
The beam is then deflected up or down by magnetic or electrostatic fields at 90° and this enables it to produce all sorts of patterns.
Here are some photos of the prototype Audio CRO. Note the use of surface-mount components allows a lot of parts to be placed in a very small space.
The 10mH inductor has been placed at an angle to make it less sensitive to the motor magnets so that it only picks up the field of the super-magnet placed on the end of the motor.
The motor is actually a 12v motor from the eject mechanism of a CD player. It operates down to 3v and the RPM at 3v is very low. That’s why it was chosen.
There are a lot of technical challenges to overcome when electronics is combined with mechanical devices. You will experience these when you build the project.
This is exactly what we have done in this project. But in an extremely miniaturised way.
Our screen is digital. It is rotating to produce a screen of light made up of “pixels.”We have an upright strip of LEDs and this is spun from left to right to create a screen that is 8 pixels high.
As you can see from the photos, the project is built on a small PC board containing the PIC chip, components to interface a pick-up coil and microphone to the chip and 4 cells. 16 LEDs are soldered to the edge of the board to create the “display.” The PC board is soldered to the shaft of a motor and a separate 3v supply is used to rotate the motor. We have used electro-magnetic detection to detect the starting point for each rotation of the display so that the RPM of the motor is not important. The display will remain absolutely steady, not matter how fast the shaft is rotated.
However the length of the display will contract if the motor is slowed down.
We then turn each LED on and off many times during the visual part of its rotation, making a screen resolution of up to 8 x 60. (But the audio section has a screen size 8 x 48). This might seem a small area but the project is a CONCEPT DESIGN.
It is designed to show the capabilities of one of the smallest and simplest chips in the PIC microcontroller range. It’s to “get you started” and if it were a complex project, it would be by-passed by those who we are aiming at - the BEGINNER.
Even at this basic level there are a number of features to challenge the brightest hobbyist - so be prepared for a really absorbing project.
There is a generally accepted thought that the voltage across a LED is a fairly constant value. But this is not so.
As the current across it drops, the “characteristic voltage drop” also drops significantly.
For the LEDs used in this project, the voltage drops from 2.3v (when full current is flowing) to 1.66v when less than 1mA flows.
This value is important as we are placing 4 LEDs across a 5.4v supply and we need to know if any current will flow through the combination when the project is resting.
In our case, 4 LEDs at rest requires 6.64v. This means no current will flow when the supply is 5.4v (it has to be higher than 5,4v for the LEDs to start to conduct).
This is the main reason why we have had to place two LEDs in series on each output. If we had only 2 LEDs from the positive rail to 0v rail, (with the output of the chip connected to the mid-point) they would illuminate when the drive-line was in “input-mode (high-impedance mode).”
The display is made from 16 LEDs. The LEDs are in pairs and this makes 8 “pixels.”Two LEDs are connected from an output to the positive rail and two LEDs to the negative rail.
When a control line is HIGH, two LEDs are illuminated and when it is LOW, the other two are illuminated. When the control line is an input, none are illuminated.
Both pairs of LEDs cannot be illuminated at the same time.
To make the display appear steady, the LEDs must be turned on at exactly the same instant, during each revolution. This is called REGISTRATION and is done by sensing the magnetic flux from a magnet and relying on the voltage produced by an amplifying transistor to be detected as a HIGH by GP3, the input-only line.
We have one further problem with displaying an audio waveform.
We need to SYNCHRONISE the rotation of the display with the audio. With a CRO, this is done via a feature called “triggering.”
The beam is held at the left side of the screen until the signal reaches a certain value and this makes every waveform (called a trace) retrace the previous to produce a steady picture.
Since we cannot synchronise the audio with the rotation of the display, we have used a clever feature called SAMPLE AND HOLD.
We sample the audio to produce 48 “points” and store these in registers 30h to 5Fh.
The program then waits for the start of the next revolution and displays these 48 points. It then waits for the start of the next revolution and displays the points again. It does this 30 times and takes another sample of the audio. This produces about 2 updates every second.
The result is a very steady picture.
So, there you have it. A sample-and-hold audio CRO.
Switch the project ON, then turn the motor on.
The display will rotate and the coil will pick up the starting-location for the display.
The words “Audio CRO” will appear on the display, then shift left. When the title has moved off-screen, you can whistle into the microphone. The chip will take a sample and store 48 pieces of data.
These will be displayed on the next rotation. The image will appear on the screen for 30 revolutions then another sample will be taken.
This allows the waveform to be viewed as a fairly steady trace.
The resolution is very low but the trace will show a sinewave and by whistling at different frequencies, you will be able to get different effects on the screen.
The whole purpose of this project is to set you up for further experimentation. We have purposely used the smallest, cheapest and simplest chip in the range to get you started.
All the help to do this is on the web.
It actually consists of hundreds of pages of files and data and everything is instantly accessible, simply by connecting to the web.
You can also access a PIC Micro webring (http://www.electro-tech-online.com/) where almost any query will be answered, 24 hours a day, by technical people around the world.
We mentioned above, the chip is not able to display all the pixels at the same time, since a HIGH on an output displays one of the pixel-pairs and the LOW displays the other pixel-pair.
To create letters and pictures on the display, all the LEDs need to be illuminated at some point in time. To achieve this we create the images on the display in TWO SCANS. The first pass or scan displays all the lower pixels and the second scan displays all the upper pixels. Since the rotation of the display is fairly rapid, the two images combine and all the pixels on the screen “appear” to be displayed.
This is a result of your eye holding a previous image for a short period of time and combining it with the next.
This is the way movies and television work. It is called PERSISTENCE OF VISION (POV) and allows flickering images, above 5 flickers per second, to be combined.
Talking Electronics features two of the simplest 8-pin PIC chips in their projects. These chips are: PIC12F629 and PIC12F675.
They are identical except the PIC12F675 has four A-D channels and PIC12F629 has none.
This project requires an A-D channel and thus the PIC12F675 has been chosen.
The project comes with a pre-programmed chip but if you want to program the chip yourself or alter the program, Talking Electronics website has details of a programmer (PICkit-2), a programming socket (PC board) and an adapter that plugs between the programmer and Programming board.
The display is made up of 8 LEDs and these are pulsed on and off very quickly to create “pixels” and the result is an image “in the air.”
To keep the image stationary we need to turn on the LEDs at the exact same place during each revolution.
This is done with a “pick-up” coil and magnet. The flux from the magnet produces a voltage and this is amplified by a transistor and fed to the microcontroller as a HIGH.
This provides registration for the display and it works very well, producing a very steady result.
But the pick-up coil is very sensitive and will detect the magnetism from the permanent magnets of the motor.
To prevent the coil picking up the background field we have angled it to 45° and added a 100n between base and 0v. We have also reduced the gain of the transistor to 10 by adding an emitter resistor. You need to make sure the coil detects magnetism only once per revolution - preferably from the magnet placed on the body of the motor.
When the project is turned on, the screen shows “Audio CRO” and the letters shift left until the screen is blank.
This project is not primarily intended to show lettering as this feature is available in another of our projects. However a sub-routine has been included to show the capabilities of the display.
This leads us into…
Using a microcontroller is like being handed a blank notebook. You can write a novel, a science report or create just about anything on a piece of paper.
The same with a microcontroller, except the writing is done electronically, with lines of code called instructions that are called mnemonics, as each instruction consists of letters of a sentence, to represent the instruction. The possibilities with a micro as simple as the PIC12F675 are almost endless. That’s why we have pushed the boundaries with this micro to show what can be done.
The first thing to do is work out what requirements you need and see if they fit into the capabilities of the chip.
The chip we have used has 5 in-out lines and one INPUT-ONLY line (GP3, pin4). It also has four Analogue-to-Digital inputs, storage of data that is retained, even when the chip is turned off (called EEPROM) and timers that hold “count-values,” as well as other features.
From a beginners standpoint it is very difficult to know what a micro can do and the only way to generate this knowledge is to look at projects using a particular micro and study the program.
Rather than trying to re-invent the wheel, the simplest way to start programming is to take a pre-written project and load it into a text editor such as NotePad2 and use it as a template.
A template contains all the data for the micro and the general layout of the sub-routines. By keeping to a standard layout, you will be able to find all the sub-routines as they are placed in alphabetical order, with Tables first, then delays and Main as the last routine.
You will then be able to add your own sub-routines or “cut and paste” them from our Library of Routines.
More on this topic can be found on Talking Electronics website in articles such as ”Start Here with PIC12F629.”
At this point we just like to mention that this project is a starting point for lots of ideas and the screen is like a blank canvas for all sorts of animations and effects.
There are a number of ways to create the program for this project. Some require you to learn a language before programming can commence. We have decided to use the 35 instructions that come with the microcontroller.
These instructions are easy to read as each instruction consists of letters that represent a sentence.
This is called ASSEMBLY LANGUAGE and when you create a program in this way, you are programming in mnemonics. A mnemonic is a set of letters or numbers that can be read by a human and easily remembered by the programmer.
For instance, “btfss 2C,3” represents the operation: “bit test 3 in file 2C and skip the next instruction if it is set.” All the operations for our micro can be performed using about 35 instructions.
Each line of a program contains a single instruction and just before the micro is “burnt,” a software program called an assembler is used to change the instructions into bytes that can be read by the micro. The assembler will produce “hex” bytes and create a file with the extension .hex
The next piece of software you will use is called a Programmer and will take the .hex file and convert it to binary “1’s” and “0’s” for “burning” into the chip.
This process is called “programming.”
Using mnemonics is called a low-level language because the instruction can be almost directly read by the micro.
You can use higher-level languages (such as C) in which a single instruction will perform a more-complex task than one of our mnemonic instructions, but as you go further up the programming ladder you get further removed from actually understanding PIC language.
Our intent is to show what can be done with a simple 8-pin PIC chip and how a program is written.
We have made programming very simple by putting the 35 instructions in a list and sample programs are available on Talking Electronics website.
By copying and pasting a sub-routine (or even a single instruction), you cannot make a mistake. Just keep to the same layout of each instruction and place them in the correct column (the layout of a program can be seen in the sub-routine below).
There are no syntax complications, like the order of placing brackets or understanding what symbols like: ”/, ^, &&” mean and if you follow our guidelines of “copy and paste” and “add one or two instructions at a time,” you will have success.
The files for this project are:
That’s the program.
It only uses 400 bytes and more than 600 bytes are still available for adding new features.
The program can be improved in so many ways. For example, the two Tables can be combined into one and the program picks the bits for the first pass and then the bits for the second pass via a few transfer instructions.
Or you can add more to the message when the project is turned on.
Instead of producing a line to show the audio waveform, you could use a bar-graph, however this would require a double-pass; in the same way the letters are produced in the Attract sub-routine.
There are 8 unused files that could be used to supply 8 more points for the audio waveform.
And then there are some ideas I have not thought of.
;Audio CRO 12F675.asm ;Spinning LEDs with mic input ; 19-1-2010 list p=12F675 radix dec include "p12f675.inc" errorlevel -302 ; Don't complain ;about BANK 1 Registers during assembly __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT ;**************************************************************** ; variables - names and files ;**************************************************************** shift equ 20h ;first available file fetch equ 21h loops equ 22h fileA equ 23h fileB equ 24h fileC equ 25h temp1 equ 26h test equ 27h ; 30h ;first location for storing A_D value ; 5Fh ;last location for A_D value ;3 x 16 = 48 locations ;memory ends at 5Fh status equ 03h option_reg equ 81h ; bits on GPIO pin7 equ 0 ;GP0 pin6 equ 1 ;GP1 pin5 equ 2 ;GP2 and T0CkI pin4 equ 3 ;GP3 input only pin3 equ 4 ;GP4 pin2 equ 5 ;GP5 ;bits rp0 equ 5 ;bit 5 of the status register ;**************************************************************** ;Beginning of program ;**************************************************************** Start org 0x00 ;program starts at location 000 nop nop nop nop ;NOPs to get past reset vector address nop nop SetUp bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set GPI0 input movwf TRISIO clrf vrcon ;Vref off (power off the comparator - saves power) movlw b'01110001' ;111 sets internal oscillator movwf ansel ;GPO = analogue - others digital bcf status, rp0 ;bank 0 bsf ADCON0,0 ;turn A/D converter ON - bit 0=1 bcf ADCON0,7 ;left justified result in ADRESH (2 lowest missing) movlw 07h ;Set up to turn off Comparator ports movwf CMCON ;must be placed in bank 0 clrf GPIO ;Clear GPIO of junk goto Main ;************************************* ;* Tables * ;************************************* ;Table1 for first pass for letters on display Table1 addwf 02,1 ;Add W to the Program Counter to create a jump retlw b'01000011' retlw b'01000011' ;line 1 retlw b'01101101' ; retlw b'01101101' ;"1" produces an input = LED OFF retlw b'01101101' retlw b'01101101' ;line 5 retlw b'01000011' retlw b'01111111' retlw b'01000111' retlw b'01111111' retlw b'01111111' ;line 10 retlw b'01111111' retlw b'01000111' retlw b'01111111' retlw b'01011111' retlw b'01100111' ;line 15 retlw b'01100111' retlw b'01100111' retlw b'01000001' retlw b'01111111' retlw b'01000111' ;line 20 retlw b'01111111' retlw b'01011111' retlw b'01100111' retlw b'01100111' retlw b'01100111' ;line 25 retlw b'01011111' retlw b'01111111' retlw b'01000011' retlw b'01000001' retlw b'01011101' ;line 30 retlw b'01011101' retlw b'01011101' retlw b'01011001' retlw b'01011011' retlw b'01111111' ;line 35 retlw b'01000011' retlw b'01000001' retlw b'01110101' retlw b'01100101' retlw b'01110101' ;line 40 retlw b'01000001' retlw b'01100011' retlw b'01111111' retlw b'01000011' retlw b'01000001' ;line 45 retlw b'01011101' retlw b'01011101' retlw b'01011101' retlw b'01000001' retlw b'01000011' ;line 50 retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' ;Table2 for second pass for letters on display Table2 addwf 02,1 ;Add W to the Program Counter to create a jump retlw b'01000001' retlw b'01000001' ;line 1 retlw b'01111111' ; retlw b'01111111' retlw b'01111111' retlw b'01111111' ;line 5 retlw b'01000001' retlw b'01111111' ;"1" produces an input = LED OFF retlw b'01100111' retlw b'01011111' retlw b'01011111' ;line 10 retlw b'01011111' retlw b'01100111' retlw b'01111111' retlw b'01101111' retlw b'01010111' ;line 15 retlw b'01010111' retlw b'01010111' retlw b'01100001' retlw b'01111111' retlw b'01000001' ;line 20 retlw b'01111111' retlw b'01101111' retlw b'01010111' retlw b'01010111' retlw b'01010111' ;line 25 retlw b'01101111' retlw b'01111111' retlw b'01100001' retlw b'01000001' retlw b'01011101' ;line 30 retlw b'01011101' retlw b'01011101' retlw b'00001001' retlw b'01101001' retlw b'01111111' ;line 35 retlw b'01000001' retlw b'01000001' retlw b'01110101' retlw b'01110101' retlw b'01100101' ;line 40 retlw b'01110001' retlw b'01010001' retlw b'01111111' retlw b'01101001' retlw b'01000001' ;line 45 retlw b'01011101' retlw b'01011101' retlw b'01011101' retlw b'01000001' retlw b'01101001' ;line 50 retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' retlw b'01111111' ;************************************ ;* Delays * ;************************************ ;Delay 250uS _250uS movlw 30h movwf fileB Del250 nop decfsz fileB,1 goto Del250 retlw 00 ;Delay 0.01 sec (10mS) _10mS movlw 0Ah movwf fileB DelY nop decfsz fileA,1 goto DelY decfsz fileB,1 goto DelY retlw 00 ;************************************ ;* Sub routines * ;************************************ ;attract mode - displays Audio CRO on start-up attract bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set GP3 input -look for inductor magnetism movwf TRISIO bcf status, rp0 ;bank 0 btfss gpio,3 goto $-1 ;Produces first pass movlw 00 movwf fetch ;gets value from table movf shift,w ;offset for fetch addwf fetch,f movf fetch,0 ;put fetch value into w call Table1 bsf status, rp0 ;Bank 1 movwf TRISIO ;Set tris input/output bcf status, rp0 ;bank 0 movlw b'00000000' ;make GPIO LOW movwf GPIO call _250uS ;display for short time call _00percent ;all LEDs off call _250uS ;gap between pixels incf fetch,f movlw d'60' xorwf fetch,w ;is fetch = 60? btfss 03,2 ;test zero flag in status z=1 when same goto $-.14 ;Produces second pass bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set GP3 input -look for inductor magnetism movwf TRISIO bcf status, rp0 ;bank 0 btfss gpio,3 goto $-1 movlw 00 movwf fetch ;gets value from table movf shift,w ;offset for fetch addwf fetch,f movf fetch,0 ;put fetch value into w call Table2 bsf status, rp0 ;Bank 1 movwf TRISIO ;Set tris input/output bcf status, rp0 ;bank 0 movlw b'11111111' ;make GPIO HIGH movwf GPIO call _250uS ;display for short time call _00percent ;all LEDs off call _250uS ;gap between pixels incf fetch,f movlw d'60' xorwf fetch,w ;is fetch = 60? btfss 03,2 ;test zero flag in status z=1 when same goto $-.14 retlw 00 convert ;converts A/D value to 4 output lines movwf test ;load the A/D value into the "test" file (2F) movlw d'10' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _10percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'20' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _20percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'30' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _30percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'40' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _40percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'50' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _50percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'60' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _60percent ;carry flag is SET if w is less than "test" movwf test ;load the A/D value into the "test" file (2F) movlw d'70' ;load decimal into w subwf test,0 ;subtract d'' from test btfss 03,0 ;test the carry flag goto _70percent ;carry flag is SET if w is less than "test" goto _80percent ;carry flag is SET if w is less than "test" _00percent ;ALL LEDS OFF bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set all GP0 input movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000000' ;no LEDs ON movwf GPIO retlw 00 _10percent bsf status, rp0 ;Bank 1 movlw b'11011111' ;Set GP0 input GP5 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00100000' ;make GP 5 high movwf GPIO retlw 00 _20percent bsf status, rp0 ;Bank 1 movlw b'11011111' ;Set GP0 input GP5 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000000' ;make GP 5 low movwf GPIO retlw 00 _30percent bsf status, rp0 ;Bank 1 movlw b'11101111' ;Set GP0 2 4 5 input GP4 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00010000' ;make GP 4 high movwf GPIO retlw 00 _40percent bsf status, rp0 ;Bank 1 movlw b'11101111' ;Set GP0 2 5 input GP4 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000000' ;make GP 4 low movwf GPIO retlw 00 _50percent bsf status, rp0 ;Bank 1 movlw b'11111011' ;Set GP0 2 5 input GP2 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000100' ;make GP 2 high movwf GPIO retlw 00 _60percent bsf status, rp0 ;Bank 1 movlw b'1111011' ;Set GP0 input GP2 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000000' ;make GP 2 low movwf GPIO retlw 00 _70percent bsf status, rp0 ;Bank 1 movlw b'1111101' ;Set GP0 input GP1 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000010' ; make GP 1 high movwf GPIO retlw 00 _80percent bsf status, rp0 ;Bank 1 movlw b'11111101' ;Set GP0 input GP1 as output movwf TRISIO bcf status, rp0 ;bank 0 movlw b'00000000' ;make GP 1 low movwf GPIO retlw 00 ;************************************* ;* Main * ;************************************* ;Displays "Audio CRO" ;called "attract mode" Main clrf shift ;moves display to the left by adding offset to fetch movlw .60 movwf loops ;number of loops before display starts to shift call attract decfsz loops,f goto $-2 ;shifts message across screen incf shift,f movlw .1 ; = decimal 1 movwf loops ;number of loops before display shifts call attract movlw d'49' ;number of shifts before exit xorwf shift,w ;is shift = 49? btfsc 03,2 ;test zero flag in status z=1 when same goto $+4 decfsz loops,f goto $-6 goto $-.10 ;= decimal 10 ;stores 48 values in files 30h to 5Fh Main1 bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set GP3 input -look for inductor magnetism movwf TRISIO bcf status, rp0 ;bank 0 btfss gpio,3 goto $-1 movlw 30h ;first location for storing A_D value movwf 04h ;put value into File Select Register bsf ADCON0,1 ;Start A/D on GP0 (pin 7) btfsc ADCON0,1 ;has conversion finished? goto $-1 movf ADRESH,w ;put result of conversion into w movwf 00h ;move value into INDF (actually 30h+) incf 04h,f ;increment FSR to 31h etc movlw 5Fh xorwf 04h,w ;is file 04h = 5Fh btfss 03,2 ;test zero flag in status z=1 when same goto $-9 ;has loops reached file 5Fh? no ;displays 48 values on screen movlw d'30' movwf loops ;creates the 0.5sec refresh-time for viewing display bsf status, rp0 ;Bank 1 movlw b'11111111' ;Set GP3 input -look for inductor magnetism movwf TRISIO bcf status, rp0 ;bank 0 btfss gpio,3 goto $-1 movlw 30h ;first location for A_D value movwf 04h ;put value into File Select Register movf 00h,w ;move value from INDF (30h+) into w call convert call _250uS ;display for short time call _00percent ;all LEDs off nop ;gap between pixels incf 04h,f ;increment FSR to 31h etc movlw 5Fh xorwf 04h,w ;is file 04h = 5Fh btfss 03,2 ;test zero flag in status z=1 when same goto $-9 decfsz loops,1 ;loops reached file 5Fh? goto $-.19 goto Main1 ;oscillator calibration call 03ffh movwf OSCCAL end
This project is much more complex than meets the eye. However we do not want to deter you and that’s why a pre-programmed chip is available with the kit.
There is a lot of detail available about using PIC chips, creating programs etc and these can be found on the web by simply Googling PIC12F629 and/or PIC12F675.
The web is definitely the most incredible invention since “moveable type” and since it is the result of millions of individual contributors, you will find an enormous amount of assistance at: “PIC Micro Webring.” In addition you will find information on “Talking Electronics Website.” Click: “Fish Shop Timer” in the left index.
The chip can be programmed using either Talking Electronics “Multi Chip Programmer” (approx $16.00) and serial cable ($6.00) or PIC Programmer MkV (no kit for this project but its cost is less than $10.00) or MicroChip PICkit-2 programmer (approx $65.00) plus 5/6 pin connector ($3.00) and a programming socket (PCB programming board - $3.50) from Talking Electronics. Here’s the run-down.
The 8-pin PIC chip is taken out of the socket on the project and fitted to the Multi Chip Programmer or PIC Programmer MkV socket and “burnt.”It is then put back into the project.
This is very easy to do.
You must have a serial port on your computer and most old-style computers (such as “desk-top” and “towers” have a 9-pin serial port at the rear of the computer) for you to do this. The software to burn the chip is IC-PROG. This is available from Talking Electronics website as well as MPASM, NotePad2 and .inc files.
This gets you started with programming for less than $30.00.
If you don’t have a serial port (such as for a laptop), you will need to buy the PICkit-2 programmer from Microchip (from Modtronix in Australia) and use the USB port.
Most (all) lap-top computers have a USB port and this programmer comes with 2 disks containing all the software you need.
This programmer is also very easy to use and works every time.
You will also need to assemble the 5/6 pin connector (from Talking Electronics - $3.50) that connects the programmer to the project.
The PICkit-2 is available as a kit with a pre-programmed chip for the PICkit-2 PC board from: http://www.auelectronics.com/Hardware-CB0703.htm for approx $34.99(USD) as BB0703 - Fully function PICkit 2 System Part#:BB0703. But the 2CD’s of software are not included.
The instructions for assembly can be found here:
For Australian residents, PICkit-2 can be purchased from Modtronix for approx $50.00 USD plus postage and this includes 2 CD’s of software. But I am not sure if the extra board mentioned above is included in the “package.” The 5/6 pin connector that connects the programmer to our project must be purchased from Talking Electronics $3.50 - otherwise you will have to use the PC board (called an experimental board) that comes with the “package” from Microchip, to hold the chip while it gets “burnt” (programmed).
Quick Links
Legal Stuff
Social Media