Last edited by cesar35; - 17th June 2014 at 18:15.
My VB is severly rusted but I think you've got a format mismatch between what VB is sending and what the PIC is expecting - as I suggested in a previous post.
I think that SerialPort1.Write(pos) will send the content of variable pos as an ASCII string while the PIC is expecting two binary bytes, not an ASCII string.
If that's the case you need to change the VB program or the PIC program, on the PIC side you can use the DEC modifier to recieve an ASCII string consisting of decimal digits and parse that into a value.
Again, there's a big difference between sending a byte as binary, ie 123 and sending it as an ASCII string. If you loop the TX to RX on the PC and fire up a terminal program, what does the data look like?
/Henrik.
Could you explain more "I have no command (RX) not working AC motors. Could you tell me why (RX) does not work."Originally Posted by cesar35
RX has the value "X" and the servo works so how is RX not working?
Steve Earl www.datageo.co.uk
Hello
After modifying (DEC POS) The RX does not work
I can send data to the rx ac motors not working.
So the servant move
I used (Servo gosub)
The servant problem has already works better
Thank you all.
serin2 RX_inp,16468,500,PAR,[wait("PC"),RX,DEC POS]
IF RX = "A" THEN FRE
IF RX = "B" THEN TRA
IF RX = "C" THEN ESQ
IF RX = "D" THEN DIr
GOSUB SERVO
GOTO PROG
SERVO:
servo1 = 1
PAUSEUS 1000 + pos
servo1 = 0
Pause 16
RETURN
You are saying that POS is received and works but "X" is not received.
Steve Earl www.datageo.co.uk
I noticed he changed HIGH/LOW to 1/0.
Robert
Edit: (if I'm awake) a bipolar motor needs the 4 inputs to vary in a specific order (one for CW, one for CCW).
If you keep turning on the motor but these don't change state, I think you end up with the motor holding position.
Last edited by Demon; - 20th June 2014 at 13:55.
Bookmarks