LB Booster
Programming >> Compatibility with LB4 >> COM port numbering http://lbb.conforums.com/index.cgi?board=compatibility&action=display&num=1406404904 COM port numbering
Post by net2014 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 Re: COM port numbering
Post by Richard Russell on Jul 26th, 2014, 9:48pm
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. Re: COM port numbering
Post by net2014 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.
Re: COM port numbering
Post by Richard Russell on Jul 27th, 2014, 10:24am
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.