[Gambas-user] Serial I/O with byte data

Mike Crean mike.crean at ...2897...
Tue May 16 09:32:19 CEST 2017


Hi, as I said before most likely Modbus RTU or similar protocol. If so you will need to do some BIT bashing and probably 
some CRC conversion. You will need to know the frame size among other things.

Public Sub HbLb()
  Dim Xz2 As Long
  Hb = Fix(DataS / 256)
  Xz2 = Fix(256 * Hb)
  Lb = DataS - Xz2
End
RegardsMike
 

    On Monday, 15 May 2017, 23:29, ML <d4t4full at ...626...> wrote:
 

 Alex,

Without knowing the protocol/device you're communicating with, I don't
think anyone will be able to give substantial help.
But, after years of interfacing very diverse hardware via RS-232 (fiscal
printers, cash-hanlding hardware, GPS, you name it!), I can tell you
that it's not always easy, and docs sometimes lack info or are plain wrong.
Unfortunately the bulk of my experience with hardware is in VB6...
Maybe you're looking at some kind of protocol wrapper bytes... Can't
really say without the detail.

On 15/05/17 08:52, alexchernoff wrote:
> Thanks, it works (both with .tostring and reading one by one...
> But I get values I don't know how to convert, e.g. where I expect a
> decimal 83 or hex 53 I get byte value of 253 ... Or instead of Decimal
> 15 I get 225 :(
> cheers!


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


   


More information about the User mailing list