Hard problem with 74HC165!

Status
Not open for further replies.

koray_duran

Newbie level 1
Joined
Jan 18, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
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 :

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);
}
 

Hi

Don't leave unconnected node free on air - if you don't use them connect to GND

All the best


Bobi
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…