Having trouble with the reading of port P1

i have an ADUC832 and i attached a keypad.i want to read the keypad with the interrupt method.

How can i read P1(into this port i attached the keypad) from Keil?
Thanks in advanced.

Parents
  • Assuming that you're working in C, you'll need to #include the appropriate register header file for your target device (reg51.h is nice and generic). Then, you can read from and write to P1 using the name of the port as a global variable in C, like so:

    #include <reg51.h>
    
    void main(void) {
    
    P1=0x55; // set to alternating bit pattern 01010101
    }
    

Reply
  • Assuming that you're working in C, you'll need to #include the appropriate register header file for your target device (reg51.h is nice and generic). Then, you can read from and write to P1 using the name of the port as a global variable in C, like so:

    #include <reg51.h>
    
    void main(void) {
    
    P1=0x55; // set to alternating bit pattern 01010101
    }
    

Children
More questions in this forum