Strategy 3 is a reasonable technique. Just minimize your scan rate to keep the 'no-digit-on' time to as small a percentage of the total time as possible. The trade off is that the slower the scan the more chance of you seeing flicker in the display. ; You must try something as simple as: movwf ???,W ; get value for segments bcf PORTA,? ; turn off prior digit movwf PORTB,W bsf PORTA,? ; tun on new digit This gives you a 'no-digit-on' time of only 2 instructions or 1/4096 second. If you have 4 digits and scan them 64 times per second then you will multiplexs to a new digit 256 times per second, and the 'no-digit-on' time will only be 1/16 of the total. That is only 6.25% which will probably not be visible. (all calculations above assume I didn't slip a binary point...) Bob Ammerman RAm Systems ----- Original Message ----- From: "Pic Dude" To: Sent: Monday, March 25, 2002 12:04 AM Subject: [PIC]: 7-segment strategies... Was playing with 7-segment displays this morning and ran into an "issue". I was able to find a work-around, but wondering how others deal with this... The key to my problem is that I am trying to hook up a few 7-segment displays to a 16F84A with as few external components as possible (no external chips is ideal, and as few transistors, etc). Osc is 32.768kHz. RB1:RB7 go to the 7 cathodes (each segment), and RA0:RA3 go to the common anodes thru indiv. transistor drivers. From the electrical specs on the 16F84A datasheet, I should have enough current-sink capability out of each pin (20ma), but the max for the whole port is rated at 150ma. The digit "8" has all segments on simultaneously, so that would exceed 150ma, but I thought that I could split the 7 segments over 2 ports. BTW, is that 150ma continuous, short-burst peak, or both? For now, let's say that I run all 7 segs off of port B. STRATEGY 1: Initialize Set digit-select pattern to "0001" Loop: Shift digit-select pattern Calculate current 7-seg pattern Output to Port B Put digit-select pattern into W Output to Port A goto Loop The problem here is that I was getting some "ghosting" of one digit onto the one adjacent to it. My guess was that at only 32.768 kHz, the time between retrieving the digit-select pattern and dumping it to Port B was enough to have the current 7-seg pattern visible on the previous digit. STRATEGY 2: Added a delay just before "goto Loop". At first, I just used a 255-cycle delay, but that was so slow, I could count the digits pulsing, so I optimized the rate where the ghosting was reduced, while not being able to see the display ficker. STRATEGY 3: Switched off all digits (00000000 ==> Port A) just before setting the output on Port B, then set Port B, then output the correct pattern to Port A. This fixed the ghosting. BUT... I was thinking that if the short period of mixed pattern in the first pass was enough to cause ghosting, then this short period of off-time is affecting my other requirement to get the displays as bright as possible. It looks right, but it just doesn't feel right :-) Other thought was to kick up the clock to the MHz range and go with strategy 1. Ghosting time could be reduced to where it's invisible. Still sticking with no external chips, how else have any of you dealt with this? I know that with external chips, I can do one of... (a) Use an external decoder chip so 7-seg pattern and digit select can be on the same port and latched simultaneously. (b) Use an external driver chip so that I can get extra brightness by (legally) overdriving the LED's (c) Both of the above with a single decoder/driver chip. Or should I just leave well enough alone with strategy 3? Cheers, -Neil. -- 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 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.