Unity Pro %sw52 extract day/month?

jon561

Member
Join Date
Jun 2014
Location
Saskatchewan
Posts
2
I need to seperate the day from the month on %SW52 on Unity Pro. I convert the BCD to INT and end up with a number eg. 0630. How do i extract the day and month to seperate variables?
 
I would have used the Word_As_byte instruction to split into high byte and low byte then byte_to_int for each byte
 
Or you can just DIV by 100 to get the month once converting BCD to INT, and then MOD by 100 to get the days. I use this with the Hours / Minutes register %SW51 for providing a time register to some of the "less capable" RTUs which they can easily interpret.
 
Or you can just DIV by 100 to get the month once converting BCD to INT, and then MOD by 100 to get the days. I use this with the Hours / Minutes register %SW51 for providing a time register to some of the "less capable" RTUs which they can easily interpret.


Or this also works. Dividing with 100 to get the month. After this multiple month with 100 and subtract from original month_day format to get the days.

(eg. 0701 / 100 = 07 (month)
07*100 = 700
0701-700 = 01 (day)

simple but long method ;)
 

Similar Topics

Hello, I am using Unity pro V15. I have Quantum CPU 671 and Ethernet NOE 77101 configured. I have configured IO scanning on NOE. I have attached...
Replies
5
Views
137
HELLO MY FRİENDS ı have problem. ı tought you can solved thıs problem for me. First of all When I checked all the cable connections of the...
Replies
0
Views
381
Hi All, I haven't installed Unity Pro in years and needed to install it recently. I initially tried installing Version 11.1 and the whole...
Replies
3
Views
631
Hello i want to implement a Read_var / Write_var functions to communicate with a modbus tcp device at the moment i use the unity simulator at the...
Replies
4
Views
1,849
Hi, I've exported a PL7 application to the .FEF file succesfully. Imported the .FEF file in my Unity Pro project, but two of the five sections in...
Replies
0
Views
752
Back
Top Bottom