cancel
Showing results for 
Search instead for 
Did you mean: 

Read all pins in 1 port simultaneously

admin2
Associate II
Posted on April 11, 2014 at 15:27

I wonder how to read all port simultaneously such as GPIOA0 up to GPIOA7

or the equivalent of arduino codes

DDRA = B00000000;   // sets Arduino Mega Digital pins 22(PORTA0) to 29(PORTA7) as inputs

allBus = PINA; //read all PIN bit state

#ports #pins
4 REPLIES 4
Posted on April 11, 2014 at 15:32

GPIOA->MODER = 0;

allbus = GPIOA->IDR;

JW

admin2
Associate II
Posted on April 11, 2014 at 15:36

Thanks I will try the codes right away

Andrew Neil
Evangelist III
Posted on April 11, 2014 at 21:30

I think you are confusing pins  with ports?

As described, you can read all the pins  of a port simultaneously; but you can't read multiple ports  simultaneously.

admin2
Associate II
Posted on April 12, 2014 at 04:27

Yes, you are correct I mean all pins in one port, problem solved.