Partly fixed.
I was using 3 red, green and yellow LEDs; they have wildly different current draw/voltage drops. I switched to all greens and the ghosting effect is practically gone.
I saw your comments about ghosting and noticed you output PORT before TRIS, didn't help me; tried both ways.
Robert
EDIT:
Code:
asm
__config _HS_OSC & _WDT_OFF & _PWRTE_OFF & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF
endasm
DEFINE OSC 20
ADCON1 = 7 ' Set Ports to digital
TRISA = %00000000 ' Set all Ports to output
TRISB = %00000000
TRISC = %00000000
TRISD = %00000000
TRISE = %00000000
PORTA = %00000000 ' Set ports OFF
PORTB = %00000000
PORTC = %00000000
PORTD = %00000000
PORTE = %00000000
pause 100
mainloop:
TRISD = %11111001 ' Enable pins D.1 and 2
PORTD = %00000100 ' Turn ON pin D.2 --> D.1
pause 500
TRISD = %11111001 ' Enable pins D.1 and 2
PORTD = %00000010 ' Turn ON pin D.1 --> D.2
pause 500
TRISD = %11110101 ' Enable pins D.1 and 3
PORTD = %00001000 ' Turn ON pin D.3 --> D.1
pause 500
TRISD = %11110101 ' Enable pins D.1 and 3
PORTD = %00000010 ' Turn ON pin D.1 --> D.3
pause 500
TRISD = %11110011 ' Enable pins D.2 and 3
PORTD = %00000100 ' Turn ON pin D.2 --> D.3
pause 500
TRISD = %11110011 ' Enable pins D.2 and 3
PORTD = %00001000 ' Turn ON pin D.3 --> D.2
pause 500
TRISD = %11111111 ' All pins disabled
pause 500
goto mainloop
End
Bookmarks