Want to output 8 bits of parallel digital info on 8 pins of a 3B+ simultaneously. Input also. Java.
1 Answers
Unlikely.
The Pi's GPIO peripheral supports clearing a set of GPIO in one instruction and setting a set of GPIO in one instruction.
You specify the GPIO to clear/set with a 32-bit mask. E.g. to select GPIO 0-7 you would set a bit mask of 0x000000FF. The unselected GPIO are unaffected by the clear/set operation.
For simplicity the following examples assume you are treating GPIO 0-7 as your byte.
set byte to 0 - set bit mask to 0x000000FF and perform clear instruction.
set byte to 0xFF - set bit mask to 0x000000FF and perform set instruction.
Set byte to 0xAA - set bit mask to 0x00000055 and perform clear instruction, then set bit mask to 0x000000AA and perform set instruction.
So generally you would need at least two instructions to set the byte's value.
The only library I am aware of which offers support for these instructions is my pigpio.
- 71,024
- 5
- 73
- 106