I'm thinking it might be time to post your schematic so we can quit guessing and start fixin' !
I'm thinking it might be time to post your schematic so we can quit guessing and start fixin' !
This is a very simple circuit, and not part of the problem, I believe.
Russ
Turn the LEDs around and connect them to ground.
When you apply a logic 0 to the pin, the pin sinks current and the LED lights...when you apply a logic 1 to the pin, the LED has the same voltage on both sides and doesn't light up...negative logic.
That's why everything is backwards...but it's really not...it's working just as designed.
No, No, not working as designed. I know I can turn the LEDs around, but I want to know why I have to do that. I suppose I could write the program to do the opposite of what I want and see what happens.
Hi Russ,
The waveform and any talk about HIGH / LOW is assumed to be in reference to the (ground / common / Vss) of the PIC. Your LEDs are “referenced” to the plus “rail” of the supply. That would make the LED output appear to be (upside down / negative logic). You could rewire the LEDs or re-order the code.
By the way, it is very interesting to put both LEDs on the single 1k resistor. Causing the voltage to vary differently when one, two or none of the LEDs are on! Getting, the same reading on a true RMS and a cheap 0.7 of peak meter is not an easy task! Where do you measure the voltage?
I vote to re-order the code.
-Adam-
Ohm it's not just a good idea... it's the LAW !
I re-wrote the program to produce the opposite waveform, but it is the same waveform:
LOW GPIO.0 'INITIAL CONDITIONS
LOW GPIO.1
START:
HIGH GPIO.1
PAUSEUS 4168 ' HIGH TIME
LOW GPIO.1
PAUSEUS 4167 'DEAD TIME, BOTH LOW
HIGH GPIO.0 'SETS PIN 7 HIGH
PAUSEus 4168 'FOR 4.168 MILLISECONDS
LOW GPIO.0
PAUSEUS 4167 'DEAD TIME
GOTO START '60 HZ FREQUENCY
END
Since both programs produce the same waveform, I guess my only option is to turn the LEDs around!
My circuit is only for testing. If I were driving solid state relays they would burn up when both were on.
Russ, the code will cause both LEDs to be on at the same time, even if the LEDs are referenced to ground.
GPIO.0 and GPIO.1 are the same level in the “second” and the “forth” time increment.
The previously attached waveform drawing shows this.
http://www.picbasic.co.uk/forum/atta...1&d=1178466510
You may have forgotten 4.168 milliseconds is one quarter (“one quadrant”) of a full cycle (16.667) – not one half.
-Adam-
Ohm it's not just a good idea... it's the LAW !
Might sound a bit silly, but, maybe if you drew us a quick picture of what you want the output to be, like if it was a picture from an o'scope, we might be able to better understand what you actually want.
The last post by Pic_User sounds like that might be the problem, simple mistake, easily fixed...
Bookmarks