TM1637 Macro Bug

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
Sanjay_Singh
Posts: 5
http://meble-kuchenne.info.pl
Joined: Sat Dec 12, 2020 4:52 am
Has thanked: 1 time
Been thanked: 1 time

TM1637 Macro Bug

Post by Sanjay_Singh »

Dear Team,

I am writing to report an issue I have encountered while using the TM1637 with 16 switches.

After connecting all 16 switches, I found that the output is being reported in the range of 0–15 instead of the expected 1–16. Additionally, the switch connected between SEG1 and K1 always returns an output of 0, regardless of its state.

This issue is affecting the functionality of my project, and I would appreciate your urgent attention and guidance on how to resolve it.

Thank you for your time. I look forward to your response.

Best regards,
San

mnfisher
Valued Contributor
Posts: 2174
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1016 times

Re: TM1637 Macro Bug

Post by mnfisher »

A key press of 0..15 is probably more 'programmer' friendly - for example it allows array indexing (0..number of elements - 1) without issue? Modt computer languages work this way.

Failing that then just add 1 to the return value?

What module are you using ? The TM1637 is a 16 segment display - which keys are you using?

Sanjay_Singh
Posts: 5
Joined: Sat Dec 12, 2020 4:52 am
Has thanked: 1 time
Been thanked: 1 time

Re: TM1637 Macro Bug

Post by Sanjay_Singh »

@mnfisher

Sir,

“A key press of 0..15 is probably more ‘programmer’ friendly – for example it allows array indexing (0..number of elements - 1) without issue. Most computer languages work this way. Failing that, just add 1 to the return value?”

When all the keys are in the OFF state, the output is already 0. Since I need to use all 16 keys individually, I need to be able to distinguish between no key pressed and each of the 16 key presses. Therefore, I would require 17 distinct states in total: 0 for no key pressed, and 1–16 for the 16 keys.

At present, the key connected between SEG1 and K1 also returns 0, which makes it indistinguishable from the “no key pressed” condition. This is the main issue I am facing.

“What module are you using? The TM1637 is a 16 segment display – which keys are you using?”

It is custom-designed hardware. The TM1637 is a 6-digit, 7-segment LED display driver with support for scanning up to 16 key inputs.

Regards,
San

mnfisher
Valued Contributor
Posts: 2174
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1016 times

Re: TM1637 Macro Bug

Post by mnfisher »

Sorry, the key array I looked at returned 255 for 'no key'...

Martin

chipfryer27
Valued Contributor
Posts: 2105
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 469 times
Been thanked: 699 times

Re: TM1637 Macro Bug

Post by chipfryer27 »

Hi

The only one I have used also returns 255 when no key is pressed.

Stupid question. Have you electrically verified connection between SEG1 and K1 to ensure it is operating correctly?

Regards

BenR
Matrix Staff
Posts: 2292
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 634 times
Been thanked: 840 times

Re: TM1637 Macro Bug

Post by BenR »

Many thanks for letting us know.

It looks like the sim does return 0 - 16 where 0 is no press and 1-16 are valid presses.

I've rolled out a fix for the v11 components that should allow the embedded code to work correctly like the sim.

Let us know how you're getting on.

Sanjay_Singh
Posts: 5
Joined: Sat Dec 12, 2020 4:52 am
Has thanked: 1 time
Been thanked: 1 time

Re: TM1637 Macro Bug

Post by Sanjay_Singh »

Ben,

I'm on V10!
Any help?

San

BenR
Matrix Staff
Posts: 2292
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 634 times
Been thanked: 840 times

Re: TM1637 Macro Bug

Post by BenR »

Hi San,

Fixed for you in v10 now too.

Please let us know your version when you're making a new topic (there should be a radio button allowing you to select your version) and this helps us to fix the problem for you ASAP.

Post Reply