Skip to main content
Visitor II
January 25, 2007
Question

GPIO Data Direct Control

  • January 25, 2007
  • 3 replies
  • 666 views
Posted on January 25, 2007 at 03:54

GPIO Data Direct Control

    This topic has been closed for replies.

    3 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    I think you can turn around the direction by just writing 2 registers

    GPIO_DIR

    SCU_GPIOOUTn

    -Mark

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    Hi All

    I have had a problem when using GPIO as bidirectional line and am wondering whether this is normal or not.

    1. I program the pin to be an output (0x1)

    2. I set a value at the port and drive the line by setting DDR bit high.

    So far so good.

    3. Now I clear DDR bit but can't read the status of the port bit - I seem to read always the value of the bit which was set when an output.

    To solve the problem I have resorted to programming the pin as an input (0x0) when reading the input state, which ets the application working.

    However this requires more instructions to do than if it could be be done simply via the DDR as expected.

    I did experiment for a couple of hours with the debugger and couldn't identify a set up which actually allowed controlling the output state and then reading the input state simply by changing DDR.

    Have I missed something or is this a characteristic of the device?

    Regards

    Mark Butcher

    www.uTasker.com

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    Hi Mark,

    please find attached a code (using DDR) and it works well: if I configured GPIO as input mode I read the state of the pin and not the value written when it is output.

    I hope that I help you.

    best regards,

    mirou

    [ This message was edited by: mirou on 25-01-2007 08:26 ]