Author |
Topic: COM port numbering (Read 713 times) |
|
net2014
New Member
member is offline
Posts: 37
|
|
COM port numbering
« Thread started on: Jul 26th, 2014, 8:01pm » |
|
Code:
open "com7:9600,8,N,1" for random as #comport
#comport,"V"
NumBytes = lof(#comport)
resp$ = input$(#comport, NumBytes)
print resp$
close #comport
The above code works ok in LB4.04 but baulks at the first line in LBB. I'm trying to send serial data to a usb/serial device which registers as com7.
WINxp/LBB v2.63
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: COM port numbering
« Reply #1 on: Jul 26th, 2014, 9:48pm » |
|
on Jul 26th, 2014, 8:01pm, net2014 wrote: Code:
open "com7:9600,8,N,1" for random as #comport |
|
LBB (or, more to the point, the Windows BuildCommDCB API function which does the work) requires the parameters to be in the conventional order - baud rate, parity, number of data bits, number of stop bits:
Code:open "com7:9600,N,8,1" for random as #comport That's also the order specified in the Liberty BASIC docs, so your code worked in LB 4.04 only by chance.
Richard.
|
|
|
|
net2014
New Member
member is offline
Posts: 37
|
|
Re: COM port numbering
« Reply #2 on: Jul 27th, 2014, 09:37am » |
|
Thanks Richard. The quoted code was just copied/pasted from serial code I have been using for years so I assumed it was correct. I wish I could remember all these LB foibles!
Even during my working life, RS232 was often referred to as using '8N1' transmission, so I will seek out all my serial code and rearrange the parameters.
Thanks again for your speedy response.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: COM port numbering
« Reply #3 on: Jul 27th, 2014, 10:24am » |
|
on Jul 27th, 2014, 09:37am, net2014 wrote:Even during my working life, RS232 was often referred to as using '8N1' transmission |
|
Perfectly logical, considering that it's the order of transmission (data bits, then an optional parity bit, then stop bit[s]), but the MS-DOS MODE command - from which everything else derives I think - didn't specify it like that.
Richard.
|
|
Logged
|
|
|
|
|