Weird one this. Works as expected in simulation but when I program the board the 7 segment display has "8" illuminated. If you press a digit on the keypad, the correct digit displays but as soon as you remove your finger 8 is illuminated again.
It is such a simple program surely this is a bug and not a hardware issue?
Pete
7 seg display
-
- Posts: 33
- http://meble-kuchenne.info.pl
- Joined: Sat Nov 20, 2021 11:28 am
- Has thanked: 1 time
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: 7 seg display
Hi
I notice your Keyboard and LED display both share the same B1 pin which will lead to issues, but probably not as you describe.
How is your LED display connected? It sounds more connectivity rather than bug, perhaps to do with common pin especially if using a transistor, or perhaps Weak Pull Ups enabled where they shouldn't?
Schematic would be a big help, or sketch.
Regards
PS
Also, I see you are using a Common Pin. This is usually only needed when switching between multiple displays (multiplexing) and is not needed here. Without seeing schematic, perhaps connect cathode directly to 0v and set Common Pin to No?
I notice your Keyboard and LED display both share the same B1 pin which will lead to issues, but probably not as you describe.
How is your LED display connected? It sounds more connectivity rather than bug, perhaps to do with common pin especially if using a transistor, or perhaps Weak Pull Ups enabled where they shouldn't?
Schematic would be a big help, or sketch.
Regards
PS
Also, I see you are using a Common Pin. This is usually only needed when switching between multiple displays (multiplexing) and is not needed here. Without seeing schematic, perhaps connect cathode directly to 0v and set Common Pin to No?
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: 7 seg display
The other issue...
You are constantly setting the LED digit - when your finger is removed - what does GetNumber return? The LED will be set to that (and it might not be a valid 'digit'?
Martin
You are constantly setting the LED digit - when your finger is removed - what does GetNumber return? The LED will be set to that (and it might not be a valid 'digit'?
Martin
-
- Posts: 33
- Joined: Sat Nov 20, 2021 11:28 am
- Has thanked: 1 time
Re: 7 seg display
I ran out of I/O so do not use the decimal point but say it is connected to B1 just to satisfy the software. I hadn't realised I did not need the common pin until I'd already layed out the board .
@martin the display gives me "8" before anything is pressed.
Thanks both
@martin the display gives me "8" before anything is pressed.
Thanks both
- Attachments
-
- Circuit.pdf
- (179.98 KiB) Downloaded 8 times
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: 7 seg display
Yes, it displays the value by Get Number each time through the loop - if no key is pressed what does it return, that is what it is trying to display...
I don't think get number waits until you press a key.
Martin
I don't think get number waits until you press a key.
Martin
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: 7 seg display
Hi
I think I see the problem. Nothing to do with the schematic.
If you go to Debug you can Step Into. Each click on Step Into will move one position through your chart. After the first click, Simulation Debugger appears in which you can select variables. Select the variable "keypad" which will show the value of whatever is returned from the keypad.
As you progress, you will see that with no key pressed the value of "keypad" returned is 255. You can also see that with a key pressed you get values of 0-11 (12 keys). I don't know what happens within the LED component to translate a number to segments, but I'm guessing 255 is setting them all on.
Perhaps have a decision after reading the keypad in which if the value is less than 255 then the LED is updated?
Regards
I think I see the problem. Nothing to do with the schematic.
If you go to Debug you can Step Into. Each click on Step Into will move one position through your chart. After the first click, Simulation Debugger appears in which you can select variables. Select the variable "keypad" which will show the value of whatever is returned from the keypad.
As you progress, you will see that with no key pressed the value of "keypad" returned is 255. You can also see that with a key pressed you get values of 0-11 (12 keys). I don't know what happens within the LED component to translate a number to segments, but I'm guessing 255 is setting them all on.
Perhaps have a decision after reading the keypad in which if the value is less than 255 then the LED is updated?
Regards