[En-Nut-Discussion] Reading input states on Ethernut3
Chris
dc229 at clweb.ch
Wed Mar 15 01:11:46 CET 2006
Hello Frank,
I ran into the same question last week. Fortunately the ATMEL spec for AT91xx contains
some helpful information regarding PIO.
Levels on the PIO pins can be read in the register PIO_PDSR (Pin Data Status).
The following line should do the job for Pin 49 (P2):
int state49 = (inr(PIO_PDSR) & _BV2(2)) ? 1 : 0; // 0: low, 1: high
Regards,
Chris
At 2006-03-14 22:34, you wrote:
>Hello,
>
>could anybody give me a few lines of code, how to read the state of a pio
>input (for example Pin49 of Ethernut3) to a var.
>I'm looking, reading, translating, trying and despairing since two days :((
>
>Thanks alot!
>
>Frank
More information about the En-Nut-Discussion
mailing list