TPCTJ

MrPLC Member
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About TPCTJ

  • Rank
    Hi, I am New!
  • Birthday 10/31/79

Profile Information

  • Gender Male
  • Location Minnesota
  • Country United States
  1. You are the MAN, Mr. Carlton!
  2. OK, so I have a CL L61 and am communicating with a Veeder-Root 350+. I have established the comm and am getting valid data. The problem I am having is the data I am receiving comes in as a string of 8 SINTs which when the “Style” of the data format for each SINT is changed to ASCII, is when I get the character I need. For example: From the first word to the last in DECIMAL – 52 , 49 , 70 , 70 , 68 , 49 , 54 , 48 these are 16 bit SINTs that translate in ASCII to – 4 , 1 , F , F , D , 1 , 6 , 0. Now, each one of these characters can be translated into 4 bit nibbles because in HEX they need only 4 bits…. With a piece of paper, I can take the 0100 0001 1111 1111 1101 0001 0110 0000 and make that the floating point number I need. It’s easier to see like this: 4 1 F F D 1 6 0 0100 0001 1111 1111 1101 0001 0110 0000 The formula to break this down is quite cumbersome and I am not sure if the PLC is up to the challenge. First, you take the very first bit, if it is 0 the number is positive 1 is negative. Then the next eight bits is called the exponent, subtract 127 from that number (131 in this case) and you take 2^(131-127) to get 16. The last 23 bits are called the mantissa. Take this number, 8,376,672 and divide it by 8,338,608 and add 1 to get 1.99857711. Multiply this by 16 from earlier to get 31.98. I am looking into some bit shifting and bit pulling instructions to maybe get what I need. If you know of a better way to do this, I would greatly appreciate your help. Thank you, T.J.