That is what is required to communicate to this serial device.
Dim Header1 as string, Header2 as string , CmdID as string, length as string, Content as string , CRC as string Dim intPortID As Integer ' Ex. 1, 2, 3, 4 for COM1 - COM4 Dim lngStatus As Long Dim strError As String Dim strData As String Header1 = XXXX (converted to binary code) Header2 = XXXX (converted to binary code) CmdID = XXXX (converted to binary code) Length = XXXX (converted to binary code) Content =????? (converted to binary code all in Json) CRC = XXXX (converted to binary code) strData = <Header1><Header2><CmdID><Length><Content><CRC> ' Initialize Communications lngStatus = CommOpen(intPortID, "COM" & CStr(intPortID), _ "baud=9600 parity=N data=8 stop=1") If lngStatus <> 0 Then ' Handle error. lngStatus = CommGetError(strError) MsgBox "COM Error: " & strError End If ' Set modem control lines. lngStatus = CommSetLine(intPortID, LINE_RTS, True) lngStatus = CommSetLine(intPortID, LINE_DTR, True) ' Write data to serial port. lngSize = Len(strData) lngStatus = CommWrite(intPortID, strData) If lngStatus <> lngSize Then ' Handle error. End If
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
An Experts Exchange subscription includes unlimited access to online courses.Get Started
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE