communication between VAST en COM ports 
Author Message
 communication between VAST en COM ports

Is it possible to communicate with the COM ports in VAST 4.02?
If it is possible then please let me know.


Wed, 18 Jun 1902 08:00:00 GMT  
 communication between VAST en COM ports


Yes, you can read and write from the COM ports using the FileStreams
interface or, on Windows, the native Win32 API.

> Is it possible to communicate with the COM ports in VAST 4.02?
> If it is possible then please let me know.

Here is a copy of a post on which addresses your
question, The code dates from 4.0.2, so should work for you.  --->

 As Jun wrote, you can use either the filestream or native Win API classes
to do serial IO. Here is some sample workspace code for interfacing with a
serial ports
 using the Cfs classes.

 | deviceFile buffer rc readCount |

 deviceFile := CfsFileDescriptor
   open: 'COM1'
   oflag: ORDWR
   share: ODENYNONE.

 deviceFile isCfsError ifTrue: [CwMessagePrompter errorMessage:  'Error

 deviceFile inspect.

 " you can write to the comm port with: "

 buffer := 'ATQ0', Cr asString.
 rc := deviceFile write: buffer startingAt: 1 nbyte: buffer size. rc
isCfsError ifTrue: [CwMessagePrompter errorMessage: 'Error writing'].

 " you can read from the comm port with: "

 buffer := String new: 100.
 readCount := deviceFile read: buffer
   startingAt: 1
   nbyte: 100.

 readCount inspect.    "Contains the number of characters read from  the
port" buffer inspect. "Contains readCount number of characters
                           in positions 1 through readCount"

 deviceFile close. "close the port"

 Beware that under Windows, the buffer read will block if there is nothing
in the buffer until at least one character shows up. As far as I know, you
must use the
 native Win API calls (on the file descriptor) to check if there are
characters in the buffer if this is a problem. You must also use API calls
to do things like set the
 speed on the port.

 >    You have a number of options ...
 >    You can use the filestream classes to read/write to serial ports. If I
 > remember correctly, use the comm port name (e.g. 'COM1') as the filename.
 > Unfortunately, I don't recall how to set the device parameters (e.g. baud
 > via this method.
 >    Another is to use the Windows API specific classes to open devices.
Just get
 > a copy of the Win32 SDK help file and look up the functions (and how to
 > them) that deal with ports. The API function names are very similar to
the VAST
 > method names.
 >    The latter is the method I have used to communicate with my toys (i.e.
 > robots). :-) :-)
 > Jun Nolasco

 > > Hi,
 > >
 > > Has anyone read or wrote data to a serial port on a computer running
 > > NT 4.0? Is there a third party vendor that has done this? We are using
 > > Visual Age Smaltalk 4.5.
 > >
 > > Your help would be appreciated.
 > >
 > > Jeff.

 Doug Swartz

Wed, 18 Jun 1902 08:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 


2. communication with COM-port

3. Com Port Communication

4. COM<->COM communication

5. Printing to LPT port or COM port

6. How to make paraller port be a com port

7. Com port and command with serial port

8. VAST and COM?

9. COM Automation and VAST

10. Porting Object Studio to VAST

11. VAST: File-in version of Odell port of Beck framework

12. Port VisualAge C++ to VAST


Powered by phpBB® Forum Software