Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
What is the fastest way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?
With which type of code I can achieve this?
Edit: This question is not a duplicate please see my comment.
If the pin is declared as input, let's say pin 13:
pin_status = PIOB->PIO_PDSR & PIO_PDSR_P27;
If the pin is declared as output, let's say pin 13:
pin_status = PIOB->PIO_ODSR & PIO_ODSR_P27;
Read the In out data register would be the fastest.
Required, but never shown