remove power to the micro, drive 7 segment led

Rotox

New member
A greeting to all ...
I am at my first code ...
my picaxe is 28x2 3v ...
some clarifications:
1) if I remove power to the micro, but on the input pins remains voltage, caused by separate circuits, does the micro damages?
2) How to pilot a 7 segments LED display connected directly to the micro? What is the Basic command to convert a decimal number to 7 segments, for example 125300? And the Basic command for the multiplexer?
Thank you very much!!
 

hippy

Technical Support
Staff member
1) if I remove power to the micro, but on the input pins remains voltage, caused by separate circuits, does the micro damages?
According to the Microchip datasheets this would be putting the PICAXE outside its recommended operation envelope. It is is uncertain what exactly what would happen but, because of the nature of the silicon design, it is possible the external input voltage could keep the PICAXE running ( "phantom powering" ), or, in some circumstances, cause excess-current to flow through the PICAXE which could damage it.

The recommended path would be to put inline current limiting resistors on all the input pins which would be carrying voltages into the PICAXE when its power is renoved.

2) How to pilot a 7 segments LED display connected directly to the micro? What is the Basic command to convert a decimal number to 7 segments, for example 125300? And the Basic command for the multiplexer?
The BINTOASCII command can convert a number to separate digits and a LOOKUP table can convert each digit to segments to display.

How the segment data would be put out to the display would depend ion which multiplexor is used on the display.
 

Rotox

New member
Thank you Hippy!
1) Input pins are connected to the positive through 10kohms resistors and never exceed the value of the supply voltage of 3v. It can happen that the 3v power supply fails and 3v remain on the pin inputs.
So it is not clear what happens in this case?
2) Ok BINTOASCII and LOOKUP! I have to study them better!
As a multiplexer I will use a transistor on the each common display which is controlled simultaneously with the corresponding 7 segment digit. How should the code be written?
 

hippy

Technical Support
Staff member
1) Input pins are connected to the positive through 10kohms resistors and never exceed the value of the supply voltage of 3v. It can happen that the 3v power supply fails and 3v remain on the pin inputs.
I would probably choose one of these two input schemes -
Code:
   3V <---.-------------.--      3V <---------.------.--
         .|.            |                    .|.     |
         |_| 10K      .-^-.              10K |_|   .-^-.
          |    __     |   |                   |    |   |
Input >---^---|__|--->|   |   Input >---|<|---^--->|   |
                      |   |                        |   |
               1K     `-.-'           1N4148       `-.-'
                        |                            |
   0V >-----------------^--      0V >----------------^--
It would also be possible to use a transistor buffer or even opto-isolator on the input.

As a multiplexer I will use a transistor on the each common display which is controlled simultaneously with the corresponding 7 segment digit. How should the code be written?
It would be better to use a dedicated display multiplexor chip as this can be set to display what you want and then left to display it while the PICAXE continues reading its input and doing whatever it needs to do.

Direct multiplexing will mean the PICAXE has to spend most of its time cycling and doing the multiplexing itself which is considerably more difficult, with a more complicated circuit and wiring.
 

Rotox

New member
I would probably choose one of these two input schemes -
Code:
   3V <---.-------------.--      3V <---------.------.--
         .|.            |                    .|.     |
         |_| 10K      .-^-.              10K |_|   .-^-.
          |    __     |   |                   |    |   |
Input >---^---|__|--->|   |   Input >---|<|---^--->|   |
                      |   |                        |   |
               1K     `-.-'           1N4148       `-.-'
                        |                            |
   0V >-----------------^--      0V >----------------^--
It would also be possible to use a transistor buffer or even opto-isolator on the input.


It would be better to use a dedicated display multiplexor chip as this can be set to display what you want and then left to display it while the PICAXE continues reading its input and doing whatever it needs to do.

Direct multiplexing will mean the PICAXE has to spend most of its time cycling and doing the multiplexing itself which is considerably more difficult, with a more complicated circuit and wiring.
Very useful your advice!
The scheme used is the first, only that the 3 v's come from 2 different origins.
Do not fear complicated wiring, I insist that Picaxe has to do multiplexing.
BINTOASCII are clear to me, ok.
LOOKUP I can't understand, page 144 "Manual Basic Command", where it is the conversion of a number with the output pins of the 7 LED segments "A B C D E F G". You would have time to make me a few row of code where to send a number on the output pins, for example on the "B" port, "PIN B0 B1 B2 B3 B4 B5 B6"?
Thanks you
 

hippy

Technical Support
Staff member
You can manually work out what bits need setting on a 7-segment display by hand, E&OE ...
Code:
 _
| |      .ABCDEFG       AAA
|_|     %01111110      F   B
                       F   B
  |      .ABCDEFG       GGG
  |     %00110000      E   C
 _                     E   C
 _|      .ABCDEFG       DDD   o
|_      %01101101
 _
 _|      .ABCDEFG
 _|     %01111001

|_|      .ABCDEFG
  |     %00110011
 _
|_       .ABCDEFG
 _|     %01011011
 _
|_       .ABCDEFG
|_|     %01011111
 _
  |      .ABCDEFG
  |     %01110000
 _
|_|      .ABCDEFG
|_|     %01111111
 _
|_|      .ABCDEFG
  |     %01110011
Then, rather than use LOOKUP, you can turn them into data which is held within the Data Eeprom -
Code:
;          .ABCDEFG
Data 0, ( %01111110 )
Data 1, ( %00110000 )
Data 2, ( %01101101 )
Data 3, ( %01111001 )
Data 4, ( %00110011 )
Data 5, ( %01011011 )
Data 6, ( %01011111 )
Data 7, ( %01110000 )
Data 8, ( %01111111 )
Data 9, ( %01110011 )
And finally you can use a digit value held in a variable to ( 'b0' below ) to find what bit value you would need to put out on the segment driving port ( Port B in the below ) -
Code:
b0 = 7                  ; Digit value
Read b0, outpinsB       ; Output segment bits ( %01110000 )
My data table would probably include the visual indicators of what segments are used so it is easier to verify as correct or if you want to change how characters are displayed; which can be the case for 1, 6 or 9, or if you want to add non-digit characters -
Code:
;                     ;  _
;          .ABCDEFG   ; | |      AAA
Data 0, ( %01111110 ) ; |_|     F   B
;                     ;         F   B
;          .ABCDEFG   ;   |      GGG
Data 1, ( %00110000 ) ;   |     E   C
;                     ;  _      E   C
;          .ABCDEFG   ;  _|      DDD   o
Data 2, ( %01101101 ) ; |_
;                     ;  _
;          .ABCDEFG   ;  _|
Data 3, ( %01111001 ) ;  _|
;                     ;
;          .ABCDEFG   ; |_|
Data 4, ( %00110011 ) ;   |
;                     ;  _
;          .ABCDEFG   ; |_
Data 5, ( %01011011 ) ;  _|
;                     ;  _
;          .ABCDEFG   ; |_
Data 6, ( %01011111 ) ; |_|
;                     ;  _
;          .ABCDEFG   ;   |
Data 7, ( %01110000 ) ;   |
;                     ;  _
;          .ABCDEFG   ; |_|
Data 8, ( %01111111 ) ; |_|
;                     ;  _
;          .ABCDEFG   ; |_|
Data 9, ( %01110011 ) ;   |
 
Last edited:
Top