PDA

View Full Version : blinking lights.



Dwayne
- 9th January 2004, 05:35
Hello folks, after programming a chip, and failure, I am sure that my logic was ok....My wonderful Spectrum analyzer showed no computer movemet. So I broke down and make the simplest program:

ANSEL=0
CMCON=%00000111
TRISIO=%00001000

Loop:
Low GPIO.2
High GPIO.2
goto Loop

end

Scoping it out, I still had 5 volts on all pins, with no pulsating DC on GPIO.2 pin.

I tried the program, on another chip, and the same results.
Can someone tell me what I am missing?

Dwayne

Melanie
- 10th January 2004, 11:04
Like a car that needs three things to make it go (Fuel, Air and Spark) and then it's guaranteed to run if you provide those, a PIC similarlly needs three things to run - Volts, Clock and Reset.

>> Scoping it out, I still had 5 volts on all pins

I do hope that didn't include pin 8.

1. Let's assume you've wired up the +5v and GND/0v properly otherwise were on a losing wicket before we start.

2. That leaves us the next item - Clock. Have you programmed your PIC for Internal Oscillator? - otherwise you're going to have to provide a crystal, resonator or some other clock source.

3. Finally Reset. unless you have programmed for internal MCLR then you will have to provide a RESET on GPIO.3.

Bet you've forgot some or all of those. Again, read the PIC's Datasheet (section called "Special Features of the CPU") and ensure either your programmer is set to the appropriate defaults or you have provided the requisit defines within your program. You can download the "yankeedoodle" example code from the "Sound Command with 12-bit MCU's" thread in this section back in August 2003 to see how this is achieved within your program for a 12F675.

BTW... unless you've put some pauses between the High and Low GPIO.2 they're going to be toggling around 1MHz so make sure your scope is set fast enough to catch it.

Melanie

Dwayne
- 20th January 2004, 05:01
Hello Melanie,


D>> Scoping it out, I still had 5 volts on all pins

M>>I do hope that didn't include pin 8.

<g>... Well... almost all pins <g>


M>>
1. Let's assume you've wired up the +5v and GND/0v properly otherwise were on a losing wicket before we start.

2. That leaves us the next item - Clock. Have you programmed your PIC for Internal Oscillator? - otherwise you're going to have to provide a crystal, resonator or some other clock source.

3. Finally Reset. unless you have programmed for internal MCLR then you will have to provide a RESET on GPIO.3.

Bet you've forgot some or all of those.
<<


Well, yes and no. It seems that every time I load up a .hex program, in the assembler, it changes that GPIO.3 to reset. I switched it to input, and when I load up my Hex again, it switches it to Reset. I guess that is one of the things you have to live with...<g>. It took me a while to figure out this was happening.


M>> You can download the "yankeedoodle" example code from the "Sound Command with 12-bit MCU's" thread in this section back in August 2003 to see how this is achieved within your program for a 12F675.<<

I saw that. <g> But decided not to mess with it.

M >>
BTW... unless you've put some pauses between the High and Low GPIO.2 they're going to be toggling around 1MHz so make sure your scope is set fast enough to catch it.
<<

thanks<g>. I am using a Spectrum Analyzer... good to 1 Gig.


I want to thank you and the others so very much for your help, patience and time. I got my project working, and am checking out a Patent on it as soon as I travel to KC this summer.

I definitely enjoy the Flash Programming of this PIC chip...It is MUCH better than spending 20 min under a Ultra Violet Light trying to erase a Philips 750 EPROM. I probably saved 10 days on erasing alone <g> Let alone 1/4 the cost of the chip. (Though I still used a 750 in my project).