View Full Version : Pic 12F683 Pulsout Command

- 16th July 2011, 21:35
Hi, I'm posting in this area because it my first and want to not disturb any other areas of the forum. But I do have a question. I'm building a 'p' wave generator to send a short ultrasonic pulse though a sediment core. The circuit works using high and low commands for the various ports to trigger the digital scope and ultrasonic generator. And I'm fine with that. But I have had no luck using the pulsout command. I'm trying to send out a positive pulse of 50 microseconds to trigger the DSO and turn on the 40,000Hz ultrasonic generator. But it always sends out a ground state pulse. Here is a test code:

'Test code for pulse Generator Using 12F683 and LED's

ANSEL = 0 'Analog select set to digital
CMCON0 = 7 'Comparitor Off
ADCON0 = 0 'A/D turned OFF

high gpio.1 'Set state
high gpio.0 'Set state
pulsout gpio.0, 1000 ' Send 1000us HIGH pulse to pin 0
pulsout gpio.1,1000 'Send 1000us HIGH pulse to pin 1
pause 1000 'Wait one second

Goto mainloop 'Forever

It's very simple what I need to do, but it sends out low 1000us pulses on both GPIO.0 and GPIO.1

Any ideas? I'm just trying to figure out why it doen't work.

- 16th July 2011, 21:54
what is your OSC value?

- 16th July 2011, 22:10
PULSOUT toggles the pin twice to create the pulse, so set both pins to ground before PULSOUT for a high-going pulse.

- 17th July 2011, 14:17
Thanks for all the help. I'm using the internal oscillator at 4 Mhz. I set both pins to low and it works perfectly! Thanks Bruce!