Search the Community

Showing results for tags 'hexadecimal'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Found 2 results

  1. Problem with comparison

    Hello all, we are building a solar tracker as part of a university project and we have problems comparing some values. We have two photoresistors that will be outputing two values between 0 and 10 volts. What we want to do is that if one is higher than the other to turn a motor in one direction but if it is the other way around, so that in turns a different direction. However, if the difference between them is lower than a set value, we want it to stay stationary (like a deadzone). We have the first part figured out but we have trouble with the deadzone. When substracting the two values we get negative values and we don't know how to handle negative hexadecimal values. Could we substract them but have the answer as an absolute differences? How could we do this? Thanks for the answers!
  2. I am working on  calculating a checksum value for a command that is to be sent from an Allen-Bradley CompactLogix PLC to a Mass flow controller. An example of a command is the following: "@@@022SX!20.00;CHECKSUM".  1. The checksum is the sum of every characters' ASCII code value (starting from character 3).  2.Then this sum (which would be in decimal format) has to be converted to HexaDecimal 3. Finally, the last two characters of the result have to be extracted and that would be the value of the checksum.  (For Ex: the value of every individual characters' ASCII code (starting from point 3) of the above command is 715. in HexaDecimal, 715 = 2CB. So , the value of the checksum for this command would be 2CB) I got to the point where i found the sum of ASCII code. Any idea on how to convert that to  a HexaDecimal and then convert that HexaDecimal to a string so that I could concatenate it to the command string??