I have 6 ports that i am using like buttons and i have an interrupt by falling edge. I have to use low level but don´t work because all the six pins (PTC1 to PTC6 tha i am using) stay in 0V. I have pull-up in all. On falling edge this problem don´t appear. I am trying to use the function GetFieldValue but doesn´t work correctly. How can i read the pin PTC1 or PTC2 or PTC3 for example. I need to read one pin but the function doesn´t work correctly. Anybody can help me?
Thank you
Hi,
To use the GetFieldValue the proper configurations are necessary in the GPIO_LDD component; you need to set a different Field value for each pin to read the each pin. If you need to read the states of all the pins you configured you need to call the GetPortValue method and pass the pointer you get from the init method.
In the attachments you can find an example compiled in CodeWarrior 10.x for the TWR-K20D50 board. In this application when the SW2 (PTC1) is pressed the yellow led is turned on (PTC9) and when SW3 (PTC2) is pressed the orange led is turned on (PTC10) this part of the application is handled with the value returned by the GetFieldValue method. In the console is printed the value of this two pins (PTC1 and PTC2 this pins are the only configured in the GPIO_LDD component); this is the complete value of the pins in the component and are configured in different fields in the component inspector.
Here are the configurations I did for the GPIO_LDD component
I hope this information can help you.
Regards,
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------
.
In your exempla code, you have used: "SW2_value = SW_GetFieldValue(SW_DeviceData, SW2);" How can I see and configure the 'SW_DeviceData' field??
Thank you for the help. Now I got it. Excellent
Hello Alex, This question is in the generic space for questions about how to use the community. If you can provide some more detail on the product you are using, I will move it to the space where it will get more visibility from our technical community members.