Its been a while since I have posted anything, but I have written some code to display the 8 bit ADC result to three 7 segment displays. It is running at 4Mhz with TMR0 pre-scaler set at 256.
so each segment is lit for 1.031ms a total display time of 3.096ms. How do I calculate the Frequency (Hz) of the display ?
Is the code a good or reasonable way to multiplex displays? Here is the main loop.
so each segment is lit for 1.031ms a total display time of 3.096ms. How do I calculate the Frequency (Hz) of the display ?
Is the code a good or reasonable way to multiplex displays? Here is the main loop.
Code:
START ; Read RA0 and convert to decimal
call ReadADC
movf Hund,w ; Get Hund Result
call Table ; then output it
movwf PORTB ; to PORTB
bsf PORTA,2 ; display 1 ON
clrf TMR0 ; Clr TMR0
w1 btfss TMR0,2 ; wait to go low
goto w1 ; display for 1.031ms
bcf PORTA,2 ; display 1 OFF
movf Tens,w ; Get Tens Result
call Table ; then output it
movwf PORTB ; to PORTB
bsf PORTA,3 ; display 2 ON
clrf TMR0 ; Clr TMR0
w2 btfss TMR0,2 ; wait to go low
goto w2 ; display for 1.031ms
bcf PORTA,3 ; display 2 OFF
movf Ones,w ; Get Ones Result
call Table ; then output it
movwf PORTB ; to PORTB
bsf PORTA,4 ; display 3 ON
clrf TMR0 ; Clr TMR0
w3 btfss TMR0,2 ; wait to go low
goto w3 ; display for 1.031ms
bcf PORTA,4 ; display 3 OFF
goto START
Last edited: