cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO Data Direct Control

m_j_butcher
Associate II
Posted on January 25, 2007 at 03:54

GPIO Data Direct Control

3 REPLIES 3
mark9
Associate II
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

m_j_butcher
Associate II
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

amira1
Associate II
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 ]