I know a book on C that might be useful... 
Jack, W8TEE
On Tuesday, February 27, 2024 at 09:43:41 AM EST, barry halterman <kthreebo@...> wrote:
Gentlemen, I will not argue the fact that software might be the proper method, IF you know the syntax of the language and have a good understanding of programming structure and can make it work. ?I for one, have neither and getting a LED to blink is a major task. My hat is off to you folks who can program. Yes, I am envious. 73 Barry K3BO ? Sent from for Windows ?
toggle quoted message
Show quoted text
From: Jack, W8TEE via groups.ioSent: Monday, February 26, 2024 9:46 PM To: [email protected]Subject: Re: [BITX20] sbitx encoder contact bounce ? I agree. If the only tool you have is a hammer, every problem looks like a nail. If you can, it's always nice to add a new tool to the belt. On Monday, February 26, 2024 at 09:03:05 PM EST, Ashhar Farhan <farhanbox@...> wrote: Barry, They are simpler fix for you. But if we roll in this interesting change, then, all the hundreds of radios can have better debouncing without touching their soldering irons. We are homebrewing in C as well, now. ? On Tue, Feb 27, 2024, 3:04 AM barry halterman <kthreebo@...> wrote: Two 0.1 uf capacitors on the encoder board are WAY much simpler! Barry ? ? Sent from for Windows ? ? On Monday, February 26, 2024 at 10:37:26 AM EST, Ashhar Farhan <farhanbox@...> wrote: Jack, In the sbitx, the encoders fire interrupts and measure the time through millis(), it is a wrapper around utime() ? My experience is that debouncing in software can vary from encoder to encoder. I would suggest creating symbolic constants for each encoder (e.g., tune, volume, etc). Usually, the delay is between 40 and 100 milliseconds: #define TUNE_ENCODER_DELAY??????????? ???? 50??????? // debounce delay in ms #define VOLUME_ENCODER_DELAY??????????? 40 and then look where to place them in the code. Many programmers use the standard delay() function call: delay(TUNE_ENCODER_DELAY); ?????????? ???? However, the delay() function is a "blocking" function, which means that it turns off interrupts for the delay period. Given that debounce functions have relatively short delays, this probably isn't a problem in this code body. However, perhaps some functions [e.g., MyHairsOnFire()] shouldn't be blocked. In that case, I would suggest: ? Purpose: to cause a delay in program execution ? ? ? unsigned long millisWait ? ?// the number of millseconds to wait ? void MyDelay(unsigned long millisWait) ? unsigned long now = millis(); ? ? while (millis() - now < millisWait) ? ? ; ?????????????????????????????????// Twiddle thumbs until delay ends... ? The millis() standard Arduino function is non-blocking, otherwise it acts the same as delay(). I try to use the style shown above. I use a starting capital letter for the function name and Polish notation because most standard and function library names in the Arduino IDE start with a lowercase letter. That way, I know in advance whether I wrote the code or it comes from a library I didn't write.? Also, the details about the function always falls in the function header between the "/" and the "/" followed immediately by the function signature (e.g., void MyDelay(unsigned long millisWait) and a newline character). By rigidly following the function format, I wrote a program that looked for the "/" lead-in and then used the __FILE__ and __DATE__ standard macros to create a user document that detailed all of the function calls we wrote for the project. When I had my own software company, I gently convinced all of my programmers to follow this format. Anyone who used a different format had to buy beer and pizza for the programmers the following Friday. I don't remember anyone buying lunch more than once, which kept the project documentation for the code up-to-date. Sorry for the long answer, but conventions can make projects with multiple coders easier to use. On Monday, February 26, 2024 at 07:23:58 AM EST, Ashhar Farhan <farhanbox@...> wrote: The debouncing of the encoders is done in software, not hardware. This is the first time I have heard of a bounce problem anyway.? Take a look at the encoder code you could tweak it to increase the debounce time. ? On Mon, Feb 26, 2024, 6:14 AM barry halterman <kthreebo@...> wrote: Hi, I put the capacitors on the underside of the encoder board. Each capacitor (.1uf) goes from? the phase A and B pin, to the encoder housing grounding trace. Plenty of room to incorporate these. Barry ? Sent from for Windows ? ? I am interested to know where you placed the capacitors. Can you show a drawing perhaps? ? On Sun, Feb 25, 2024, 3:18 PM barry halterman <kthreebo@...> wrote: lately I have noticed some contact bouncing with the main encoder when tuning my sbitx. My display frequency would bounce back and forth. I noticed, on the schematic, that there are no capacitors to clean up the noise from the rotary encoder. I installed two .1uf caps on the encoder board and that took care of my issue. Have not noticed any problems with the multi function encoder though. 73 Barry?
-- Jack, W8TEE
-- Jack, W8TEE
-- Jack, W8TEE
-- Jack, W8TEE
|