| View previous topic :: View next topic |
| Author |
Message |
DavidR Contributor

Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Tue Apr 08, 2008 3:29 pm Post subject: TCP - Binary Data |
|
|
I'm really struggling with what I think should be a simple application.
I need to be able to send a string of data to a device in response to a query from the device. I can use either serial or TCP.
I've tried the COMM function in VDS 6 but it can only handle text.
I love VDSIPP and use it extensively but have not been able to figure out how to detect incoming data unless it's terminated by a line feed.
Sending the data response has not been a problem. Detecting the incoming data has so far been impossible.
For example the device might send 23 FF (hex) to which I need to respond with F8 00 FF.
Is there a reasonable way to do this that I might be overlooking?
Thanks.....
...........David |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Wed Apr 09, 2008 7:20 am Post subject: |
|
|
Unfortunately it probably won't be possible with the vdsipp.
Using the INTERNET, TCP SIMPLESEND command will let you send data without a linefeed but there is no way to get data back without a line feed.
The @internet(tcp, message) function will not return any data as it will only return data once a line feed has been processed. The reason I wrote it like this is because without a linefeed I would have had to generate an event on each character sent (while possible would have made using the extension much harder to understand/use).
I believe Tommy Sools had a internet extension as well which may handle data without a linefeed. |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Apr 10, 2008 12:31 pm Post subject: |
|
|
| DavidR wrote: | | I can use either serial or TCP. |
Will this help?
It's from Tommy's VDSDLL pack
| Quote: | VDSSERIO
Description:
With this VDSDLL part, you can control a serial port. You’ll retrieve buffered input from the serial port and transmit data towards a device connected to it.
Commands:
DLL SERIAL, PORT, <communication port number>
Specifies the communication port that’s to be used by the DLL, starting from 1.
DLL SERIAL, BAUDRATE, <baudrate>
Specifies the baud rate used for communications. This usually differs for each device.
<baudrate> could be one of:
110
300
600
1200
2400
4800
9600
14400
19200
38400
56000
57600
115200
128000
256000
DLL SERIAL, STOPBITS, <number of stopbits>
Specifies the number of stop bits to be used. This usually differs for each device.
<number of stopbits> could be one of:
1
1.5
2
DLL SERIAL, BYTESIZE, <bits per byte>
Specifies the number of bits contained in each byte. This usually differs for each device, although it’s often 8.
<bits per byte> could be one of:
4
5
6
7
8
DLL SERIAL, PARITY{, <parity checking>}
Specifies the kind of parity checking that’s performed, if any. This usually differs for each device, although it often isn’t disabled.
<parity checking> could be one of:
even
mark
odd
space
DLL SERIAL, OPEN
Opens the communication port with the specified settings.
DLL SERIAL, SEND, <encoded binary string>
Sends the specified data to the serial port. Even if the selected byte size is different from 8, you can treat the bytes as sized 8.
<encoded binary string> must be according to the following:
<two digits hexadecimal ASCII value of character 1><two digits hexadecimal ASCII value of character 2><two digits hexadecimal ASCII value of character n>
For example, the following could be provided in this case:
FF150088FB10
DLL SERIAL, CLOSE
Closes the communications port again after it’s opened. You should always do this before your script is closed, in case the port is opened anywhere in your script. It cannot be closed automatically. If you don’t do this, the memory used by the component cannot be freed up (no attempt to do this would be made either) and the script will either crash or leak memory. It’s advisable to use OPTION ERRORTRAP to close the port on exit of your script, even if any error occurs.
Functions:
@DLL(SERIAL, VERSION)
Returns the part’s version number.
@DLL(SERIAL, RECEIVE)
Receives any input from the serial port. Even if the selected byte size is different from 8, you can treat the bytes as sized 8.
The result will be according to the following:
<two digits hexadecimal ASCII value of character 1><two digits hexadecimal ASCII value of character 2><two digits hexadecimal ASCII value of character n>
For example, the following could be returned in this case:
FF150088FB10
Events:
SERIALRECEIVED – new data arrived on the serial port
SERIALSENT – the data in the data buffer has successfully been transmitted. Please do not depend on this event as it is only generated very rarely.
Errorcodes:
1201 – any error occurred in the communications
|
|
|
| Back to top |
|
 |
DavidR Contributor

Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Thu Apr 10, 2008 1:45 pm Post subject: |
|
|
Yes, that looks like it will do exactly what I want.
I placed an order for the DLL and as soon as I get the registration code I'll get started.
Thanks....
.............David |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|