Questions and Answers -
Bit Manipulation

All TCS decoders support Bit Manipulation programming!


Q. How do I set a particular bit in any CV?
A.
There are 8 bits in every CV. Each bit has a decimal value (see table below). To set a bit, write the value of the bit into the CV.

Example: Set bit 0, CV=1; Set bit 1, CV=2; Set bit 2, CV=4; Set bit 3, CV=8; Set bit 4, CV=16; Set bit 5, CV=32; Set bit 6, CV=64; Set bit 7, CV=128.
To set more than one bit in a given CV, the total value of all the bits must be entered into that CV.

Example: Setting bits 0, 2 and 3 ==> Add the CV values to get the total value : 1+4+8=13, write 13 to the CV. To reverse the locomotive direction of a consisted locomotive, CV19 bit 7 must be set. Add 128 to the selected consisted address.

Example: If the consisted address is 32 ==> 32 + 128 = 160. Setting CV19=160 will set the locomotive consist address to 32 with locomotive direction reversed.

Bit Value Table

  Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Bit Weight 128 64 32 16 8 4 2 1
 
Refer to the Plain English Programming Guide for more information.
 
 

Installations ] Home ] Decoder ] What's New ] Literature ] TCS Dealers ] Warranty ] TCS Harnesses ] Dealer Application ] Contact Us ] FAQ ] Order Page ]

 

Entire contents © Copyright Train Control Systems 2003-2007 • Last Modified: Wednesday September 26, 2007 06:34 AM