Send 10 bits of data via paralel interface
hi,
i trying send 10 bit of data external microcontroller using parallel interface.
this means using 1 digital pin every bit of data.
i know on atmel portc = xxxxxxxx 8 bit value, have 2 questions now:
first have set 2 output ports, port b , port c , place parts of result on each port.
second, suppose on port b using 2 pins else.
how assign each of individual bits particular output pin?
for example:
i read 10 bits adc. how select port send each of them?
thanks
i trying send 10 bit of data external microcontroller using parallel interface.
this means using 1 digital pin every bit of data.
i know on atmel portc = xxxxxxxx 8 bit value, have 2 questions now:
first have set 2 output ports, port b , port c , place parts of result on each port.
second, suppose on port b using 2 pins else.
how assign each of individual bits particular output pin?
for example:
i read 10 bits adc. how select port send each of them?
thanks
if save value adc in int variable can use combination of shifting , masking identify each bit
for example
...r
for example
code: [select]
adcvalue = analogread(a0);
int tempval = adcvalue;
for (byte n = 0; n < 10; n++) {
int bitval = tempval & 0b0000000000000001; // rightmost bit hidden
// bitval
tempval = tempval >> 1; // move 1 bit right
}
...r
Arduino Forum > Using Arduino > Programming Questions > Send 10 bits of data via paralel interface
arduino
Comments
Post a Comment