koray_duran
Newbie level 1
Hi, I am very new in this forum. I hope you'll help me to solve my problem.
I've designed an alarm circuit which controls inputs via two 74HC165. You can see the design in pictures. And i am using CSS C compiler for my project.
My problem is : I get wrong alarms every 40~60 munites. It is acting like there is an input coming via 74HC165 ic's. I have figured out that the alarms occuring if one or more of inputs is always high. (NC mode)
Here is my code :
I've designed an alarm circuit which controls inputs via two 74HC165. You can see the design in pictures. And i am using CSS C compiler for my project.
My problem is : I get wrong alarms every 40~60 munites. It is acting like there is an input coming via 74HC165 ic's. I have figured out that the alarms occuring if one or more of inputs is always high. (NC mode)
Here is my code :
Code:
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);
}