can PULSOUT cause interference??
Annoying
Posts: 50
I have had this issue for so long and have not found a solution! I will be so happy if this can be explained...So I am using xbees to communicate between two BS2's, which works very well. My program has an IF condition for the pulse·data received being greater than 3100, and it is supposed to remain in a loop until the received pulse value is below 2000. When I simply print out the word "hello" in the loop, it works as it should, prints the word repeatedly until the UNTIL pulse <2000·condition happens. HOWEVER, when I include the line PULSOUT 11, 770, the program exits the loop immediately after the condition pulse > 3100 is violated and does not remain in the loop. Because the program worked properly with·DEBUG "hello", I know the problem must be with PULSOUT, and I am spellbound as·to why this is. THANK YOU FOR READING THIS!
RX PIN 7 ' Receive Pin
TX PIN 6 ' Transmit Pin
pulse VAR Word 'received data value
HIGH TX ' Idle transmit pin
DO
SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse.HIGHBYTE,pulse.LOWBYTE]
·· IF pulse > 3100 THEN
·· DO UNTIL pulse <2000
····· SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse.HIGHBYTE,pulse.LOWBYTE]
··· PULSOUT 11, 770
··· DEBUG "hello"
·· LOOP
·· ENDIF
DEBUG ? pulse
LOOP
RX PIN 7 ' Receive Pin
TX PIN 6 ' Transmit Pin
pulse VAR Word 'received data value
HIGH TX ' Idle transmit pin
DO
SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse.HIGHBYTE,pulse.LOWBYTE]
·· IF pulse > 3100 THEN
·· DO UNTIL pulse <2000
····· SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse.HIGHBYTE,pulse.LOWBYTE]
··· PULSOUT 11, 770
··· DEBUG "hello"
·· LOOP
·· ENDIF
DEBUG ? pulse
LOOP
Comments
-Phil
BTW, did you try the experiment I suggested?
-Phil
http://www.superdroidrobots.com/shop/item.asp?itemid=670
this is the BS2:
http://www.parallax.com/Store/Microcontrollers/BASICStampOEM/tabid/135/ProductID/21/List/0/Default.aspx?SortField=ProductName,ProductName
thank you so much!
The documentation for the servo doesn't say anything about the maximum current draw of the servo, only that it draws at least 700mA under very light mechanical load. You can be sure that it will draw at least 3-4 times that under heavy load or when first starting up under light load.
You may need to give the Stamp its own power supply. Make sure all the grounds are connected together.
If your supply should be adequate, you may need to provide a direct connection from the Stamp to the power supply. You may want to provide some filtering (like a 1000uF electrolytic capacitor) across the power supply leads at the Stamp.
Something else to consider would be noise conducted into the control signal line from the servo. It's probably not what's causing the reset, but try a 1K resistor mounted close to the Stamp between the I/O pin and the servo's control line.
2) A single PULSOUT doesn't cause much movement of a servo since the servo will shut down if it doesn't receive another pulse within a little more than 20ms. Your program won't work very well either since I don't see it repeating the pulse within 20ms. If the info comes in fast enough from the xBee, that might happen, but the DEBUG statement will probably push the timing beyond 20ms.
3) Any voltage is determined in reference to two locations in a circuit. By convention, we refer to a single reference point as the circuit's ground point. If you power the Stamp from a separate supply and there's no common ground connection, what determines the voltage that the Stamp's I/O pins see or produce? The Stamp's PULSOUT statement produces pulses that go from 0V to 5V in relation to the Stamp module's power supply ground. What voltage would the servo see if there's no common ground? Nobody knows. In any event, it wouldn't work as expected.
Another thought is to give the Stamp a small filter cap at it's VDD output. Since that's hard wired between regulator & stamp functions..The power can't bleed back into the main circuit. AND, This will protect against any ripple the regulator gives while it's adjusting to sudden volatge fluctuations from the "shared" supply voltage.
If you're wanting a larger cap...I would suggest a diode/resistor combo. Use the diode to allow high draw demands by the Stamp. Meanwhile, the properly valued resistor will limit the charge current from the onboard regulator to avoid damaging it. Just schedule in a few moments of initial inactivity after power-up...while the cap charges.
My personal nominal stamp circuit includes a small cap on the VDD (Just out of paranoia/training). My military radio systems used shared power supplies with diode switching between Internal & External power. That way, if one failed/choked the others could take the slack. for as long as needed. But, the Caps were the REAL lifesavers.
(BTW i am aware that he's NOW using a seperate supply.· This is just FFT.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Before you criticize someone, walk a mile in his shoes. That way if he gets angry, he'll be a mile away and barefoot. - unknown
Post Edited (sumdawgy) : 4/21/2010 4:36:30 PM GMT