George
10-19-2001, 11:27 AM
Hi guys. I would like to use the mscomm cotrol to send out through serial port one byte of data. Any ideas on how to do it? And I would alsow like to know, how to rescieve one byte. Any information on how to do this are welcome.
Best regards to you all!
BillSoo
10-19-2001, 12:03 PM
First, set up your port and open it:
mscomm1.settings = "9800,n,8,1" '9800 baud, no parity, 8 data bits, 1 stop bit
mscomm1.commport = 1 'set to use COM1
mscomm1.portopen = true 'open the port
Then, to send a byte, use the output method
mscomm1.output chr$(27) 'sends an ESC char
To receive a byte, you can either use the event handler or just poll the port. For instance, suppose you had a timer set to go off every half second:
sub timer1_timer()
if mscomm1.inbuffercount then text1.text = text1.text & mscomm1.input
end sub
George
10-19-2001, 12:42 PM
I understand the input part. But I would like to send out a variable ( dim as byte ) and not an ESC char ( what is that anyway ? ). Plese Help!
BillSoo
10-20-2001, 12:26 AM
Basically, I just sent out byte 27 which to most printers is interpreted as an ESCAPE character.
But you can use whatever you need.... chr$(18) will send out byte 18 for instance.....
boskomihic
10-28-2001, 11:10 AM
If you installed samples with Visual Basic 6 than you have VBTERM project
When you see this example you will know that.