You could also post the vb.net program.
You could also post the vb.net program.
Steve Earl www.datageo.co.uk
Hello thank you guys for the help.
Here is the data I'm sending to the pic
With vb.net
I control the camera using servo motor for movement
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
pos = CInt(TrackBar1.Value)
Label8.Text = pos
SerialPort1.Write("PC")
SerialPort1.Write("X")
SerialPort1.Write(pos)
'POS MAX 2300
'POS MIN 7000
End Sub
Last edited by cesar35; - 17th June 2014 at 14:43.
As far as I know, X1 will be 0 first time through, maybe. I always set variables to 0 at top of program.
PAUSEUS will be nothing so SERVO1 will be turned OFF quite fast.
Then the PIC will wait for the next SERIN from the PC, it won't emit more pulses until then.
Assuming your MODE is configured properly.
Robert
Last edited by Demon; - 17th June 2014 at 15:23.
Hello Robert okay
you have to make an example as I do
I think I'm losing myself in programming
Between two pic I did worked.
With pc always had the difficulty.
Thank you.
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
Bookmarks