CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Detecting a change of state 16F877A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eiby



Joined: 07 Oct 2008
Posts: 3

View user's profile Send private message

Detecting a change of state 16F877A
PostPosted: Sun Nov 09, 2008 8:44 pm     Reply with quote

Hi. I have a problem with detection. I need to know how make the code for detecting that a bit is changing less than every 2 seconds, but without using interrupts, because this part of the code have to activate a while statement that is reading the same bits and incrementing a variable.
If the bits change state in more than 2 seconds the while statement have to be finished to go on with the rest of the code.
Do I make myself clear ?

Hope you can help. This is a part of the code:
Code:

#include <16F877A.h>

#define fila1 input_state(pin_a1)
#define fila2 input_state(pin_a2)
#define fila3 input_state(pin_a3)

cont_fast:

while(??????????){
  lcd_gotoxy(1,2);
  printf(lcd_putc,"%Lu",cuenta);

  if(fila1==1){
     ++cuenta;
     output_low(fila2);
     output_low(fila3);
     delay_ms(10); //tiempo de caida para filas 2 y 3
   }

  if(fila2==1){
     ++cuenta;
     output_low(fila3);
     delay_ms(5);
    }

  if(fila3==1){
    ++cuenta;
   }

_________________
Best regards,,

Abraham Guerrero
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group