Quote Originally Posted by richard View Post
anyways here is my take on the 7 seg display
if you have a chip with mssp why waste time and code space when the hardware can do it for you

I cheated a bit and did it in asm for speed and size gains
no nasty pauses , all gone
my displays are common anode so the data is inverted see comments
Hello Richard, thanks for response. Your code is probably for 4 digit 7 segment display where the segments is driven via 74HC595 shift register, and the common anodes via transistors directly from MCU or for multiplexing a bare display whitout driver right?

Look at mi first post, my display is driven by two 74HC595 shift register, one for segments, and the second for digits (like common anodes/cathodes).

To send data I used:
Code:
 
SHIFTOUT DPIN, CPIN, MSBFIRST,[ones,%0001]  ;(segment pattern, digit position)
Now I tring to find more elegant way to extract ones, tens, hundreds and thousands like my previous solution:
Code:
 
setdisp:
segment = value//10
gosub look
ones=segment            ; extract ones

segment =  value/10 
segment = segment//10
gosub look
tens=segment            ; extract tens

segment =   value/100
segment = segment//10
gosub look
hundreds=segment        ; extract hundreds

segment = value/1000
gosub look
thousands=segment       ; extract thousands
Can you help me with it?