void read_inputs()
{
output_high(EXP_IN_CLOCK);
output_low(EXP_IN_ENABLE);
output_high(EXP_IN_ENABLE);
for(i=1;i<=16;++i) {
if(input(EXP_IN_DI)==0) {
if(zone_sttng[i]==0x11) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=1; } } // Arm Zone
if(zone_sttng[i]==0x13) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=2; } } // 24h Zone
if(zone_sttng[i]==0x14) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=3; } } // Monitor Zone
if(zone_sttng[i]==0x21) { zone_stbl[i]=0; zone_status[i]=5; } // Arm Zone
if(zone_sttng[i]==0x23) { zone_stbl[i]=0; zone_status[i]=0; } // 24h Zone
if(zone_sttng[i]==0x24) { zone_stbl[i]=0; zone_status[i]=4; } // Monitor Zone
}
if(input(EXP_IN_DI)==1) {
if(zone_sttng[i]==0x11) { zone_stbl[i]=0; zone_status[i]=5; } // Arm Zone
if(zone_sttng[i]==0x13) { zone_stbl[i]=0; zone_status[i]=0; } // 24h Zone
if(zone_sttng[i]==0x14) { zone_stbl[i]=0; zone_status[i]=4; } // Monitor Zone
if(zone_sttng[i]==0x21) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=1; } } // Arm Zone
if(zone_sttng[i]==0x23) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=2; } } // 24h Zone
if(zone_sttng[i]==0x24) { zone_stbl[i]++; if(zone_stbl[i]==250) { zone_stbl[i]=0; zone_status[i]=3; } } // Monitor Zone
}
output_low(EXP_IN_CLOCK);
//delay_us(10);
output_high(EXP_IN_CLOCK);
}
output_low(EXP_IN_ENABLE);
}