MAIN:
set PORTC.4 on
Wait 1 s
set PORTC.4 off
Wait 1 s
goto MAIN
All the chip does is sit there. I have an external 4mhz crystal attached with 18pf capacitors. It's got power, it just doesn't seem to be running anything. I've tried all sorts of configurations, but nothing seems to work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The compiler now handles device memory, so no need now for #mem 368.
Is the PIC Vdd and Vss bypassed by 0.1uf cap as close to the device as possible? Also place the crystal as close to OSC1 and OSC2 pins as possible.
Trying HS_OSC probably doesn't do anything for you? Some crystals require higher load capacitors, like 20-22pf (your 18pf's should be good). No problems with a 16f877A and cheapo 4 mhz crystal and 20pf caps, XT or HS_OSC.
Other things to check:
Is the PIC actually programmed, can you read back the program memory?
Bad crystal? Try another, or different speed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got it hoping that I would not have to fool with the hardware. I used the same crystal that the data sheet said I could use. The program does download to the pic because I can read it and it's there.
I didn't know if my problem was a hardware issue, like with the crystal, or if I the software was wrong in some way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, this is my code:
'General hardware configuration
#chip 16F876A, 4
#config XT_OSC, WDT_OFF, LVP_OFF, BODEN_OFF, PWRTE
#mem 368
DIR PORTC OUT
MAIN:
set PORTC.4 on
Wait 1 s
set PORTC.4 off
Wait 1 s
goto MAIN
All the chip does is sit there. I have an external 4mhz crystal attached with 18pf capacitors. It's got power, it just doesn't seem to be running anything. I've tried all sorts of configurations, but nothing seems to work.
The compiler now handles device memory, so no need now for #mem 368.
Is the PIC Vdd and Vss bypassed by 0.1uf cap as close to the device as possible? Also place the crystal as close to OSC1 and OSC2 pins as possible.
Trying HS_OSC probably doesn't do anything for you? Some crystals require higher load capacitors, like 20-22pf (your 18pf's should be good). No problems with a 16f877A and cheapo 4 mhz crystal and 20pf caps, XT or HS_OSC.
Other things to check:
Is the PIC actually programmed, can you read back the program memory?
Bad crystal? Try another, or different speed.
I am using a board from modtronix.
This is the board:
http://www.modtronix.com/product_info.php?cPath=1_50&products_id=256
I got it hoping that I would not have to fool with the hardware. I used the same crystal that the data sheet said I could use. The program does download to the pic because I can read it and it's there.
I didn't know if my problem was a hardware issue, like with the crystal, or if I the software was wrong in some way.
try to change the program to use internal oscillator.
see if it works then ?
I think you have to use HS_OSC instead of XT_OSC
And PWRTE must be PWRTE_ON or PWRTE_OFF
May be there are the problems...
This code worked ok for me (in real circuit):
'General hardware configuration
#chip 16F876A, 4
#config HS_OSC, WDT_OFF, LVP_OFF, BODEN_OFF, PWRTE_ON
#mem 368
DIR PORTC OUT
MAIN:
set PORTC.4 on
Wait 1 s
set PORTC.4 off
Wait 1 s
goto MAIN