I have a 4 digit 7-segment display that I mux through a MPU (illuminate one digit, wait a couple ms, go to the next digit... like this:
- posted
17 years ago
I have a 4 digit 7-segment display that I mux through a MPU (illuminate one digit, wait a couple ms, go to the next digit... like this:
You most likely have 'ground noise' from a common connection with the display current hrowing through it.
It might also be RFI. Is the display driver right next to the display itself ?
Graham
The display driver (MPU) pcb is mounted directly to the back of the 4x7 display module. There is 4" of wire (+5, G, SDA, SCL) going to the display pcb, however, when assembled the 2 pcbs are 1/2" apart.
jt
How does that assembly get its power ? How does the analogue section get its power ?
Graham
A 9V battery goes to a LT1111 regulator on the analog board. The analog board has a header where I run power and coms (TWI/I2C) to the display board (through 4" of 22AWG wire). jt
If you're sure it's not ground bounce, try making your LED VCC separately. If they're common anode displays, use 9V directly.
-- Ben Jackson AD7GD http://www.ben.com/
There's your problem. What does I * R equal ?
What's the R of a pcb trace ?
Graham
Make the LED *RETURN* seperately more like ! Noise on the plus volts in comparison is easily filtered.
Graham
Thanks, Ben and Eeyore. I got it working.
For some reason (noise, ground bounce, V sag, ...) when I was feeding 5V to the LED module the display MPU was going haywire and drawing way too much current (290mA!). Once I ran 9V to the display presto, 40mA (@9V), and clean (enough) analog signals.
Not that I suppose it matters any more, but you can reduce noise & RFI by slowing down the multiplexing. The amount of noise is directly related to the how often the drive signals change state, so the slower you switch them, the fewer the switching transients. For 7-segment displays, 50 refreshes/second (20mS each, divided by the number of digits) is plenty. In your circuit, that works out to 5ms per digit, or a mux frequency of 200Hz. I haven't looked very closely at your code, but it seems to be refreshing way more than neccessary, which will increase your power requirements, generate lots of noise, & waste lots of CPU cycles you could be using for something else.
Pseudo-code: (All straight out of my head, & completely untested.)
; ************************************************** ; **** 7 segment LED display multiplexing stuff. *** ; ************************************************** ;Variables: DISP_MUX = 0 ; DISP_0-3 are the segments for each ; 7 segment display, Bits 0-6 = Seg's ; A-F, bit 7 = DP (if used) ; Main prog can update patterns any time.
DISP_0 = 0xFF ; All segments lit for debugging. DISP_1 = 0xFF : **Assuming that '1' = on, '0' = off* DISP_2 = 0xFF ; **Invert if neccessary! ** DISP_3 = 0xFF ; Output Ports: DISP_SEGS = PORTA ; Or whatever. DISP_DIG = PORTB ; Or whatever. DISP_BLANK = 0x00 ; All digits disabled.
; Setup:
conf TIMER for 5ms (5ms/digit * 4 digits = 20ms = 50Hz) set TIMER interrupt to DISPLAY subroutine enable TIMER interrupt
; Main: ;----------------------------- ; Your main program goes here. ;----------------------------- ; DISPLAY: ; Multiplexing IRQ routine. OUT DISP_DIG, DISP_BLANK ;Blank display until ;segment data valid. IF DISP_MUX = 0 ; DIGIT 0 (Left) OUT DISP_SEGS, DISP_0 OUT DISP_DIG b'00000001' ; Enable Digit 0 ELSE
IF DISP_MUX = 1 ; DIGIT 1 OUT DISP_SEGS, DISP_1 OUT DISP_DIG b'00000010' ; Enable Digit 0 ELSE
IF DISP_MUX = 2 ; DIGIT 2 OUT DISP_SEGS, DISP_2 OUT DISP_DIG b'00000100' ; Enable Digit 0 ELSE
IF DISP_MUX = 3 ; DIGIT 3 (Right) OUT DISP_SEGS, DISP_3 OUT DISP_DIG b'00001000' ; Enable Digit 0 ELSE INC DISP_MUX AND DISP_MUX, 3 ; Roll counter over if needed RETI ; Return from interrrupt. ; *************************************************************
Oh well, even if you don't need this, hopefully someone else will find it useful. ;)
-- W "Some people are alive only because it is illegal to kill them." . | ,. w , \\|/ \\|/ Perna condita delenda est ---^----^---------------------------------------------------------------
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.