Remote Processing CAMBASIC User Manual

Page 45

Advertising
background image

Comm ands - 12

BIT

Process Statement

SYNTAX:

BIT I/O address,bit,value
BIT I/O address, bit, ON
BIT I/O address, bit, O F F
BIT I/O address, bit, NOT

PURPOSE:

To set or tur n on an individual bit at the specified I/O ad dress without affecting the other bits.

REMARK S:

This statement will operate only with I/O addresses, not memory addr esses. This progr am works by
r e a di ng th e la s t b y te w r it te n to th is p or t , p er f or m i ng th e bi t o p er a ti on a nd w r it in g it ba c k t o t he s am e
I/O address. P orts like those on the 82C55 can be read back. The BIT statement cannot be used
with ports that lack read back capability.

Four syntaxes are allowed. The first syntax is the most flexible, as the value parameter can be a
variable. T he next three are more descriptive, wher e ON sets the bit high, OF F sets the bit low, and
NOT writes the complement of the bit. These execute faster than the first variation and are
self– documenting.

RELATED:

B IT f un c ti on , I N P , O N BI T , O U T

EXAMPLE:

10 BIT &10,2,1

Set bit 2 of addr ess &10 to a high state

10 BIT &10,5,A

Set bit 5 of address &10 to the value of A

10 BIT &10,1,OFF

Set bit 1 of address &10 to a low state.

10 BIT &10,0,NOT

This reverses the value of bit 0 at address &10

ERROR:

< Data negative > – if I/O address, bit or value
< Data out of range > – if value is not 0, 1, O N, NOT or OFF , or if bit > 8
< Data > 65,535> – for I/O addre ss

Advertising