Software Tools

Description

 - This program converts 16-bit unsigned (Binary Coded Decimal) BCDValueU register 42000 into 16-bit unsigned Integer Value register 42041.

- To accomplish this, the following steps are executed:

  1) The 16-bit BCD Value register 42000 is split up into 4 groups of 4-bits each as follows:
 bits  3     2    1    0 = Group1
 bits  7     6    5    4 = Group2
 bits 11  10    9    8 = Group3
 bits 15  14  13  12 = Group4

  2) Each group's 4-bit pattern is converted to an integer value as follows:
 bits 3,2,1,0 = Group1Int
 bits 7,6,5,4 = Group2Int
 bits 11,10,9,8 = Group3Int
 bits 15,14,13,12 = Group4Int

  3) Each group's integer value is multipled by incrementing factors of ten and then summed together as follows:
 (Group1Int * 10^0 ) + (Group2Int * 10^1) +  (Group3Int * 10^2) + (Group4Int * 10^3)

 The result is placed in Integer Value register 42041.

 Example A)

 BCD Value register 42000 = +65535 = 1111 1111 1111 1111
 Group 1 = 1111 = 15
 Group 2 = 1111 = 15
 Group 3 = 1111 = 15
 Group 4 = 1111 = 15

 Integer Value register 42041 = (15 * 1) + (15 * 10) + (15 * 100) + (15 * 1000) = 16665

 Example B)

 BCD Value register 42000 = +13000 = 0011 0010 1100 1000
 Group 1 = 1000 = 8
 Group 2 = 1100 = 12
 Group 3 = 0010 = 2
 Group 4 = 0011 = 3

 Integer Value register 42041 = (8 * 1) + (12 * 10) + (2 * 100) + (3 * 1000) = 3328

- The Register Editor dialog has been pre-configured to display all pertinent registers used in this program.

- The controller type has been pre-selected as SCADAPack.

- Refer to the "Ladder Logic Function Reference | Ladder Logic Function Reference | Ladder Logic Functions" section of the "TelePACE User and Reference Manual" for information on the unsigned math functions: ADDU, SUBU, DIVU and MULU.

Instructions


To use this sample program:

  • Download and Save the following file: BCDTOINT.ZIP
  • Extract the TelePACE application to an appropriate location.
  • Open the TelePACE application.
  • Select File | Open to display the Open File dialog box.
  • Browse to the appropriate directory where the files are located and select the .LAD file.
  • Select the OK button to open the file.