2007-01-24 06:54 PM
2011-05-17 12:35 AM
I think you can turn around the direction by just writing 2 registers
GPIO_DIR SCU_GPIOOUTn -Mark2011-05-17 12:35 AM
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.com2011-05-17 12:35 AM
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 ]