Lembit Soobik
lembit.dbamail at t-online.de
Wed Sep 27 07:32:38 CDT 2006
wow, thanks a lot, Stuart, I did use Power Basic some years ago, so I will go and install it and use it for this. thanks Lembit ----- Original Message ----- From: "Stuart McLachlan" <stuart at lexacorp.com.pg> To: "Discussion of Hardware and Software issues" <dba-tech at databaseadvisors.com> Sent: Wednesday, September 27, 2006 1:34 PM Subject: Re: [dba-Tech] OT: Is anyone into controllers? > 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 > > > _______________________________________________ > dba-Tech mailing list > dba-Tech at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-tech > Website: http://www.databaseadvisors.com