I've checked out a ton of resources but I can't seem to get a simple answer on this. Maybe this could go in HT but its pretty basic so I was hoping someone familar with PICs could tell me.
I need to flash some LEDs hooked to a PICs pins. I set the desired pins to output with set_tris_c(..).
Of course to flash them I want something like:
if ( logic(pin) )
{
// LED is ON, turn it OFF
....
}
else
{
// LED is OFF, turn it ON ...
}
Of course logic isn't a standard function but there's probably something like it.
From what I've read it seems to say I need to switch the pins to input to read the logic level. But I just want to "peek" at what the current logic level is. I was reading a bunch of stuff about what you might read differs from the actual logic level.
Right now I have a byte variable that keeps track of whether the pins in question are high or low. But it'd sure simplify things if I could just peek at the logic level then act accordingly.
I need to flash some LEDs hooked to a PICs pins. I set the desired pins to output with set_tris_c(..).
Of course to flash them I want something like:
if ( logic(pin) )
{
// LED is ON, turn it OFF
....
}
else
{
// LED is OFF, turn it ON ...
}
Of course logic isn't a standard function but there's probably something like it.
From what I've read it seems to say I need to switch the pins to input to read the logic level. But I just want to "peek" at what the current logic level is. I was reading a bunch of stuff about what you might read differs from the actual logic level.
Right now I have a byte variable that keeps track of whether the pins in question are high or low. But it'd sure simplify things if I could just peek at the logic level then act accordingly.