Dcd
Positron16 · Revision 1.1.3.5 · PDF page 104
Syntax
Assignment Variable = Dcd(pVariable)
Overview
2 n -power decoder of a four-bit value. Dcd accepts a value from 0 to 15, and returns a 16-bit number with that bit number set to 1.
Parameter
pVariable can be a constant, variable or expression Assignment Variable can be any valid variable type.
Example
Device = 24FJ64GA002 ' Select the device to compile for
Declare Xtal = 16 ' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600 ' USART1 Baud rate
Declare Hrsout1_Pin = PORTB.14 ' Select the pin for TX with USART1
Dim MyWord as Word
PPS_Output(cOut_Pin_RP14, cOut_Fn_U1TX) ' Make Pin RB14 U1TX
MyWord= Dcd 12 ' Set bit 12.
HrsoutLn Bin16 MyWord ' Display result (%0001000000000000)
Dcd does not (as yet) support Double, Float or Dword type variables. Therefore the highest value obtainable is 65535.
