hi Darrel,

thanks for your message, i have things working now, also with some help from Michael DelGaudio who sent some arduino code.

I had MANY problems with my approach, icluding the 2 things you mentioned!

1st was, as you mentioned, the 6276 acts as a sink, meaning it takes the cathode, or ground pins of the LED array (in my case an LedTech LL10000, a 10 bar display). I'm also using some kingbright LEDs and these have a common cathode, so I learnt that I need to get the common anode version if I want to drive them with the 6276.

Also from your point I realised a 220 ohm resistor on the 6276 meant each LED drew too much current. This maxed out my power supply, and amongst other things caused the PIC to reset - this was a horrible mess.

Anyway, things are working now, many thanks.

code below for PIC16F876 driving 2 x 6276

bests,
Tobie


'Testing 2 Allegro 6276 drivers, each driving a 10 bar LED array
'Tobie Kerridge for HHH, with thanks to from Michael DelGaudio for initial code

DEFINE LOADER_USED 1 'enable bootloader
DEFINE osc 20 'XTAL frequency

'pin definitions
data_6276 VAR PORTC.0 ' Data to 6276 driver from PIC
clock_6276 VAR PORTC.1 ' Clock for 6276 driver
latch_6276 VAR PORTC.2 ' Latch enable for 6276
enable1_6276 VAR PORTC.3 ' Chip select 6276 driver for LED bar 1
enable2_6276 VAR PORTC.4 ' Chip select 6276 driver for LED bar 2
LEDdebug VAR PORTC.5

'varibles
bits_6276 VAR WORD
loopInt VAR BYTE

'---------------------INIT-------------------

init:
'disable LED drivers
HIGH enable1_6276
HIGH enable2_6276
HIGH LEDdebug
Pause 1000
LOW LEDdebug
goto debugLoop

'---------------------LOOP-------------------

debugLoop:
GOSUB controlBar
PAUSE 1000
GOTO debugLoop

controlBar:
'enable both drivers
LOW enable1_6276 'select the driver for Bar LED
LOW enable2_6276 'select the driver for Bar LED

'drive 1 through to 10 bars
for loopInt = 0 to 9
'takes a value from a table to create LED bar pattern
LOOKUP2 loopInt, [1,3,7,15,31,63,127,255,511,1023], bits_6276
LOW clock_6276
LOW latch_6276
'shift data out
SHIFTOUT data_6276, clock_6276, MSBFIRST, [bits_6276\10]
HIGH latch_6276
PAUSE 100
next loopInt

' disable all bars then disable drivers
bits_6276 = 0
SHIFTOUT data_6276, clock_6276, MSBFIRST, [bits_6276\10]
HIGH enable1_6276
HIGH enable2_6276
return