Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

My Digit four is Less brightness!

Status
Not open for further replies.

Suraj143

Active Member
I have a 4 digit multiplex routine as below. But the digit4 (the last digit) brightness is low. Because I’m not scanning all four digits equally. Its like this

Ex:

*when Dselect bit = 3 it must show all four digits.
*when Dselect bit = 2 it must show the first three digits.
*when Dselect bit = 1 it must show the first two digits.
*when Dselect bit = clear it must show the first digit.

Any method to solve this.

Code:
Mulpx	clrf	PORTB
	clrf	PORTA				
	btfsc	Dselect,1	;if Dselect bit = 1	
	call	One		;Show only digit 0 & 1
	btfsc	Dselect,2	;if Dselect bit = 2	
	call	Two		;Show only digit 0 & 1 & 2
	btfsc	Dselect,3	;if Dselect bit = 3	
	call	Three		;Show only digit 0 & 1 & 2 & 3 
	btfss	Dselect,0	;if Dselect bit = 0
	call	Zero		;show only 0 digit
	goto	Mulpx								
		
Three	movlw	b'00001000'	;enable digit3
	movwf	PORTA
	movf	Digit3,W
	call	Table
	movwf	PORTB
	call	Delay		
Two	movlw	b'00000100'	;enable digit2
	movwf	PORTA
	movf	Digit2,W
	call	Table
	movwf	PORTB
	call	Delay						
One	movlw	b'00000010'	;enable digit1
	movwf	PORTA
	movf	Digit1,W
	call	Table
	movwf	PORTB
	call	Delay
Zero	movlw	b'00000001'	;enable digit0
	movwf	PORTA
	movf	Digit0,W
	call	Table
	movwf	PORTB
	call	Delay					
	return
 
Last edited:
Assuming that you are trying to suppress leading zeroes then why not do it the way I suggested in your other thread.

Mike.
 
I have a 4 digit multiplex routine as below. But the digit4 (the last digit) brightness is low. Because I’m not scanning all four digits equally. Its like this

you have to scan all the digits, you need to blank digit you do not want to show
 
Pommie said:
Assuming that you are trying to suppress leading zeroes then why not do it the way I suggested in your other thread.

Mike.

Hi mike I’m all the time with your codings. I’m learning them. Now only I understood your leading zero suppress method. According to that it’s clearing & sending data to the PORTB. Also it’s scanning all four digits every time.

Unless my code is directing which DIGIT to show directly causing to give problem to the display brightness as well.
 
Last edited:
You don't need any of those changes.

Code:
	bsf	Flags,0		;use bit 0 of variable flags to indicate 
				;we are suppressing leading zeroes.
	movfw	Digit3		;get most significant digit
	btfs[COLOR="Red"]s[/COLOR]	STATUS,Z	;is digit three = zero
	bcf	Flags,0		;no so clear the leading zero flag
	call	Table		;get the segment pattern
	btfsc	Flags,0		;if leading zero flag is set
	movlw	0xff		;then display nothing.
	clrf	PORTA		;turn off display
	movwf	PORTB
	bsf	PORTA,3		;turn on digit 3
	call	Delay

	movfw	Digit2
	btfs[COLOR="Red"]s[/COLOR]	STATUS,Z
	bcf	Flags,0
	call	Table
	btfsc	Flags,0		; if leading zero flag is set
	movlw	0xff		; then display nothing.
	clrf	PORTA
	movwf	PORTB
	bsf	PORTA,2
	call	Delay

	movfw	Digit1
	btfs[COLOR="Red"]s[/COLOR]	STATUS,Z
	bcf	Flags,0
	call	Table
	btfsc	Flags,0		; if leading zero flag is set
	movlw	0xff		; then display nothing.
	clrf	PORTA
	movwf	PORTB
	bsf	PORTA,1
	call	Delay

	movfw	Digit0
	call	Table
	clrf	PORTA
	movwf	PORTB
	bsf	PORTA,0
	call	Delay

The way it works is, if bit 0 of Flags is set then don't display any zeroes. Therefore, if Flags,0 = 1 then we should display nothing and so we overwrite the value returned from the call to Table with 0xff. Unfortunately, I made a mistake in the original code, coloured red above, it should now work correctly. I have extended it to do all digits and to show that digit 0 is always displayed.

Mike.
 
Oh thanks a lot mike it will work for sure.Thats the place I had the problem now already you corrected it.

Anyway thanks a lot Mike.Now I really got the meaning of Leading zero suppress method.

You are best.
 
Hi Mike I applied your code it worked really well.
When not to show anything I altered the value 0Xff to 100h.Because when 0Xff applied the display shows the digit = 8.

Thank you very much Mike.
 
Status
Not open for further replies.

Latest threads

Back
Top