55xGenComm1_29
30
EXAMPLE : Sending a password to the control module.
This example shows how the password registers within the control module are used. It also
demonstrates the use of the one’s complement function. This technique is also used to write
control functions to the module in GenComm page 16.
Page0[32] = 1234;
Page0[33] = ~Page0[32];
Write Page0
The requirement of the one’s complement register is to ensure the validity of the data being
received, and to ensure the previous register (in this case register 32) has not been accidentally
written to. The control module will take the one’s complement of the value in register 33 and
compare it to the value in register 32. Only if the two values match is the password acted on. If the
password correctly matches the “Write” password stored within the module, then the Password
status register will indicate this.
An example of how to test the Password Status register is given in the section headed “GenComm
Page 0”.
NOTE:- Register 33 must be the ones complement (often called bitwise inversion)
of Register 32 to correctly ‘log on’ to the Control Module.
I.e. 1234 in binary is 010011010010
It’s one’s complement is 101100101101 ( 1’s become 0’s )
In the example above (written in the C language), the ‘~’ operator means one’s
complement.
I.e. ~Page0[32] means “the one’s complement of Page0, register 32”.
Many other programming languages have similar functions to ease the implementation
of one’s complement, however it is easy to achieve mathematically. To get the ones
compliment of a 16 bit number, subtract the number from 0xFFFF i.e. 0xFFFF –
Page0[32] = ~Page0[32]