-
Is it possible to read from a serial port like reading a file?
If so, How?
I would normally use
strTemp = space(LOF(Filenum))
get filenum,,strtemp
to read in one 'gulp' but LOF doesn't seem to work on com1.
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
what you need is the mscomm component add one in your form and add the following code
dim data_in as any
MSComm1.CommPort = 1 ' We will be using Com1 as the default com port.
MSComm2.PortOpen = True ' Open the port for use.
data_in = MSComm2.Input
-
sorry they should all have been Mscomm1 (if that is the object added)
Any more help please do not hesitate to contact me
[email protected]
Co Galway
Ireland
-
Thanks for your reply but that's what I'm using at the moment. I wanted a 'lower level'
method!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
i kind of hesitated before posting this reply but then i noticed u were a proam analyst ... so there ... i dont really know how to do it on vb ... but i can tell how to do it on c++ ( i am not sure it worlks on vc++)
include the header dos.h (among the classical ones)
and to print to a port use this code :
outport (portnumber,byte)
to read :
inport (portnumber)
in ur case portnumber would be the decimal number of com1 which i think is 1016(for 3F8 in Hex) com2 is i think 760 for 2F8
i might have mixed com1 with com2 but the cxonversion is correct(i used a calculator :) )
i hope this helps ... i would apreciate any feedback because i am currently working on a project in c++ that use these functions ...
- regards -
- razzaj -
-
To outut to a port or input from a port using the stuff in the above post, you need to find a program called inpout.zip or inpout16.zip or inpout32.zip at http://www.lvr.com/parport.htm
This works for the parallel port, but should also work for the serial if you have the right port address. The specifics of how to do it are in the zip and on the page. Good luck,
bob
-
Thanks for your suggestions Bob and razzaj.
I haven't had time to look into them yet though!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company