serial comms BS2 to VB app
realolman
Posts: 65
I am communicating with a·BS2 from a VB express app using
in the BS2
and
·······
·······
to send a * character to the BS2 from the VB app·telling it that I want it to·send the value of "Seconds" ·to my app· ...
and using
to read the BS2 response. I always get the * that I sent to the BS2 as part of txtSerialPort.Text
I don't think the BS2 is doing it , but I don't know.
·I have tried
VB
again right after writing the star, because it seems that "empties " the buffer after a read... If I read it twice I get nothing on the second try., but it doesn't make any difference right after the write...
·I've tried VB
and VB
but it doesn't seem to help
I suppose I could use some technique in the VB app to strip off the *, but I would llike to make it quit doing that and understand why it's doing it.
Would the BS2 be doing it?
Seconds VAR Word Comms VAR Byte LookComm: SERIN 16, 16780,500,Counting, [noparse][[/noparse]Comms] Counting: PAUSE 500 IF Comms <> 0 THEN SEROUT 16, 16780, [noparse][[/noparse]DEC4 Seconds] Comms =0 ENDIF Seconds = Seconds+1 GOTO LookComm: END
in the BS2
and
·······
·······
SerialPort1.Write("*")
to send a * character to the BS2 from the VB app·telling it that I want it to·send the value of "Seconds" ·to my app· ...
and using
txtSerialPort.Text = SerialPort1.ReadExisting
to read the BS2 response. I always get the * that I sent to the BS2 as part of txtSerialPort.Text
I don't think the BS2 is doing it , but I don't know.
·I have tried
VB
txtSerialPort.Text = SerialPort1.ReadExisting
again right after writing the star, because it seems that "empties " the buffer after a read... If I read it twice I get nothing on the second try., but it doesn't make any difference right after the write...
·I've tried VB
DiscardOutBuffer
and VB
DiscardInBuffer
but it doesn't seem to help
I suppose I could use some technique in the VB app to strip off the *, but I would llike to make it quit doing that and understand why it's doing it.
Would the BS2 be doing it?
Comments
BS2...........SEROUT tx,baud,[noparse][[/noparse]"!",10,DEC4 seconds,10]
VB......
Do
in_string=SerialPort1.ReadLine
Loop Until in_string ="!"
data_in=SerialPort1.ReadLine
Jeff T.
What was said about the ECHO is correct, but that situation is limited to the use of Pin Port 16. This happens on ANY BS-2 model Stamp, not just the BS-2. If you use any other Pin Port, you will not experience the problem.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Programming can't be all that difficult, it's nothing but 1's and 0's
Jeff T
you guys are really something
I know the format of what the BS 2 is going to send , so I guess I'll just use the last digits of it and ignore the rest
thank you