Ewon TechForum
Providing technical solutions to technical requests


How to translate a tag into a BCD
Jean-Yves Offline
eWON Support
#1
It could happen that the value read by the eWOn is BCD (Binary Coded Decimal) and that you're not able to read it correctly because the eWON displays only the word value. 

Example of this script: The word value is 28804 but it must be displayed in BCD and that would be 7084


.png   2016-11-07_15h50_50.png (Size: 53,12 KB / Downloads: 24)


Code:
i%=28804
B1%#0 = i%#0
B1%#1 = i%#1
B1%#2 = i%#2
B1%#3 = i%#3

B2%#0 = i%#4
B2%#1 = i%#5
B2%#2 = i%#6
B2%#3 = i%#7

B3%#0 = i%#8
B3%#1 = i%#9
B3%#2 = i%#10
B3%#3 = i%#11

B4%#0 = i%#12
B4%#1 = i%#13
B4%#2 = i%#14
B4%#3 = i%#15

A% = B4% * 1000 + B3% * 100 + B2% * 10 + B1%
Print A%
Reply





Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy