I can out 1-bit data to PAD0 as follow:
GPIO_CONFIG(ADL,0,OUTPUT); // Configure PAD0 as OUTPUT
GPIO_WRITE_VALUE(ADL,0,1); // PAD0: HI
How to output 8-bit data to PAD0~7?
How to output 16-bit data to PAD0~15?
You can set it as follows:
unsigned char data8 = 0xff;
unsigned int data16 = 0xbbbb;
// Set port as output
DDRADH = FF; // output
DDRADL = FF; // output
// Write to AD Port Data Register
// 8-bit write
PTADL = data8;
// 16-bit write
PTADL = (data16 & 0xFF);
PTADH = (data16 >> 8);
You can also set the port as output after setting Port Data Registers PTADL/H, this registers hold the data while the port is set as input (DDRADH/L == 0x0000).
Retrieving data ...