ReadVariant method (Read 8226 times)
ReadVariant method on: May 28, 2010, 09:12:05 AM
q1. is the ReadVariant method more or less like a "blockread" into buffer var?

i ask because i'm sending a packet of size byte[20] to the serial port and this statement from your VB examples, Log ("OnRxChar " + Str(Count)) , returns various count values.

thus the statement,  Received = SPortAx1.Read(Buff(1), Count) , doesn't read the entire packet.

q2. could this be an interrupt timing issue in order to get the correct count?

Re: ReadVariant method Reply #1 on: May 28, 2010, 03:17:49 PM

It is not recommended to use ReadVariant method to read the data in block mode. Note that it reads data from serial port input buffer only.

Could you, please provide us with the following information:

1) Specify your serial port settings.
2) Let us know whether Block Mode is used.
3) What timeouts are set?

Thanks in advance.

Re: ReadVariant method Reply #2 on: May 30, 2010, 10:35:43 AM
SPortAx1.BlockMode = True
SPortAx1.TimeoutReadTotalConstant = 110  '110ms

Re: ReadVariant method Reply #3 on: June 01, 2010, 08:54:18 AM

ReadVariant method does not support reading with Timeouts. If Read method failed to read all the bytes you've sent, then it is necessary to use ReadVariant in a loop until it reads all the data.
« Last Edit: June 01, 2010, 08:57:51 AM by Tina »

Re: ReadVariant method Reply #4 on: June 03, 2010, 08:31:28 AM
after your reply i believe i misunderstood the ReadVariant method in regards to what i need.



Sitemap 1 2 3 4 5