cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi,

   

 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.

0 Likes
Reply
12 Replies
JoMe_264151
Expert II

Merhaba!

   

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.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable
        Firstly, thanks for your answer Bob.Should i add one more interrupt?I didn't understand can you show me on zip file?   
0 Likes
Reply
JoMe_264151
Expert II

At first: There is a ready-to-use component made by chris kees, you may get hands on it here:

   

http://www.cypress.com/?app=forum&id=2492&rID=70446 

   

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

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable
        Thank you Bob,i try to example but not working. 7 segment is not lighting. i will work on example Thanks for everything. ı should develop writing code Do you have to offer the source for coding?   
0 Likes
Reply
JoMe_264151
Expert II

Sorry, did not understand you right, what code do you need?

   

 

   

Bob

0 Likes
Reply
JoMe_264151
Expert II

PS: I mistook "segmentler()" for "segment()" in the interrupt handler, please change that

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable
        Thanks Bob. I added hundereds digits. i thought this; uint8 Digits[3] = {0,0,0}; else if(rakam==3) { PinColumn1_Write(0); PinColumn2_Write(0); PinColumn3_Write(1); } Digits[2] = ((rakam/100)%10); CY_ISR(SegmentHandler) { static uint8 DigitNumber = 0; if(DigitNumber != 0) DigitNumber = 0; else if(DigitNumber != 1) DigitNumber = 1; else DigitNumber = 2; segment(Digits[DigitNumber]); PinColumn1_Write(!DigitNumber); PinColumn2_Write( DigitNumber); PinColumn3_Write( DigitNumber); } But I have some error. Maybe CY_ISR(SegmentHandler) lines error. I dont find error. Can you show me my mistakes?. Thanks a lot   
0 Likes
Reply
HeLi_263931
Honored Contributor II

Which error do you get? Doesn't it compile, or doesn't it show what you expect?

0 Likes
Reply
JoMe_264151
Expert II

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.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable
        I'm sorry Bob, I don't know. I compile file.Tens and hunderds digits writes the same number   
0 Likes
Reply
JoMe_264151
Expert II

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.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

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?

0 Likes
Reply