void main(void){
init();// setup
Delay10KTCYx(300);// wait 333ms startup GPIO
while(1){
SendByte(0x40,GPIO,0xF0);
Delay10TCYx(1);
SendByte(0x40,IOCON,0b00110010); // active high
Delay10TCYx(1);
SendByte(0x40,IODIR,0xF0); //WriteAddress iodir , high nibble input
Delay10TCYx(1);
SendByte(0x40,INTCON,0xF0); // compare to def val
Delay10TCYx(1);
SendByte(0x40,DEFVAL,0xF0);// def val to compare
Delay10TCYx(1);
SendByte(0x40,IPOL,0x00); // same pol
Delay10TCYx(1);
SendByte(0x40,GPPU ,0xFF);
Delay10TCYx(1);
SendByte(0x40,GPINTEN,0xF0); // enable input pin for inter on change
}
while(1);