3-pin resonators normally have built-in caps. The center pin goes to ground. The remaining two pins go to the PIC external osc pins. For 20MHz you'll want HS_OSC.
It's a lot easier for folks here to help if you show all your code & config settings.
3-pin resonators normally have built-in caps. The center pin goes to ground. The remaining two pins go to the PIC external osc pins. For 20MHz you'll want HS_OSC.
It's a lot easier for folks here to help if you show all your code & config settings.
Sorry ... here's the code:
Code:@ device pic16F57, hs_osc, wdt_off, protect_off main: high porta.0 high porta.1 high porta.2 high porta.3 high porta.4 high porta.6 high porta.7 high portb.0 high portb.1 high portb.2 high portb.3 high portb.4 high portb.5 high portb.6 high portb.7 pause 2000 low porta.0 low porta.1 low porta.2 low porta.3 low porta.4 low porta.6 low porta.7 low portb.0 low portb.1 low portb.2 low portb.3 low portb.4 low portb.5 low portb.6 low portb.7 pause 2000 goto main
It is not really recommended to modify bits like that quickly after each other. There is something called READ-MODIFY-WRITE problem and that could be what you are having. I also notice that you have not set the TRIS register for the port (telling the port to be input or putput) but that should be taken care with high and low but I rather do it myself.
Try to blink with just one LED och with the entire PORT i.e
main:
TRISB=0
here:
PORTB=0
Pause 2000
PORTB=255
pause 2000
goto here
end
Save the A port for later since it is usually the port that has most Analog stuff that can also be causing problems.
And most important: Don't give up!! It is quite normal to have some problems getting started.
Last edited by Jumper; - 28th February 2009 at 06:52.
What Jumper said + you'll want to place DEFINE OSC 20 in the top section when using
a 20MHz resonator. PBP assumes a 4MHz oscillator if you leave the define out.
Still nothing.
Is a Murata CSTLS20M0X53-B0 20 MHZ resonator suitable for this IC?
I have the two outside leads connected to OSC1 and OSC2. The center pin is connected to ground.
I checked continuity and everything appears to be OK. I also checked the LED and it functions OK.
Here's the code that I tried:
Code:@ device pic16F57, hs_osc, wdt_off, protect_off DEFINE OSC 20 main: TRISB=0 here: PORTB=0 Pause 2000 PORTB=255 pause 2000 goto here end
Specs on the resonator look fine so it should work.
I programmed one in-circuit this weekend with a PICKit2 and MeLabs USB programmer.
Both worked fine.
Do you have an external pull-up on /MCLR?
Have you tried reading it back with your programmer to verify config settings?
Reading back produces this in the code tab:
Everything else is "0fff."Code:0000- 006c 002b 0cff 01eb 0703 01ec 0703 0a1f 0008- 0c03 002a 0ce7 090e 0a02 006a 0029 0cfc 0010- 01e9 026a 0703 0a1a 0cff 0000 01e9 0603 0018- 0a15 01e9 0004 03ea 0a14 0800 0003 04c4 0020- 04a4 0004 0800 0064 0683 0a31 0663 0a31 0028- 0213 0002 0217 0005 0218 0006 0219 0007 0030- 0800 0cff 0033 0037 0038 0039 0c1a 0036 0038- 0078 0040 0006 0066 0c07 002c 0cd0 0063 0040- 0901 0cff 0026 0c07 002c 0cd0 0063 0901 0048- 0063 0a3b 0063 091e 0063 0a4a 0fff 0fff
The configuration tab produces:
I did not have MCLR pulled up, so I tried a 10k resistor. Still nothing.Code:0000- 0ffa
Bookmarks