![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
CCS NewBee Guest
|
Multiple buttons and eeprom |
Posted: Tue Jan 11, 2005 11:34 am |
|
|
AAAAAAAAAAAAAAAAAAAAA A AAA A
Now i feel OK :--))
Im am bit confused and i can't find the catch...
Scenario:
4 buttons
One_B // main button
Two_B // tree functions on one button choosed thru switch - case
Tree_B
Four_B
------------------------------------------------
#include <16F877.h>
#fuses NOWDT,NOPROTECT,XT
#use delay(clock=4000000)
#define One_B PIN_A0 // --- |Test
#define Two_B PIN_A1 // --- |
#define use_portb_lcd TRUE
#include "lcd.c"
/*-----------------------
int clicks_counter()
{}
int count_visitors()
{}
--------------------------*/
#int_timer1
clock_isr()
{
}
main() {
lcd_init();
setup_timer_1( T1_DIV_BY_1 | T1_INTERNAL);
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);
/*-------------------------------------------------------
How to add main button so he can fit to scenario, or better,
how to make first stuff and how te define the Two_B so he can
recognize the real eeprom value(first button pressed and blocked (start countdown)). I meen, after you have clicked main button, then you can make clicks on the TWO_B button. But, if i save the main click to eeprom then i have to save the NO-Press time, the countdown value, the number of clicks, and number of visitors. Wooo, where to start ?
------------------------------------------------------*/
//If first button was pressed activate second and read if there's a NO_press block in eeprom..
while(TRUE)
{
if (input (Two_B) && eeprom_value==1) // --- e.g.
{
if(input(Two_B))
{
value++;
switch (value)
{
case 1:
//-- show timer time left until second click should be taken
//-- 2 Hours
output_high(Two_B);
break;
case 2:
// -- show number of main clicks
output_high(Two_B);
break;
case 3:
// -- show number of visitors
output_high(Two_B);
break;
default:
value=0;
while(input(Two_B));
}
} |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 11, 2005 12:17 pm |
|
|
Can you provide a short description of what you want to do ?
Tell us what you want the user to do (push button A, then B, etc.)
and what response from the PIC should be. |
|
![](templates/subSilver/images/spacer.gif) |
CCS NewBee Guest
|
|
Posted: Wed Jan 12, 2005 9:54 am |
|
|
OK.
Basicly, you can look at this like at some box with multiple switches, buttons and lcd and inside of this box you have ID cards...
One of the functions should be to give ID card to user and to confirm that this card is taken (main button press ) ..
After that ( after main click ) your main button is blocked for 2 hours but in this 2 hours you can check for your status by pressing button TWO. After the time has pass by ( 2 Hours ) you need to click again to main button. Main number click will be increased by 1 and countdown should start from begining.
So, main click should trigger all other actions.
If you need more infos please let me know .... |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
CCS NewBee Guest
|
|
Posted: Thu Jan 13, 2005 8:51 am |
|
|
But it's probably going to be too complex for you to do at
this time.
** I think so too, but i have no other chance becuse i must make this work, so, please be so kind and explain me how would you do this ( i have read your topic and i understand basic but i dont get tho whole concept)...
Let's go one step at the time. Beside, this topic can be very usefull to others, so if it's OK for you we can start with "education part " :--)
Thanx in advance ! |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|