Positron Compiler Documentation

Dcd

Positron8 · Revision 4.0.6.5 · PDF page 101

Assignment Variable = Dcd(pVariable)

2 n-power decoder of a value. Dcd accepts a value from 0 to 15, and returns a 16-bit value with that bit number set to 1.

pVariable can be a constant, variable or expression that requires the Dcd extracted. Assignment Variable can be any valid variable type.

Device = 18F26K40             ' Select the device to compile for
Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600   ' Set the Baud rate for HRsoutLn

Dim Wordin as Word             ' Holds the value to Dcd with
Dim Wordout as Word          ' Holds the result of the Dcd

Wordin = 12
Wordout = Dcd Wordin          ' Set bit-12 of Wordout
HRsoutLn Bin16 Wordout        ' Display the binary result: 0001000000000000

Dcd does not support Long, Dword, or Float type variables at this moment in time. Therefore the highest value obtainable is 65535.

View original PDF page 101Open page in PDFOriginal PDF page 101