A button is pressed the rise a counter.I want to see the values of counter with 7 segment. I am using two seven segment multiplexing. Pressing button ones digit increasing but second digit(tens digit) is flashing a short period of time. Example, i want to count 25,26,27. 5,6,7 digits counting. But tens digits(2) flashing.CAn you see the program? What I'm doing wrong.
You write the onlar, wait a bit, then write the birlar, this signal stays until the next cycle of the interrupt happens. Do not forget that you only can make one digit lighting at the same time.
Change to the following to keep the interrupt short:
Put the decoded 7-segment digits into two bytes.
run interrupt at frequency of 100Hz
At each interrupt show one of the digits, at next interrupt the other, so both digits will have same brightness.
At first: There is a ready-to-use component made by chris kees, you may get hands on it here:
I think you are trying to learn PSoC, so it is always a good exercise to find solutions for yourself.
Nevertheless, here is an example, untested so test yourself
Yilmaz, Please do not supply code here in the text-box. The forum software (blame Cypress!) is not able to handle that. Instead upload your project as you did before ot attach a zipped (NOT RAW) file.
Yes, you need to understand and to program multiplexing.
The segments are driven correctly in your program. But with every interrupt of the multiplexer the next digit must be shown. This is done by driving low the appropiate pin where the digit is connnected to. So you cycle through your 3 pins and only one of them is low and the others are high.
You can see that in my provided example. An improvement you could do when using more than 3 digits could be: Not to switch off ALL digits, but that digit that was accessed before AND not to switch all digits, but only that one which has to be driven low.
Another improvement which can be thought of could be to use an array of pointers to the function to write the pin. This could make the interrupt routine a 5-liner. I WARN YOU! In the world of PSoC3 (only here) this is complicated to implement because of some strange compiler behaveour, I ran into that trap a year ago and decided not to use PSoC3s if I could avoid them.
Thank you Bob,You were very helpful. There is last question i would be glad if you answer me . I try to make timer circuit. Button pressed increase or decrease time and when "set" button pressed timer will decrease every minute. but there is problem. when i set timer 6 minute and press "set button timer must decrease 1 minute and count trough zero. But I can't see lcd. Can you see that?