Hello all,
I've been working on a project that involves getting several RGB leds to light up systematically. After some searching I found the 5940 and decided it was the best bet for the job I had. I'm using a Silicon Labs 8051 microcontroller board as the brains of the operation since I had it left over from a school project some time ago and it can handle several outputs at the same time, as well as leaving the serial ports open for me so I can control it via bluetooth.
However, after about two weeks, I am still unable to get the LEDs to turn on reliably. The GSCLK signal threw me for a loop for a while, but made sense once I finally figured it out. Once I got it, I wrote a simple assembly test program to try and turn the leds on and off, but it simply isn't doing the job. Could the wonderful experts and kind members of this forum help me figure out what in the world I'm doing wrong?
Note: I use port 4 because it is push-pull, as opposed to ports 0-3 which are open-drain.
$include (C8051F020.inc)
mov WDTCN,#0DEh ;Disable Watchdog
mov WDTCN,#0ADh
mov EMI0CF,#02Bh ;Set the upper ports for the EMI
mov P74OUT,#0FFh ;Ports 4-7 are push-pull
mov XBR2,#040h ;Enable Crossbar
mov EMI0TC,#04Dh ;EMI timing
mov OSCICN, #007h ;Internal Oscillator is 16 MHz
;sin - p4.0
;sclk - p4.1
;xlat - p4.2
;blank - p4.3
;gsclk - p4.4
;vprg - GND
;dcprg - GND
;IREF - 2K ohm
mov P4, #008h; blank
repeat:
mov P4, #010h; gsclk pulse
mov P4, #000h
mov R0, #00Ch; 12 dec
fill1:
mov P4, #012h; fill the registers with zeros
mov P4, #002h
mov P4, #010h; gsclk pulse
mov P4, #000h
djnz R0, fill1; repeat this 12 times
mov P4, #008h; blank
mov P4, #00Ch; blank and xlat
mov P4, #008h; blank
;------------------------------------------
mov R0, #00Ch; 12 dec
fill2:
mov P4, #013h; fill the registers with ones
mov P4, #003h
mov P4, #011h; gsclk pulse
mov P4, #001h
djnz R0, fill2; repeat 12 times
mov P4, #008h; blank
mov P4, #00Ch; blank and xlat
mov P4, #008h; blank
call repeat
end
Thanks for looking! I appreciate any efforts you may put into this!