Red Lion Crimson 3 and Large numbers

n8dcj

Member
Join Date
May 2012
Location
Ohio
Posts
1
I am using a Kadet with Crimson 3 , I am new to the Crimson software and trying to come up to speed....

my issue at the moment is that the data I get from a controller is formatted into a string "FFFEE4E0" for example , my problem is that it overflows an integer , and so far I have been unsuccessful at converting it to anything else. I need to do some math with these types of numbers something like:

(FFFF0BE7 - FFFEE4E0)/400,000 which should equal ~ 0.025

how can I do this in Crimson 3 ?

Thanks In Advance

Dan
 
You will need to convert the strings to integers with the TextToInt function, then convert them to Real if you want to end up with a fractional number. In other words, make an Real tag with the formula:

(TextToInt(StringVar1,16) - TextToInt(StringVar2,16)) / 400000.0

Crimson handles 32-bit integers as signed, so your intermediate numbers will show up as negative if the 8th hex digit is F, but that doesn't matter if you're just calculating the difference.

The above formula worked in my emulator with the sample strings you provided.
 
I'm assuming that you already have the data in a hex formatted integer, since you can't do math with a string.

If so it doesn't sound like your problem is overflow. When you divide, try changing it to "400000.0" It will force it to floating point math during the calculation.

if 400,000 is a tag, then multiply by 1.0 before dividing.
 
Last edited:

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,015
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