understanding problemes with in/output with apps in dave

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
I have a problem to understand how I can read out status of different portpins in a for loop
I want to read the the status of port pin p2.0 to p.2.

but how I can do that?

i found only the solution to do this only with each pin separate?

pin_status = DIGITAL_IO_GetInput(&DIGITAL_IO_0);
if(pin_status == 1)
{
// Add application code here
}
else
{
// Add application code here
}

hopefully you have a better solution for me?
if this routine against? the app idea?
XMC_GPIO_SetOutputHigh(handler->gpio_port, handler->gpio_pin);

How I can give the port itself an name with the app?

Sorry for all my questions. I programmed before all the time only in C on AVR controllers 🙂
1583.attach

thanks a lot
0 Likes
1 Reply
chismo
Employee
Employee
First like received
Hello,

To read the 3 pins together, I would simply read directly the port's IN register and masked the unnecessary bits accordingly.
For example:
pin_status = PORT2->IN & 0x7;

The intention of the function XMC_GPIO_SetOutputHigh() is to output a high level of a General Purpose Output pin.

Yes, you can rename the port pin instance label from the APP view as shown in the attached figure:
1594.attach

Regards,
Min Wei
0 Likes