216 of 318
ZBasic System Library 206 ZX Microcontroller Family PutBit Type Subroutine Invocation PutBit(var, bitNumber, val) Parameter Method Type Description var ByRef any type The variable to which the bit will be written. bitNumber ByVal int8/16 The bit number to write. val ByVal Byte The bit value. Discussion This routine writes a single bit to memory beginning at the location of the specified variable. Bit numbers 0-7 are written to the byte at the specified location, bit numbers 8-15 are written to the subsequent byte, etc. In each case, the lower bit number corresponds to the least significant bit of the byte while the highest bit number corresponds to the most significant bit of a byte. Only the least significant bit of the val parameter is used; the remaining bits are ignored. Caution If you specify a bit number beyond the number of bits in the specified variable, a byte in memory following the variable will be modified, perhaps with undesirable results. Compatibility In BasicX compatibility mode, the bitNumber parameter may only be specified using a Byte value. See Also GetBit