Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/31/00 13:43
Read: times


 
#4062 - RE: Rotary knob and INT in C
A lot of test later... the solution :

I changed the rotary knob ; I use the Bourns ECW1J (mechanical switch too) now at every mecanical click (24 for 360°) all output (A,B) goes high. It's important for the future Idle mode. (Remember : the ELMA knob goes one time both outputs high and at the next click all outputs are low !).

But... I have ever the bounce problem (sometime increment by 2 or at very low speed nothing). To resolve I add a 100nF at Input (P3.2 and P3.4) to GND. Result : at slow move the result is OK. But not at higher speed. If you go fast for one complete rotation the increment is only from 4 or 5 ! Solution : I put a 15k resistor to +5V and EVERYTHING is OK !

Thank you Peter, Steve, Jay and Lance. All your answers and idea are very interresting. Any solutions isn't OK for a rotary knob with mechanical click. You can't wait for 3 click to have 1 increment ! This mechanical click is the biggest problem (or the biggest challenge) of this subject ! ! ! It's not really DEJA VU.

Sylvain


#pragma CODE
#include <reg51.h>
#include <display.h>

sbit POT_A =P3^4;
sbit POT_B =P3^2;

unsigned int Number;
signed char Sens;
bit Old_POT_A;

void main(void)
{
initdisp();
printf("HELLO");
IT0=1; /* falling edge */
EA=1; /* enable all int */
EX0=1; /* enable int0 */
Number=0;
while(1)
{
gotoxy(1,2);
printf("%05u",Number);
EX0=1; /* enable int0 */

}
}
void digital_pot(void) interrupt 0
{
EX0=0; /* disable int0 */
Old_POT_A=POT_A;
if (Old_POT_A==POT_A)
{
if ((POT_A==0)&(POT_B==0)) Number=Number+1;
else
Number=Number-1;
}
}




List of 13 messages in thread
TopicAuthorDate
Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      
RE: Rotary knob and INT in C            01/01/70 00:00      

Back to Subject List