Advertisement
Guest User

Untitled

a guest
Mar 11th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. bitcount = 0x00;
  2. data = 0x00;
  3. ISR(INT0_vect)
  4. {
  5.         /*
  6.         if(bit_is_set(PIND, KBD_DATA_PIN))
  7.                 send_character('1');
  8.         else
  9.                 send_character('0');
  10.         */
  11.         if(bitcount > 0 && bitcount < 9)
  12.         {
  13.                 if(bit_is_set(PIND, KBD_DATA_PIN)) // Button pressed
  14.                 {
  15.                         data |= (0x01 << (bitcount - 1));
  16.                 }
  17.         }
  18.  
  19.         if(++bitcount == 11)
  20.         {
  21.                 char string[10];
  22.                 sprintf(string, "%02X", data);
  23.                 send_string(string);
  24.                 data = 0x00;
  25.                 bitcount = 0x00;
  26.         }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement