PDA

View Full Version : Pic 18f252 not responding



gringo332
- 22nd March 2007, 17:37
Hey, guys I have been diligently searching the internet for information about my problem but cannot figure it out.
I have just switched from the 16f876 and am now trying to use the 18f252.
I loaded microcode's 18f252 boot loader using a JDM programmer and WinPic 800. The ICD cannot communicate with the chip for some reason. If I push the Loader information button it will tell me I have a different pic every time. Also I tried making a hex file for a blinking led and then programming it with WinPic but it blinked erratically. Tried a second chip, same thing. I used the same 20mhz resonator for the 16f876 and it works fine.

Any Ideas what might be wrong? I would really appreciate any tips.

skimask
- 22nd March 2007, 17:44
Hey, guys I have been diligently searching the internet for information about my problem but cannot figure it out.
I have just switched from the 16f876 and am now trying to use the 18f252.
I loaded microcode's 18f252 boot loader using a JDM programmer and WinPic 800. The ICD cannot communicate with the chip for some reason. If I push the Loader information button it will tell me I have a different pic every time. Also I tried making a hex file for a blinking led and then programming it with WinPic but it blinked erratically. Tried a second chip, same thing. I used the same 20mhz resonator for the 16f876 and it works fine.

Any Ideas what might be wrong? I would really appreciate any tips.

Got a pullup on MCLR?
Got caps across Vdd and Vss? (the 18F practically NEEDS these, moreso than the 16F series).
What pin is the LED on?
Show us your program...show us your schematic...

gringo332
- 22nd March 2007, 18:07
Thanks for the reply:
I'm not sure off the top of my head about the size of the caps I have. I'll have to check when I get home. What size should I use?
Yes, MCLR has a pullup ,I built it into the serial ICD programmer that was suggest by Microstudio. The programmer and power supply (7805) work well for the 16f876.

If The boot loader for the 20mhz 18f252 works fine for for my setup, and I get a different Pic Model # from the Microcode Loader Information tool every time I push it, it would seem to be a hardware issue. What do you think? Could the JDM/WinPic be programming it wrong. I did a verify after programing.

here's my code:
;18f252 test
; i tooks these configs from Microcode's bootloader
@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
@ __CONFIG _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_ON_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H
@ __CONFIG _CONFIG3H, _CCP2MX_ON_3H
@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
@ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
@ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
@ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
@ __CONFIG _CONFIG7H, _EBTRB_OFF_7H

define OSC 20
DEFINE LOADER_USED 1
trisb.0 = 0

main
high portb.0
pause 200
low portb.0
pause 200
goto main

Thanks a lot.

skimask
- 22nd March 2007, 18:53
Thanks for the reply:
I'm not sure off the top of my head about the size of the caps I have. I'll have to check when I get home. What size should I use?
Yes, MCLR has a pullup ,I built it into the serial ICD programmer that was suggest by Microstudio. The programmer and power supply (7805) work well for the 16f876.

If The boot loader for the 20mhz 18f252 works fine for for my setup, and I get a different Pic Model # from the Microcode Loader Information tool every time I push it, it would seem to be a hardware issue. What do you think? Could the JDM/WinPic be programming it wrong. I did a verify after programing.

here's my code:
;18f252 test
; i tooks these configs from Microcode's bootloader
@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
@ __CONFIG _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_ON_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H
@ __CONFIG _CONFIG3H, _CCP2MX_ON_3H
@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
@ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
@ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
@ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
@ __CONFIG _CONFIG7H, _EBTRB_OFF_7H

define OSC 20

trisb.0 = 0

main
high portb.0
pause 200
low portb.0
pause 200
goto main

Thanks a lot.

Where's the define for the bootloader?
Use .1uf on the power rail near the PIC, good generic value, works for almost everybody.

gringo332
- 22nd March 2007, 20:49
I have found the problem, but I'm not sure why it is happening. I had a sharp infrared sensor connect to the power supply but no control signals hooked to the pic. When I disconnected from the supply, the pic started communicating with Microstudio.
I have a 1uf capacitor close to the max232 which shares a supply with with the pic. I don't know why this would be happening. It worked fine when I had the 16f876 on the supply.
Any ideas on that?

Thanks for the help.

gringo332
- 22nd March 2007, 21:21
I put a .01uf capacitor (in addition to the 1uf cap on the programmer board) right next to the PIC and this allowed the Infrared sensor to be connect with no problems. My only guess is that it doesn't like having supply wires 4 inches long without have a capacitor very close by.

Oh looking above I can see that "Skimask" suggested putting it close to the rail.

Thanks, Skimask!