Computers, Consoles and I.T. Post all computer related chat in here for our I.T techies to help with. Please be aware that any discussions related to piracy will be removed and render the member liable to a possible ban. Piracy renders PassionFord Admin liable for prosecution, as well as its members.

RS232 to OPC

Thread Tools
 
Search this Thread
 
Old Nov 19, 2004 | 07:07 AM
  #1  
foreigneRS's Avatar
foreigneRS
Thread Starter
Testing the future
 
Joined: Jul 2003
Posts: 17,597
Likes: 24
From: W. Sussex
Default RS232 to OPC

Anyone good at programming in VisualBasic or something? Or know any free software that can do this?

I need to write an application that will read data from an RS232 device over the serial port and output it onto an OPC server.

The COM port settings need to be changeable, not necessarily graphically, and a prompt (maybe some characters and a terminator) needs to be sent to the device for it to make an output.

Any help or tips will be much appreciated.
Reply
Old Nov 19, 2004 | 07:23 AM
  #2  
frog's Avatar
frog
0-60 in 17 seconds (eek)
 
Joined: Apr 2004
Posts: 6,717
Likes: 0
From: Berkshire
Default

Try these:

http://www.cpcug.org/user/clemenzi/t...s/SerialIO.htm
http://www.microsoft.com/downloads/d...DisplayLang=en

I am sure there's a control called MSCOMM32.OCX or something that's just for that kinda thing - try project - components - microsoft comm control 6.0 in the list (That's in VB6).

From the VB help:
MSComm Control Example
The following simple example shows basic serial communications using a modem:

Private Sub Form_Load ()
' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input
' is used.
MSComm1.InputLen = 0
' Open the port.
MSComm1.PortOpen = True
' Send the attention command to the modem.
MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that
' the modem responds with "OK".
' Wait for data to come back to the serial port.
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, "OK" & vbCRLF)
' Read the "OK" response data in the serial port.
' Close the serial port.
MSComm1.PortOpen = False
End Sub

Note The MSComm control can use polling or an event-driven method to retrieve data from the port. This simple example uses the polling method. For an example of the event-driven method, see help for the OnComm event.

Good luck - hope this helps.
Reply
Old Nov 23, 2004 | 08:49 AM
  #3  
foreigneRS's Avatar
foreigneRS
Thread Starter
Testing the future
 
Joined: Jul 2003
Posts: 17,597
Likes: 24
From: W. Sussex
Default

cheers frog

was starting to look at MSCOMM32.OCX. looks like it will do the job. just have to learn VB, and i'll be away
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Rossy43
Cars for Sale
0
Dec 21, 2011 09:21 PM




All times are GMT. The time now is 04:43 AM.