Last active
June 28, 2022 22:14
-
-
Save TristanOrta/df415c88601bc78db9ebf8e008cb38e7 to your computer and use it in GitHub Desktop.
weight capture of a scale through serial COM port to powerbuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this module corresponds to an OleCustomControl object of powerbuilder, the read COM port function is called, which is also among my GIST | |
String ls_car | |
integer peso | |
// the object is read until a 6-digit result is obtained if the ascci character 10 is detected | |
if MSCOMM_LEER_PESO_LO.object.CommEvent = 2 then | |
ls_car = MSCOMM_LEER_PESO_LO.object.Input | |
if Asc(ls_car) = 13 then Return | |
if Asc(ls_car) = 10 then | |
if Len(is_cadena) = 6 then | |
// the obtained string is assigned to il_peso_dos | |
il_peso_uno = Dec(is_cadena) | |
mscomm_leer_peso_lo.object.portopen = false | |
// assign the value to an instance variable, and this is assigned to my datawindows | |
il_suma =il_peso_uno | |
MiDW.SetItem(1, "DWCB", il_suma) | |
return | |
else | |
is_cadena = '' | |
return | |
end if | |
else | |
is_cadena += ls_car | |
end if | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment