Skip to main content
stock2
Associate
April 11, 2014
Question

Read all pins in 1 port simultaneously

  • April 11, 2014
  • 4 replies
  • 1088 views
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 topic has been closed for replies.

    4 replies

    waclawek.jan
    Super User
    April 11, 2014
    Posted on April 11, 2014 at 15:32

    GPIOA->MODER = 0;

    allbus = GPIOA->IDR;

    JW

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

    Thanks I will try the codes right away

    Andrew Neil
    Super User
    April 11, 2014
    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
    stock2Author
    Associate
    April 12, 2014
    Posted on April 12, 2014 at 04:27

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