Serial Port Interfacing
There are many ways to communicate with Serial Port. It depends on which Development Environment you are using.
For instance suppose we are using Microsoft Development tools like; Visual C++ 6.0/.NET, Visual Basic 6.0/.NET than we can make use of a very robust control namely Microsoft Communication Control 6.0 (Visual C++) or Microsoft Comm Control 6.0 (Visual Basic).
MSComm Control MSDN Link Explaining the control functionality
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/comm98/html/vbobjcomm.asp
MSComm Control Example ( Visual Basic Example )http://msdn.microsoft.com/library/default.asp?url=/library/en-us/comm98/html/vbobjcommx.asp
-------------------------------------------------------------------------------------------
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-------------------------------------------------------------------------------------------
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-------------------------------------------------------------------------------------------
In java follow the link http://java.sun.com/products/javacomm/downloads/index.html
If still there is something ambigous, do let me know.
Comments