Cypress Developer CommunityTM

7 segment button with counter

Summary: 12 Replies, Latest post by TURASGAS on 07 Jun 2013 07:35 AM PDT
User
28 posts

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.

Attachments:
User
9277 posts

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

User
28 posts

Firstly, thanks for your answer Bob.Should i add one more interrupt?I didn't understand can you show me on zip file?

User
9277 posts

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

Bob

Attachments:
User
28 posts

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?

User
9277 posts

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

Bob

User
9277 posts

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

Bob

User
28 posts

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

User
2553 posts

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

User
9277 posts

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

User
28 posts

I'm sorry Bob, I don't know. I compile file.Tens and hunderds digits writes the same number

Attachments: