Hi electronicfan,
It depends on how the keys are connected.
Let's assume if PTAD_PTADx input value is 1 then a key is pressed.(pull-down)
In case you need to wait until at least 1 key is released (loop only if both keys are pressed)
PTAD7 PTAD6 Exit Loop
0 0 Y
0 1 Y
1 0 Y
1 1 Nthen you can use:
while ((PTAD & 0xC0) == 0xC0);
If I miss the logic perhaps you could specify the truth table.
Stanish