Red Lion, Crimson 3, convert 16 bit Integer to 8 Bit

Join Date
Mar 2015
Location
Alberta
Posts
18
Hello all, I wonder if someone might have some insight on how to convert a 16 bit Integer value into an 8 bit array in Crimson 3.

Example: Integer 12345

8 bit array:

Array[0] = 48 (12345/256=48.22)
Array[1] = 57 (12345-(48*256) =57)

Thanks,
 
Glad you got something working. Sorry for my belated response.

An 8 bit integer will be limited to 256 values 0-255. If your your 16 bit value will be larger than that you won't be able to convert a 16 bit value to 8 bit unless your store in multiple registers, I'm not sure how that would ever to useful. Essentially, you would be stripping the first 8 bit values from the 16 bit register and load those into the 8 bit register.

For example you could use a limit comparator to make sure the 16 bit integer is between 0-255 then set the 8 bit register equal to the 16 bit integer. The 0's at the end should be truncated during the operation. I find this easier to do in the Plc by just setting bits 0-7 of each integer equal to each other. This method doesn't handle any kind of overflow though.
 

Similar Topics

How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
107
Hi, I am trying to increase the size of the user login pop up using a Red Lion CR1000 7” HMI with Crimson 3.1 software. The login pop up is very...
Replies
2
Views
668
Hello, We are currently running a bunch of g310's connected to their SLC5 PLCs through ethernet. I've attempted to upgrade the program from 2.0...
Replies
1
Views
1,121
Hi I have been using Red Lion products for some time, I had a thought over the bank holiday weekend, As you do. It would be nice if whenever a...
Replies
4
Views
1,016
Well, I have yet another question for the great minds on this forum! We have a red lion HMI for one of our machines and every time I hook my...
Replies
11
Views
1,670
Back
Top Bottom