News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

LCD/timer

Started by Marcel_741, Apr 08, 2022, 11:46 AM

Previous topic - Next topic

Marcel_741

Hello

For a project I want to make a timer which count from a adjustable value to 0. When it reaches 0, an action needs to be performed. What I have working now is the adjustable value which is displayed on a LCD. It is created with a 25K potmeter and a 100nF condensator. The unload time is used for the counter. In my case maximum of 40 steps. Start of the counter to 0, will be start with S1. Were it stucks is the moment I press S1. The program is stopped and nothing can be done. Turning of the potmeter doesn't update so it is really stucked.

Maybe I can get some advice, and hope it is clear enough what Imentioned.

Regards,

Marcel

RGV250

Hi,
Because you are counting down you need step-1 or other value -2 etc.
For x = weerstand To 0 step -1

Bob

trastikata

I was wondering why the need to set the value of a digital timer with an analog RC circuit?

John Lawton

Quote from: trastikata on Apr 08, 2022, 12:50 PMI was wondering why the need to set the value of a digital timer with an analog RC circuit?
Because a 555 isn't good enough these days, it has to be 'digital' :)

top204

#4
Because the old 16F628 does not have an ADC, it was common to use the charge time commands Pot or RCin with a capacitor and a potentiometer. It measures how long the capacitor needs to discharge or charge, and the value given, relates to the variable resistor's value.

Instead of the For...Next loop, you would probably be better off with a Repeat...Until loop. Then you have more control over it, and can check the Carry flag or the Zero flag if required. Or check if a value has gone negative...

The good old NE555 timer was a wonder of its age, the same with the 741 Op-Amp. :-) I had many experiments with both of them when I was a young-un. But I never liked the dual supply for the 741. LOL

Marcel_741

Bob

Thanks for that. How could I forget such a basic fact...pffffffffff

Trastikata

This way is how I know it and to my opinion It can work.
Other reason is the choice of a potmeter with press button, is that the user has to understand basic simple ways, with
this choice I think reach that goal.

The update version is attached.

Regards,

Marcel

trastikata

Quote from: Marcel_741 on Apr 08, 2022, 01:44 PMOther reason is the choice of a potmeter with press button, is that the user has to understand basic simple ways, with
this choice I think reach that goal.

Hi Marcel_741,

my understanding is that you set a count-down timer and the upper limit of this counter is set by a RC circuit?

Why not a simple button to increment the counter to the desired value instead of the RC circuit?

Marcel_741

Trastikata

It takes an other way of program and turning to the max is easier than pressing to the max. If the user has to press each time to the maximum of the scale, it could be disturbing.

But I fully understand your intention and I thank you for that.

Marcel

John Lawton

Quote from: Marcel_741 on Apr 08, 2022, 02:12 PMTrastikata

It takes an other way of program and turning to the max is easier than pressing to the max. If the user has to press each time to the maximum of the scale, it could be disturbing.
I have to agree, a rotating knob is often a better interface than up/down buttons. Take the example of a volume control.

trastikata

#9
Quote from: Marcel_741 on Apr 08, 2022, 02:12 PMIt takes an other way of program and turning to the max is easier than pressing to the max. If the user has to press each time to the maximum of the scale, it could be disturbing.

My concern is mostly with the analog Pot - those tend to get iffy with the time. Maybe a continuous rotary switch would be better?

top204

On the 16F628, a rotary encoder may be better. It gives the feel of a potentiometer and has a button when pressed.

Craig

Hi Marcel

I would Just use a Simple REED Switch (Like you find in the Door sensors of a standard Burglar alarm) with a Magnet that revolves past and use that as a counter, its cheap and simple especially if used in Dusty Environments like Africa.
To be a bit more elaborate you could also use a simple Hall effect sensor "A3144" then you could pick up both the Directions by using two magnets like you
get in the Rotary encoders as mentioned above. 

See_Mos

If Marcel is located here in the UK then I could send him a spare 16mm encoder.

As an alternative I recently wrote some code for changing the frequency of an RF generator.  Left and right buttons move a cursor under the digit to change and two more buttons increase or decrease the selected digit.  It would not be hard to modify it for a clock or timer.