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

password check routine , here

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







password check routine , here
PostPosted: Fri Jan 27, 2006 7:46 am     Reply with quote

I made this routine , and im using 4x4 keypad scand with the kbd.c library. It works very well , but the problem .

I need to get out of the loop after 15 secs .

I tried with Wt , but it dosnt wait long enough ,also i tried the Ds1302 , that is used in the circuit (real time clock) , but , it looks like the instruction kbd_getc(); , dosnt like to be executed in a loop with more instructions.....

please give me some hints....
C




//////////////////////////////////////////////////////////////////////
Void passwordcheck(){
Int segundo,timeout,checknum;
char word1,word2,word3,word4,


do {
lcd_putc("\fEnter your pass");
do {
word1=kbd_getc();
} while ((word1<'0') || (word1>'9'));

lcd_putc("\n *");
word1-='0';

do {
word2=kbd_getc();
} while ((word2<'0') || (word2>'9'));

lcd_putc("\n **");
word2-='0';

do {
word3=kbd_getc();
} while ((word3<'0') || (word3>'9'));
lcd_putc("\n ***");
word3-='0';

do {
word4=kbd_getc();
} while ((word4<'0') || (word4>'9'));
lcd_putc("\n ****");
word4-='0';


}

While((word1!=1) || (word2!=1) || (word3!=1) || (word4!=1));

}
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat Jan 28, 2006 4:03 pm     Reply with quote

The function getc() will always wait for a character to arrive on the serial port before execution continues. For a possible solution have a look at the CCS manual, chapter 'How do I get getc() to timeout after a specified time?' (in the November 2005 version this is at page 260).
guest
Guest







PostPosted: Sun Jan 29, 2006 12:43 am     Reply with quote

mmm..but im not using the serial port , anyways... im using a keypad....
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jan 29, 2006 9:40 am     Reply with quote

guest wrote:
mmm..but im not using the serial port , anyways... im using a keypad....
My mistake, I was confused by the getc in the kbd_getc function name. However, the solution given for the getc function can be applied to your situation as well.
micro2
Guest







PostPosted: Sun Jan 29, 2006 1:40 pm     Reply with quote

Use interrupt...

#int_TIMER1
TIMER1_isr()
{
if(cTimeOut1 != 0)
cTimeout1 --; //decrementa sino a 0 poi timeout
}

void main
....................
....................
//set Timer1
cTimeout = ?? (the correct value)
...................
...................
if(cTimeout==0)
return //exit function
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