Stuart McLachlan
stuart at lexacorp.com.pg
Wed Sep 27 06:34:05 CDT 2006
On 27 Sep 2006 at 10:30, Lembit Soobik wrote:
> oh, thats great. Thanks a lot.
> now I only need to find out how to talk to the serial,
> but I think there must be some dll or such around somewhere.
In Access, or VB the simplest way is to use the MSComm control.
Personally, I use PowerBasic (http://www.powerbasic.com) for this sort of
thing. Here's a bit of sample code to show how complicated it is to write
something to a serial port <g>:
LOCAL strPort AS STRING
LOCAL strData AS STRING
LOCAL lngFilenum as LONG
strPort = "COM1" 'comm port to write to
strData = "ATZ" & CHR$(13,10) 'data to write to port
lngFileNum = FREEFILE 'get next free handle
COMM OPEN portstr AS lngFilenum
COMM SET lngFilenum, BAUD = 9600 ' 9600 baud
COMM SET lngFilenum, BYTE = 8 ' 8 bits
COMM SET lngFilenum, PARITY = %FALSE ' No parity
COMM SET lngFilenum, STOP = 0 ' 1 stop bit
COMM SET lngFilenum, TXBUFFER = 2048 ' transmit buffer
COMM SET lngFilenum, RXBUFFER = 4096 ' receive buffer
COMM SEND lngFilenum, strData
COMM CLOSE lngFilenum
One of the sample apps that come with PB contains all the code you need to
read and write to a comm port.
--
Stuart