??? 05/17/07 11:53 Read: times |
#139430 - this is far from... Responding to: ???'s previous message |
...being perfect, obfuscated-C-wise.
Why not void keypad_read(void) { key_lcd = key_table[key = ((unsigned char keypad_scan = keypad_address) & keypad_mask)]; }? :-) OK, now on less-C-hater line, I don't think it is the best idea to call a function from an ISR especially if the ISR doesn't do anything else, but's that's more on style than function as well. But, this is NOT the key issue anyway. My idea was (in pseudolanguage): global variables: key, key_ready; Timer0Isr: key = scankey; key_ready = TRUE; end; getchar: loop while key_ready is FALSE; key_ready = FALSE; return key end; ... and now you can use scanf as intended. 0.02SKK (practically zero) JW |