PDA

View Full Version : Alegro 6276 LED driver?



- 31st July 2007, 19:00
hi, can anyone help get me started with the A276? I'm using it to drive a 10 bar LED array.

I have the A6276 set up like this:

PIN:
1 (GND): Ground
2 (SDI): Serial Data input, PIC16F876 PORTC.0
3 (CLK): Serial clock input, PORTC.1
4 (LE) - Latch Enable, PORTC.2
5- 20 : connected to GND pins of LED bar
21 (OE) - Output Enable, PORTC.3
22 NA
23 (Rext) - 220 ohm to GND
+5 (Vdd): Logic Supply. 5v

Here's my current code:

controlBar:
'select the driver for Bar LED
HIGH outenable_6276
'set data
bits_6276 = 1023
LOW clock_6276
LOW latch_6276
'shift data out
SHIFTOUT data_6276, clock_6276, MSBFIRST, [bits_6276\10]
HIGH latch_6276
PAUSE 100
LOW outenable_6276
return

many thanks,
Tobie

Darrel Taylor
- 1st August 2007, 14:52
Hi Tobie,

5- 20 : connected to GND pins of LED bar

I assume that means the cathodes of a common anode LED bar?
If so OK.


23 (Rext) - 220 ohm to GND
Seems kind of low. That would give 80 ma constant current per LED.
Around 1K would be better. (20 ma)

The code looks like it should work. Assuming the parts you didn't include are OK.

What problem are you having?
Won't compile?
No display?
DIM, Too bright?
<br>

- 2nd August 2007, 00:25
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