HI,
I have a PICKIT 2 programming a 18F1822. Compiling the program works, but the program won't load. The same setup works for the 12F683. Any ideas?
Thanks
HI,
I have a PICKIT 2 programming a 18F1822. Compiling the program works, but the program won't load. The same setup works for the 12F683. Any ideas?
Thanks
Easy one here. I can't find a datasheet for an 18F1822. Correct number, code, schematic and what you've done in the attempt to correct issue might help us help you.
Sorry about that. The part is right in one part of the post! It is a 12F1822.
The code is below - I am just trying to get a blinking light at this point(code from this forum). Thanks for your kindness is responding. As far as a schematic, I have 5 Volts, Ground and a connection to an LED on Port A.1 through a 1K resistor.
#CONFIG
_CONFIG _CONFIG1, _CLKOUTEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _BOREN_ON & _IESO_OFF & _FCMEN_OFF
_CONFIG _CONFIG2, _PLLEN_OFF & _LVP_OFF & _STVREN_ON & _BORV_19
#ENDCONFIG
PORTA = 0 ' LED Off
TRISA = 0 ' all outputs
OSCCON = %01101000 ' 4MHz internal
ANSELA = 0 ' all digital
Here:
HIGH PORTA.1
PAUSE 500
LOW PORTA.1
PAUSE 500
GOTO Here
END
Since your just testing this to begin with, I would leave out the oscon, let it run at whatever it wants. also swap location of the first tris and porta statement, and instead of using HIgh and Low, actually assign a value. see modified code below
Also you replace the HERE loop with this codeCode:#CONFIG _CONFIG _CONFIG1, _CLKOUTEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _BOREN_ON & _IESO_OFF & _FCMEN_OFF _CONFIG _CONFIG2, _PLLEN_OFF & _LVP_OFF & _STVREN_ON & _BORV_19 #ENDCONFIG TRISA = 0 ' all outputs PORTA = 0 ' LED Off ANSELA = 0 ' all digital Here: PORTA.1 = 1 PAUSE 500 PORTA.1 = 0 PAUSE 500 GOTO Here END
you might want to make sure your led is actually hooked to PIN PORTA.1 and not PORTA.0, I have made this mistake in coding many times.Code:Here: Toggle PORTA.1 Pause 500 Goto Here:
Chris
Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."
Are you using PBP3 and Microcode Studio version MCSX ?
Yes I am using PBP3 Gold and MCSX. Thanks
I see you're working this issue on the MELabs forum also. I think just about anything Darrel scribes is correct. In the last few years I've only seen him wrong once and that was only partially. Please post solution on both forums.
Hi natcsparky,
I tried your program using a breadboard circuit I had on hand with a 12F1822. After making corrections to the CONFIG lines as mentioned by AvionicsMaster, the program compiled OK with 60 program words. The hex file imported into MSCX with no problem, and the device programmed fine using ICSP.
Do you have the PicKit2 device file containing 12F1822? I think you must if you are able to compile as you say.
Not sure about the semi-colon after GOTO HERE though.
Robert
![]()
I also think you need to look at your CONFIG statement. PBP3 requires an indent and a double underscore to start the CONFIG statement and I don't think you can start a second line as you have done. Though if all you're trying to do is blink a light I'd leave all that stuff off and try it without.
RA0 is also a comparator input. On the 12F683 you need to turn the comparators off with CMCON = 7 and I think you need to do that with the CMxCON1 register. RA0 is also an input for a few other things and you'd think you wouldn't need to turn them off but you just might. One of the inputs is the ICSPDAT and the diode may be stopping the program loading. Try removing it, programm it, reinstall the LED and see if it works.
Also, if you didn't notice, wdmagic put the TRIS first and then the GPIO which I'm thinking is the preferred order. But they should come after the ANSEL, CMCON(if needed) and the OSCCON and DEFINE OSC settings.
If you think you might have the LED connected to a different pin on PORTA turn the whole port on with PORTA = %11111111.
Or maybe try another port just to get it blinking.
Robert
Thanks to all.
I have been successful in compiling, but will try these suggestions. The programming part is what is not working. Based on some more research, it appears that my problem may be the PICKIT2 firmware I am using. I am upgrading now, and will try the stand alone to load in the HEX file. Again, thanks to all.
I have the latest device file and installed it per instructions. Did you use a PICKIT2? Microchip said (on the phone) today that it won't work and I need a PICKIT3.
Thanks
Yes, I'm using a PicKit2 .... also tried it with a clone Pic programmer, (ICP01-V2.0) and it worked as well. I use the PicKit2 for other F1 family parts as well with no problems. Hex file attached. Note: extension must be changed back to .hex.
Have you tried skipping around MCSX and loading directly to the PicKit2 Programmer software?
test2.txt
It works! I borrowed a PICKIT3 and it programs just fine. Thanks to all for your help.
I tried the PICKIT2 GUI with the HEX file. Was not successful. Microchip says Pickit2 will not work, but I might try again. Thanks for the assistance.
Bookmarks