Hi Alain,
Yep. That would do it, but it might be easier and a lot cheaper to just wire his PIC for in-circuit directly to his MeLabs serial programmer..;o}
Hi Alain,
Yep. That would do it, but it might be easier and a lot cheaper to just wire his PIC for in-circuit directly to his MeLabs serial programmer..;o}
OK, I made up an adapter cable and programmed the IC. I can't get it to run and I suspect the resonator or the way that I have the resonator setup. I read the data sheet and I'm thoroughly confused. I'm using Murata CSTLS20M0X53-B0 20 MHZ resonators. Is this an OK resonator and if so, how should it be connected?
~ Dave
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
Bookmarks