help w/ serial port - but not modem 
Author Message
 help w/ serial port - but not modem

Can someone give me an idea of how to use MSCOMM32.OCX to read from a
serial port?  Maybe some lines of sample code?

I'm trying to use a small unit to transmit text via the serial port into my
PC, but all of the samples and instructions I'm finding involves modems.  

Any assistance is appreciated.

thanks--
SLiM Durham



Tue, 10 Aug 1999 03:00:00 GMT  
 help w/ serial port - but not modem



| Can someone give me an idea of how to use MSCOMM32.OCX to read from a
| serial port?  Maybe some lines of sample code?
|
| I'm trying to use a small unit to transmit text via the serial port into
my
| PC, but all of the samples and instructions I'm finding involves modems.

|
| Any assistance is appreciated.
|
| thanks--
| SLiM Durham

|
|

Before you do any of the below make sure that you set your port to the
correct number

comDialog.comport = 1
comDialog.PortOpen = True       'This opens the com port
comDialog.InputLen = 7          'This sets the length of the input buffer. You can
set this value to anything you                          'want up to 255. 0 will let you read the
whole string line.
string$ = comDialog.Input       'This gets the data from the device you are
accessing

comDialog.PortOpen = False      'This closes the com port

I hope this helps. Let me know if you need any more help.
George McCormick



Tue, 10 Aug 1999 03:00:00 GMT  
 help w/ serial port - but not modem



Quote:
>Can someone give me an idea of how to use MSCOMM32.OCX to read from a
>serial port?  Maybe some lines of sample code?

>I'm trying to use a small unit to transmit text via the serial port into my
>PC, but all of the samples and instructions I'm finding involves modems.  

>Any assistance is appreciated.

>thanks--
>SLiM Durham


Yeah, the docs for the comm objects all seem to think that the only
way a serial port can be used is to talk to a modem. I use PDQComm and
they assume the same thing.

First of all, when your talking to a "device" ignore the commands that
send and receive a string.

Go directly to a character by character basis.

Thus:

FullString = ""

Comm1.InputLen  = 1     ' one char at a time

do
        a = comm1.input
        FullString = FullString & a
        if a = chr(13) then                     ' here we're looking
                                                ' for a cr to end
                                                ' but you can look
                                                ' for what ever
                exit do
        end if
loop

Off course you can (and probablly will) place timers etc. in the code
to prevent setting there if you never get any input.

The point is, get primative - don't trust the high level stuff that
comes with the control, you'll never get it to work on the level you
have to have to do data retrieval and contol.

Hope this helps, John



Wed, 11 Aug 1999 03:00:00 GMT  
 help w/ serial port - but not modem

Quote:

> Can someone give me an idea of how to use MSCOMM32.OCX to read from a
> serial port?  Maybe some lines of sample code?

> I'm trying to use a small unit to transmit text via the serial port into my
> PC, but all of the samples and instructions I'm finding involves modems.

> Any assistance is appreciated.

> thanks--
> SLiM Durham


Take a look at the source code at
http://members.aol.com/rander1040/index.html.

Randy



Fri, 13 Aug 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help to program the serial port (null modem) with the win32 api (not MSComm)

2. Data from serial port, but not modem

3. Serial port/modem access/file transfer in VB

4. VB Communications, MSComm, Serial Ports and Modems...

5. Modems, Serial Ports, MSComm and VB

6. Modem, serial port, MSComm and VB Communications

7. Serial port, MSComm, Modem and VB communication

8. ocx that handles modem and serial port !!

9. Getting modem serial port

10. Getting modem serial port

11. I/O port, Parallel port, Serial port

12. Modems and Modem Ports

 

 
Powered by phpBB® Forum Software