hippy
Ex-Staff (retired)
I finally got round to playing multiplexed 7-segment display driving; 28X1, Port B ( normal output pins ) driving anodes, Port C sinking the common cathodes. Each Port B line has a 1K8 R in series, this limits current to below 3mA out of any Port B pin, and the most any Port C pin will sink is below 24mA with all eight anodes driven, below its limit.
Not the brightest of displays ( 3mA per segment on for one eighth of the time ) but usable if you have a high efficiency display or bright enough for application, otherwise it is a case of using transistors, FET's or a specialist LED multiplex chip.
The basic control is a loop of the following running at 8MHz -
pins = %???????? ' Set segments for digit
pinsc = %11111110 ' Sink cathode of digit 1
PauseUs 100
pinsc = %11111111 ' Don't sink anything
Repeated eight times, shifting the %11111110 to %11111101 etc for each digit in turn. Delays to about 2ms work without flicker. You'd get extra brightness by using an external 16MHz crystal and doubling that delay.
The 2ms on period can be used to sample ADC, check for SERIN, read and process data, and interrupts won't cause any over-current problems ( all are in-spec ) but digits will get brighter during those times. Alternatively, reads etc can be done at the end of the loop and the display will dim during processing. Flicker will start if processing takes too long, but it can perhaps be spread throughout the on periods.
Seems to be working well, the biggest job is wiring everything up ! Not finished that yet.
Phase II - Into the Unknown
This may be a question for Dr_Acula because I'm sure he's done similar, but anyone can chip in ...
By reducing the on time and increasing the off time it is possible to also decrease the R; the average current over the time period remaining the same. It is theoretically possible ( but not good engineering practice and puts a PICAXE / PICmicro out of spec ) to drive LED's with no R at all.
With no R's, all eight Port B anodes sinking into a single Port C pin, does anyone have any idea of what would be a workable on / off period without burning out the chip with undue haste ?
For the sake of eight R's it may not be worth the effort or risk but it's a question bugging me and I don't know the answer.
Not the brightest of displays ( 3mA per segment on for one eighth of the time ) but usable if you have a high efficiency display or bright enough for application, otherwise it is a case of using transistors, FET's or a specialist LED multiplex chip.
The basic control is a loop of the following running at 8MHz -
pins = %???????? ' Set segments for digit
pinsc = %11111110 ' Sink cathode of digit 1
PauseUs 100
pinsc = %11111111 ' Don't sink anything
Repeated eight times, shifting the %11111110 to %11111101 etc for each digit in turn. Delays to about 2ms work without flicker. You'd get extra brightness by using an external 16MHz crystal and doubling that delay.
The 2ms on period can be used to sample ADC, check for SERIN, read and process data, and interrupts won't cause any over-current problems ( all are in-spec ) but digits will get brighter during those times. Alternatively, reads etc can be done at the end of the loop and the display will dim during processing. Flicker will start if processing takes too long, but it can perhaps be spread throughout the on periods.
Seems to be working well, the biggest job is wiring everything up ! Not finished that yet.
Phase II - Into the Unknown
This may be a question for Dr_Acula because I'm sure he's done similar, but anyone can chip in ...
By reducing the on time and increasing the off time it is possible to also decrease the R; the average current over the time period remaining the same. It is theoretically possible ( but not good engineering practice and puts a PICAXE / PICmicro out of spec ) to drive LED's with no R at all.
With no R's, all eight Port B anodes sinking into a single Port C pin, does anyone have any idea of what would be a workable on / off period without burning out the chip with undue haste ?
For the sake of eight R's it may not be worth the effort or risk but it's a question bugging me and I don't know the answer.