upand_at_them
Active Member
I've got a 4-digit 7-segment CA display hooked up to a 16F886. And I've got a problem with a ghost digit. Even though I've got the anode turned off it's drawing 0.9uA. Not much current, but still produces a ghost:

(That's a little brighter than actual, because of the high ISO camera setting.)
It's got me stymied. I've tried other unused PIC pins to drive the anode and get the same result. I'm pretty certain it's not the code but here it is (in JAL):
When I test the other blanked digits they're not drawing anything (0.00uA). And it's not the individual digit, because I can get the same result on another digit by swapping the connection. I also swapped in a red display and got the same results.

(That's a little brighter than actual, because of the high ISO camera setting.)
It's got me stymied. I've tried other unused PIC pins to drive the anode and get the same result. I'm pretty certain it's not the code but here it is (in JAL):
Code:
include 16F886 -- target: PIC16F886
pragma target OSC INTOSC_NOCLKOUT -- interal clock
pragma target clock 4_000_000 -- resonator frequency
pragma bootloader long_start -- for TinyBootloader
pragma target WDT disabled
pragma target LVP disabled
pragma target MCLR external
enable_digital_io() -- disable analog functions
var bit a3 is pin_A3 -- digit 4 anode
var bit a2 is pin_A2 -- digit 3 anode
var bit a1 is pin_A1 -- digit 2 anode
var bit a0 is pin_A0 -- digit 1 anode
var bit b7 is pin_B7 -- segment cathodes
var bit b6 is pin_B6
var bit b5 is pin_B5
var bit b4 is pin_B4
var bit b3 is pin_B3
var bit b2 is pin_B2
var bit b1 is pin_B1
pin_A3_direction = output
pin_A2_direction = output
pin_A1_direction = output
pin_A0_direction = output
pin_B7_direction = output
pin_B6_direction = output
pin_B5_direction = output
pin_B4_direction = output
pin_B3_direction = output
pin_B2_direction = output
pin_B1_direction = output
const delay = 5000
const aclear = 0b_0000_0000
const digit4 = 0b_0000_1000
const digit3 = 0b_0000_0100
const digit2 = 0b_0000_0010
const digit1 = 0b_0000_0001
const bclear = 0b_1111_1111
const num0 = 0b_0000_0011
const num1 = 0b_1001_1111
const num2 = 0b_0010_0101
const num3 = 0b_0000_1101
const num4 = 0b_1001_1001
const num5 = 0b_0100_1001
const num6 = 0b_0100_0000
const num7 = 0b_0001_1111
const num8 = 0b_0000_0000
const num9 = 0b_0000_1000
const byte num[] = {
num0,
num1,
num2,
num3,
num4,
num5,
num6,
num7,
num8,
num9
}
var byte d1
var byte d2
var byte d3
var byte d4
function _digit( byte in b ) return byte is
return num[b]
end function
forever loop
d4 = bclear
d3 = bclear
d2 = bclear
d1 = _digit(5)
-- ones
portb = d1
porta = digit1
_usec_delay(delay)
-- tens
portb = d2
porta = digit2
_usec_delay(delay)
-- hundreds
portb = d3
porta = digit3
_usec_delay(delay)
-- thousands
portb = d4
porta = digit4
_usec_delay(delay)
end loop
When I test the other blanked digits they're not drawing anything (0.00uA). And it's not the individual digit, because I can get the same result on another digit by swapping the connection. I also swapped in a red display and got the same results.