cancel
Showing results for 
Search instead for 
Did you mean: 

Read all pins in 1 port simultaneously

stock2
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
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
waclawek.jan
Super User
Posted on April 11, 2014 at 15:32

GPIOA->MODER = 0;

allbus = GPIOA->IDR;

JW

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

Thanks I will try the codes right away

Andrew Neil
Super User
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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
stock2
Associate II
Posted on April 12, 2014 at 04:27

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