How can i send blinking led command to STP16CP05 ?

Status
Not open for further replies.

vedo35

Newbie level 4
Joined
Sep 18, 2009
Messages
6
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,283
Location
netherlands
Visit site
Activity points
1,318
Hi friends since long time i was busy with STP16CP05 led driver ic. Its a serial in led driver with 16 bit output. I made myself development board for learning. Codes work ok but now next step project is to make blinking leds or some leds are blinking some are continious burning. which codes i need? and to which line i have to put that code?

My example code:


#include <16F877.h>
#FUSES NOWDT
#FUSES NOCPD
#FUSES NOBROWNOUT
#FUSES XT
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
/////////////////////////////////////////////////////////////////////////////////
#define SDI PIN_C0
#define CLK PIN_C1
#define LE PIN_C2
int i, data;

void counting()
{
output_low(SDI);
for (i=0; i<data; ++i)
{
output_low(CLK);
delay_ms(100);
output_high(CLK);
delay_ms(100);
}
printf("%2x", data);
}
void Send16Bit(unsigned int16 data16bit )
{
unsigned int16 i;
for(i=0x8000;i>0;i>>=1)
{
if(i&data16bit)output_high(SDI);
else output_low(SDI);
output_high(CLK);
delay_us(1);
output_low(CLK);
}
output_high(LE);
delay_us(5);
output_low(LE);

}
unsigned int16 led_data;

void Main()
{
output_high(SDI);
delay_ms(100);
output_high(CLK);
delay_ms(100);
output_low(CLK);
while(true)
{
led_data = 0x80BF;

Send16Bit(led_data );
if(kbhit())
{
data=getc();
counting();

}
}
}
 

Control OE/DM2 with another pin of uC. After sending 16 bits of data and then doing a high and low on LE pin make OE pin low and then high. Keep CLK, SDI, OE pins pulled high.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…