General information
Category:
COM/DCOM and OLE Automation
Title:
Communication with libra
I need to communicate through comm port with libra. I have communication protocol but I never did it and need help.
I wonder to use mscomm ole class.
Communication mod is 9600, 8N2 (solution is thisform.oleclass.settings = 9600, 8,N,2 ?)
I need to initialize libra with message contains characters
"#"
"J" - libra code
10-LF end of message (solution thisform.oleclass.output="#J"+CHR(10) ?)
To read mesurement from libra i need to sent to libra characters
"J" - libra code
“R” – read command
240 – F0h+0
240 – F0h+0
10 – LF end of message (solution thisform.oleclass.output= ????? I dont now what)
Libra should return
“J” – libra code
N – number, meaning lenght of varijable, in this case 7
N times two bytes which contains data, formatted like:
FHh = F0 hex (240) + hihger nibl of byte of message
FLh = F0 hex (240) + lower nibl of byte of message
(for example array 241, 243 decoding like 19)
next checksum byte on same way:
FHh – 240 + hihger nibl checksuma
FLh – 240 + lower nibl checksuma
[checksum calculates like: (libra code) xor (first byte of data) xor … xor (last byte of data)]
10 – LF end of message
Should I read thisform.oleclass.input ?? and how to translate what I get??
Structure of variabile zero (what ever is it) contains of 6 signs from display plus flags:
bit 0 (1) = unit kilogram
bit 1 (2) = unit gram
bit 2 (4) = out of range
bit 3 (8) = tara
bit 4 (16) = nett
bit 5 (32) = inaction
bit 6 (64) = zero
bit 7 (128) = unit tons
How to interpret this?
My idea is to have command button and when I click on it programm populate some field with value returned from libra.
Thanks in advance for help.
P.S. Maybe is my translation bad, sorry. I have protocol in Serbian language.
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only