Positron Compiler Documentation

Dcd

Source: Positron8 Compiler User Manual, PDF page 101

Syntax

Assignment Variable = Dcd(pVariable)

Overview

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.

Parameter

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

Example

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.