Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

pause? - wdavis364 - Jan 5 10:35:14 2007

F88, 20mhz, series of 4 push switches to add or subtract predetermine
values to "count". I'm thinking that I'm not going to be able to get
off the switch quick enough to keep it from adding the value more than
once. I need to pause after each activation? If so, how long?
Short program.
thanks
bill


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


RE: pause? - ChrisEGroup - Jan 5 10:47:38 2007

Hi Bill,

Why not sit in a loop while the button is pressed? Then you don't care
how long the user holds the button down.

-Chris

-----Original Message-----
From: wdavis364 [mailto:w...@texoma.net]
Sent: Friday, January 05, 2007 8:28 AM
To: p...@yahoogroups.com
Subject: [piclist] pause?

F88, 20mhz, series of 4 push switches to add or subtract predetermine
values to "count". I'm thinking that I'm not going to be able to get off
the switch quick enough to keep it from adding the value more than once.
I need to pause after each activation? If so, how long?
Short program.
thanks
bill

to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions Yahoo! Groups Links



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: pause? - Bill Davis - Jan 5 11:47:26 2007

Ok, sounds good,only not sure how to keep it from adding to "count" each pass through the loop.
----- Original Message -----
From: ChrisEGroup
To: p...@yahoogroups.com
Sent: Friday, January 05, 2007 9:39 AM
Subject: RE: [piclist] pause?
Hi Bill,

Why not sit in a loop while the button is pressed? Then you don't care
how long the user holds the button down.

-Chris

-----Original Message-----
From: wdavis364 [mailto:w...@texoma.net]
Sent: Friday, January 05, 2007 8:28 AM
To: p...@yahoogroups.com
Subject: [piclist] pause?

F88, 20mhz, series of 4 push switches to add or subtract predetermine
values to "count". I'm thinking that I'm not going to be able to get off
the switch quick enough to keep it from adding the value more than once.
I need to pause after each activation? If so, how long?
Short program.
thanks
bill

to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions Yahoo! Groups Links



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: pause? - Alan KM6VV - Jan 5 12:04:00 2007

Hi Bill,

What you want is an auto-repeat on the buttons. Delay for say 1 second,
then repeat if the key is still held down. That's after you've debounced
the keys. Something like:

------------------------------------------------------------------------
/*
* function to filter keyswitch closures
* call at 100 mS rate!
* (KeyRep + 1) * 100 mS = rep rate
* key data has been put in KBDdata from SPI reads
* LastKey is global char. Get it after seeing
* Event flag set, then clear flag, wait for next key
*/

void FilterKbd(void)
{
static char KeyRep = 0;
static char FirstRep = 10; /* 10 * 100 mS = 1 sec 1st rep rate */

if(KBDdata != LastKey || KeyRep == FirstRep)
{
if(KBDdata != LastKey)
FirstRep = 10; /* reset 1st rep rate when key changes */
else
FirstRep = 1; /* rep faster after 1st rep */

SET_EVENT(KEYBOARD_HIT);
KeyRep = 0;
LastKey = KBDdata;
}
else
KeyRep++;
}
------------------------------------------------------------------------

SPI reads in my keypad (6 keys) data into KBDdata (100uS rate) from
interrupt. System main loop at 100mS calls this filter. SPI runs 16 bits
out, and 16 bits in. Other I/Os (trigger inputs and output commands) are
the important stuff, keys, jumpers and some LEDs are just along for the
ride!

Hope this helps.

Alan KM6VV

>
> F88, 20mhz, series of 4 push switches to add or subtract predetermine
> values to "count". I'm thinking that I'm not going to be able to get
> off the switch quick enough to keep it from adding the value more than
> once. I need to pause after each activation? If so, how long?
> Short program.
> thanks
> bill


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: pause? - Bill Davis - Jan 5 13:03:59 2007

Thanks Alan, I'll try it and see how it goes.
bill
----- Original Message -----
From: Alan KM6VV
To: p...@yahoogroups.com
Sent: Friday, January 05, 2007 11:00 AM
Subject: RE: [piclist] pause?
Hi Bill,

What you want is an auto-repeat on the buttons. Delay for say 1 second,
then repeat if the key is still held down. That's after you've debounced
the keys. Something like:

----------------------------------------------------------
/*
* function to filter keyswitch closures
* call at 100 mS rate!
* (KeyRep + 1) * 100 mS = rep rate
* key data has been put in KBDdata from SPI reads
* LastKey is global char. Get it after seeing
* Event flag set, then clear flag, wait for next key
*/

void FilterKbd(void)
{
static char KeyRep = 0;
static char FirstRep = 10; /* 10 * 100 mS = 1 sec 1st rep rate */

if(KBDdata != LastKey || KeyRep == FirstRep)
{
if(KBDdata != LastKey)
FirstRep = 10; /* reset 1st rep rate when key changes */
else
FirstRep = 1; /* rep faster after 1st rep */

SET_EVENT(KEYBOARD_HIT);
KeyRep = 0;
LastKey = KBDdata;
}
else
KeyRep++;
}
----------------------------------------------------------

SPI reads in my keypad (6 keys) data into KBDdata (100uS rate) from
interrupt. System main loop at 100mS calls this filter. SPI runs 16 bits
out, and 16 bits in. Other I/Os (trigger inputs and output commands) are
the important stuff, keys, jumpers and some LEDs are just along for the
ride!

Hope this helps.

Alan KM6VV

>
> F88, 20mhz, series of 4 push switches to add or subtract predetermine
> values to "count". I'm thinking that I'm not going to be able to get
> off the switch quick enough to keep it from adding the value more than
> once. I need to pause after each activation? If so, how long?
> Short program.
> thanks
> bill
>
>



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )