PDA

View Full Version : Drop a square wave 50% to negative value?



Vitor
01-17-2007, 06:11 AM
Can a symmetric square wave (50% duty, 0-5 Vpp) be added to a negative 2.5 V voltage so 1/2 (2.5 V)·of the wave will be in the negative area and the other 1/2 in the positive area to simulate AC?
I have heard of adding a positive voltage to a wave that has a negative component so all the wave shows in the positive area.
I gave up in creating a sine wave, I tested the simmulator I'm building, with a square wave generator and it works fine; however, the simmulator is not detecting the input wave·when I apply a square wave (all positive) from the BS2.

Thank you.

Bean
01-17-2007, 06:32 AM
You can try putting a capacitor in series with the output. The value will depend on the frequency and impedance.

If the simmulator doesn't have a common ground with the BS2, then you can use two pins and alternate the outputs. During half of the wave one will be HIGH and the other LOW, the during the other half of the wave they will switch HIGH, LOW.

Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)
SX-Video Display Modules www.sxvm.com (http://www.sxvm.com)
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman

Vitor
01-17-2007, 11:24 AM
Holy cow!!!!!!!!!!

That was simple, I grabbed the first cap I saw on my bench, 1uF, 50V, and I got a perfect square wave 50% in the negative, 50% in the positive and 100% I can't thank you enough.

TechnoRobbo
01-21-2007, 01:11 PM
Vitor said...

I gave up in creating a sine wave

Don't give up on the sine wave -use the FREQOUT command:

DO
· FREQOUT 8,494,60
LOOP

Output it through a 10k resistor and a 1000 uF electrolytic cap·in series and you'll have a near perfect 60 hz sine wave.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun


TR

Post Edited (TechnoRobbo) : 1/21/2007 1:25:01 PM GMT

Vitor
01-23-2007, 04:39 AM
I'm familiar with the FREQOUT.
I was using the PWMPAL to generate four independent square waves to feed them to a simulator (4 car wheels) and stepping the frequency from 0 (close to 0) to 600 Hz, and I needed the voltage to be 50% positive and 50% negative. I run these signals for a lenght of time and then I vary one of the frequencies to simulate a wheel locking up under braking conditions.
I had everything working but every time the PWMPAL changes the frequency there is a glitch in the square wave frequency and the simulator has hicups.

Well, back to the drawing board, now I'm going to try an analog sine wave generator and digital pots or servos with tapered pots to control frequency.