carlosma
Joined: 24 Mar 2004 Posts: 53 Location: Portugal
|
Inerrupt for begin if any key press |
Posted: Wed Apr 07, 2004 5:42 am |
|
|
Hello
I do a program to read IO and save in the Eeprom the value and this program need a 4 digit code to acces. I can change the code press *
Use LCD. C and Keyboard 4x4.
I need help to configure Inteerupt IF no key press in 5 seconds return to Begin, like a normal access code.
Thank you
Carlos
Code: |
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#USE RS232 (baud = 9600, xmit = PIN_C6, rcv = PIN_C7 )
#include <lcd.c>
#include <kbd.c>
#rom 0x2100={1,2,3,4}
////.....////
void grava()
{
int ncod =0;
printf("programacao %c\r\n",k);
lcd_putc("\fNovo Codigo\n");
for (ncod = 0; (ncod < nmax);)
{
k=kbd_getc();
if(k!=0)
{
lcd_putc("*");
ncod++;
write_eeprom ((ncod - 1),(k - 0x30));
}
}
printf("Codigo gravado %c\r\n",k);
lcd_putc("\fCodigo gravado\n");
}
/// .... ///
void main()
{
// .. //
while (TRUE)
{
k=kbd_getc();
if(k!=0)
if(k=='*')
grava();
//lcd_putc('\f');
else
{
lcd_putc("*");
EE=read_eeprom(Ponta);
rel = EE + 0x30;
printf( "%2x ", k );
printf( "%2x ", rel );
n++;
Ponta++;
if ( (rel==k) && (correcto==(Ponta -1) ))
{
correcto++;
if ( n == nmax )
{
output_high(pin_b0);
printf("ligado %c\r\n",k);
lcd_putc("\fCodigo Correcto\n");
/// .... //
|
|
|