Cheers mackrackit.
They should arrive in two or three days time.
In the meantime I'll try and make a HEX program.
Finger X'd
Dave
Cheers mackrackit.
They should arrive in two or three days time.
In the meantime I'll try and make a HEX program.
Finger X'd
Dave
I was looking through some of the helpful links that mackrackit posted on this thread earlier and came across this link below:
http://www.melabs.com/resources/samples.htm#12F675pbp
Half way down the page there's a program to blink an LED using a 12F675 PIC so I thought great, I'll copy the HEX file (link below) which I did.
http://www.melabs.com/resources/samp...BP/BLINKX4.HEX
I then opened up my PICKit classic programmer and tried to copy the saved HEX code (which I'd saved as a notepad document) into the programmer but I couldn't even find the notepad HEX code, it just doesn't show up in my documents.
Any ideas on how to load this copied HEX code into the programmer so I can load it into my 12F675 PIC.
Starting to feel inadequite (I can't even spell it) right now.
One day when I've cracked the learning curve I'll look back at all this and smile...I hope.
Dave
If you copied the HEX and pasted it into notepad... probably why you had problems.
Now, the PICkit1 board has the LEDs in a matrix. So the coding is a little different than just HIGH this and LOW that.
Lesson #1
The PIC has three states a pin can be in.
OUTPUT HIGH
OUTPUT LOW
INPUT
Here is the code to light the first three LEDs on the PICkit1 on and off, in sequence.
The HEX is attached. Save it and re-name it taking the ".txt" off.
Code:'16F676 PICKIT1 TEST ' PORTA 1,2 4, AND 5 ARE THE LED PINS @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF ANSEL = %00000000 CMCON = %00000111 START: 'D0 HIGH TRISA = %11001111 PORTA = %00010000 PAUSE 500 'D1 HIGH TRISA = %11001111 PORTA = %00100000 PAUSE 500 'D2 HIGH TRISA = %11101011 PORTA = %00010000 PAUSE 500 GOTO START
Dave
Always wear safety glasses while programming.
Hi mackrackit
The program worked a treat, many thanks for your time and input on this. I saved the HEX code as Blink.HEX just added .HEX to the end (Doh) and it loaded into the PICKIT1 and then loaded into the PIC and away it ran:
D0 - D1 - D2 flashing one after the other, brilliant!
I noticed you wrote the program for the 16F676 PIC yet it ran perfectly on my 12F675 chip, very clever but how does that work? I guess both chips have certain ports and configurations that are common.
Would it have been possible to have copied the program you wrote and pasted that directly into Microcode Studio - demo and created the HEX file that way? I would like to do this if it can be done to get a feel for converting program code to a HEX file.
David
It was late, I was tired, I picked the wrong PIC...
Got lucky that it worked...
But yes, the code will compile with the demo version if it is for the correct PIC.
Darn bifocals...
Dave
Always wear safety glasses while programming.
Couldn't get it to compile, I had:
Symbol not previously defined Ansel (I had five of these).
And one: Overwriting previous address contents.
ANSEL is analogue select right? It's my understanding that your:
ANSEL = %00000000 code line makes all the pins read in digital, or turn any analogue input off (I think) so can't understand a problem here.
Also: CMCON = %00000111 puts out decimal 7 which turns the comparitor off? Is that right? This instruction didn't seem to cause a problem.
Could all this be because the 16F676 PIC wasn't listed when I compiled it? It wasn't in the demo version drop down list.
Plenty of head scratching going on here, great fun all though, I'll be glad to figure the basics out.
Dave
Last edited by LEDave; - 18th February 2010 at 21:41.
Bookmarks