I need to output 8-bit integers via parallel (i.e. using 8 pins on the same port) at 1024hz. From what I can see, I have two options:
1) Write to each pin individually using DigitalOut.
2) Avoid the mbed library altogether, and do something like:
void sendByte(char byte)
{
DataPort|= (((byte >>0x00) & 0x01) << LCD_D0);
DataPort|= (((byte >>0x01) & 0x01) << LCD_D1);
DataPort|= (((byte >>0x02) & 0x01) << LCD_D2);
DataPort|= (((byte >>0x03) & 0x01) << LCD_D3);
DataPort|= (((byte >>0x04) & 0x01) << LCD_D4);
DataPort|= (((byte >>0x05) & 0x01) << LCD_D5);
DataPort|= (((byte >>0x06) & 0x01) << LCD_D6);
DataPort|= (((byte >>0x07) & 0x01) << LCD_D7);
}
I've heard that DigitalOut is rather slow, although I'm not sure of what frequency it can handle. Is the second option likely to be faster? Can anyone compare the two methods?
SIDE QUESTION: I'll be using the output with a DAC to produce an analog signal. Will I need to use a buffer in between, or are the pins guaranteed to output simultaneously?
DataPort |= (byte & 0xFF) << LCD_D0;
\$\endgroup\$