Spehro Pefhany wrote: > At 10:03 AM 3/17/2004 +0200, you wrote: > >> >> Hi, >> >> For the display of my project I'm using four seven segment displays >> (common >> anode), using 8 IO pins for the segments, and another 4 to drive the >> individual displays. The four displays are driven through a BC557 >> transistor It would seem I was hasty with my suggestion of timing the led "on" time, due to it being some months since I did it. I have dug out some of the code, and reproduce it here. All those with more experience ten ine welcome to pull it to bits. Regards Howard led_lookup ;---------- ; ;rb7=d, rb6=c, rb5=e, rb4=g, rb3=f, rb2=a, rb1=b, rb0=interrupt addwf pcl,f ; Jump into the correct location ; dcegfab(int) retlw b'00010000' ; 0 retlw b'10111100' ; 1 retlw b'01001000' ; 2 retlw b'00101000' ; 3 retlw b'10100100' ; 4 retlw b'00100010' ; 5 retlw b'00000010' ; 6 retlw b'10111000' ; 7 retlw b'00000000' ; 8 retlw b'00100000' ; 9 retlw b'11111110' ; blank ;-------------------------------- ;seven segment patterns, based on clear to light segment ;so segments not lit are set ;bits 1 to 7 are for leds ;bit 0 not used for leds, it's the wheel interrupt ;NOTE!!! So as not to have to fuck with the upper PC byte ;this routine must be in the first 256 bytes of prog memory ;---------------------------------- ;------- ; RA0 is thous driver, RA1 is hunds, RA2 is tens, RA3 is units, ; RA5 is Dec'Point ; 0 bits are switched on. 1 bits are switched off ; dpflag is set to show dec point ;-- call timer0 ;start timer movfw units ;load with units digit call led_lookup movwf led_segs ;copy to led_segs movlw b'000111' ;default decimal point on btfss dpflag ;skip to show decimal point movlw b'100111' movwf porta call timer_end ;wait for timeout ;-- call timer0 ;timer stops "leakage" between digits. ;slows multiplexing movfw tens ;load with tens digit call led_lookup movwf led_segs ;copy to port b (bit7 will be zero ;because digit is always 9 or less movlw b'001011' ;default decimal point on btfss dpflag ;skip to show decimal point movlw b'101011' movwf porta call timer_end ;wait for timeout ;keep going for the rest of the digits ;-------- ;--------------- timer0 ;--------------- ;set for one millisecond bcf intcon,t0if clrf tmr0 return timer_end loop02 btfss intcon,t0if goto loop02 return ;-------------------------------- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics