View previous topic :: View next topic |
Author |
Message |
Sparta
Joined: 22 Oct 2009 Posts: 6
|
LED driver(mm5450YN) |
Posted: Thu Oct 22, 2009 5:34 am |
|
|
hi, anyone know how to write the program to control the led driver (mm5450YN)? really need the help for eugent. thanks... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Thu Oct 22, 2009 6:56 am |
|
|
Why don't you try it yourself?
Looking at the datasheet, controlling the chip is pretty straightforward. It requires three pins, CLOCK DATA and ENABLE.
Set CLOCK and DATA low, then set ENABLE low. Set DATA high, delay 500ns (300ns min) then take the CLOCK high and back low. Leave ENABLE low from this point on. This is the START bit.
For the second CLOCK (first DATA bit) set the DATA line high or low depending on what you want to appear on Pin 18, delay 500ns then take the CLOCK high and back low.
For the third CLOCK (second DATA bit) set the DATA line high or low depending on what you want to appear on Pin 17, delay 500ns then take the clock high and back low.
The fourth DATA bit will appear on pin 16.
The fifth DATA bit will appear on pin 15 etc.
Generate 30 more CLOCKs with DATA bits for a total of 35.
When you clock the 35th DATA bit into the chip it will automatically perform a LOAD to transfer the bits to the outputs. Set ENABLE back high after completing the 35th bit transfer.
That's it! The biggest part will be keeping track of the bits _________________ Google and Forum Search are some of your best tools!!!! |
|
|
Sparta
Joined: 22 Oct 2009 Posts: 6
|
LED driver(mm5450YN) |
Posted: Sun Oct 25, 2009 4:38 am |
|
|
Is that correct program to control the LED driver? Anyone can help me?
Code: |
#include<pic.h>
__CONFIG(0x3f3a);
void delay();
void init();
void led();
void main()
{
init();
led();
}
//..........................
//delay function
void delay()
{
int i;
for(i=5000;i>0;i--)
{
NOP();
NOP();
}
}
//..........................
//initialize function
void init()
{
TRISB=0x00;
PORTB=0x00;
}
//..........................
//light lamp function
void led()
{
char index,index2;
while(1)
{
RB0=0;
delay();
RB1=1,RB1=0;
delay();
RB0=1;
delay();
RB1=1,RB1=0;
delay();
for(index=0;index<34;index++)
{
RB0=1;
delay();
RB1=1,RB1=0;
delay();
}
}
} |
|
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Sun Oct 25, 2009 5:45 am |
|
|
Sparta, you're not using CCS... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Sun Oct 25, 2009 1:00 pm |
|
|
Sparta,
It appears you are using Hi-Tech C and you need to go to the Hi-Tech forum for help.
http://forum.htsoft.com/all/categories.php
CCS and Hi-Tech code are not compatible. Hi-Tech code will not compile in CCS. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|