førte matrix cascading

I

Ibaghdadi

Guest
hej
Jeg har en LED-matrix, der virker fint
Hvordan ville jeg cascade det, og vil dette behov for eventuelle ændringer i mit program

 
<img src="http://gallery.dpcdn.pl/imgc/News/54400/g_-_550x412_-_s_54400x20140515135643_0.jpg" alt="image" />Po latach walki z Samsungiem, pracownicy fabryki czipów w Korei Południowej doczekają się zadośćuczynienia. Firma zobowiązała się do wypłacenia rekompensaty wszystkim osobom, które w trakcie pracy w zakładzie zachorowały na raka i inne poważne choroby.



Kwon Oh-hyun, dyrektor naczelny Samsunga, poinformował, że firma nieprawidłowo oceniła sytuację swoich poważnie chorych pracowników oraz...<img src="http://feeds.feedburner.com/~r/dobreprogramy/Aktualnosci/~4/qTNXCcH7LSI" height="1" width="1"/>

Read more...
 
Ibaghdadi skrev:Hvordan ville jeg cascade det, og vil dette behov for eventuelle ændringer i mit program
 
hi;
godt om den hardware jeg bruger et skift register (hfe409bp4) en aktuel sinker (Toshiba uln280AG) og 8 PNP transistorer
Jeg får de oplysninger og uret fra mikrocontroller

koden er i c avr codevision compiler:[# define SETBIT (adresse, BIT) (ADRESSE | = (1 <<BIT))
# define CLEARBIT (adresse, BIT) (ADRESSE & = ~ (1 <<BIT))
# define CLOCK PORTB.0
# define DATA PORTB.1
# define STROBE PORTB.2
# include <mega16.h>
# include <delay.h>
# include <stdio.h>
/ / Declare din globale variabler her
int i, j, k, m, n, t = 0;
int timer1 = 0;
int timer2 = 0;
int A [8] [8] = ((0,0,0,0,0,0,0,0), (0,0,0,0,0,0,0,0), (0,0 , 0,1,1,0,0,0), (0,0,1,0,0,1,0,0), (0,0,1,0,0,1,0,0), (0,0,1,1,1,1,0,0), (0,0,1,0,0,1,0,0), (0,0,1,0,0,1,0 , 0));
int B [8] [8] = ((0,0,0,0,0,0,0,0), (0,0,1,1,1,0,0,0), (0,0 , 1,0,0,1,0,0), (0,0,1,0,0,1,0,0), (0,0,1,1,1,0,0,0), (0,0,1,0,0,1,0,0), (0,0,1,0,0,1,0,0), (0,0,1,1,1,0,0 , 0));
int E [8] [8] = ((0,0,0,0,0,0,0,0), (0,0,1,1,1,0,0,0), (0,0 , 1,0,0,0,0,0), (0,0,1,0,0,0,0,0), (0,0,1,1,1,0,0,0), (0,0,1,0,0,0,0,0), (0,0,1,0,0,0,0,0), (0,0,1,1,1,0,0 , 0));
int C [8] = (0x00, 0x38, 0x24, 0x24, 0x38, 0x24, 0x24, 0x38);
void setup_AVR ();
void swap (int * a, int * b);
void ur (int a);
void led_matrix_clear ();
void led_matrix_A ();
void led_matrix_AB ();
void led_matrix_B ();
void led_matrix_E ();
void led_matrix_C ();

void main (void)
(
# asm ( "sei")setup_AVR ();

while (1)
(
led_matrix_AB ();
);
)

void setup_AVR ()
(
PORTB = 0x00;
DDRB = 0xFF;
PORTC = 0x00;
DDRC = 0xFF;
DDRA = 0xFF;
)

void ur (int a)
(
for (i = 1; i <= a; i )
(
CLOCK = 1;
delay_us (1);
CLOCK = 0;
delay_us (1);
))void led_matrix_clear ()
(
PORTC = 0b00000000;
)
void led_matrix_A ()
(
if ( timer1 == 7)
(Timer1 = 0;
for (m = 0; m <8; m )
for (n = 0; n <7; n )
(
swap (& A [m] [n], & A [m] [(n 1)]);
)
)
for (k = 0; k <8; k )
(

SETBIT (PORTC, k);
STROBE = 1;
for (j = 0; j <8; j )
(
DATA = A [k] [j];
clock (1);
)
STROBE = 0;
delay_ms (1);

CLEARBIT (PORTC, k);
)

)
void led_matrix_B ()
(
for (m = 0; m <8; m )
for (n = 0; n <7; n )
(
swap (& B [m] [n], & B [m] [(n 1)]);
)
for (k = 0; k <8; k )
(
SETBIT (PORTC, k);
STROBE = 1;
for (j = 0; j <8; j )
(
DATA = B [k] [j];
clock (1);
)
STROBE = 0;
delay_ms (10);

CLEARBIT (PORTC, k);
)
)
void led_matrix_E ()
(
for (m = 0; m <8; m )
for (n = 0; n <7; n )
(
swap (& E [m] [n], & E [m] [(n 1)]);
)
for (k = 0; k <8; k )
(
SETBIT (PORTC, k);
STROBE = 1;
for (j = 0; j <8; j )
(
DATA = E [k] [j];
clock (1);
)
STROBE = 0;
delay_ms (10);

CLEARBIT (PORTC, k);
)
)
void swap (int * x, int * y)
(
int t;
t =* x;
* x =* y;
* y = t;
)
void led_matrix_AB ()
(
if ( timer1 == 10)
(Timer1 = 0; t ;
if (t ==

<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Kølig" border="0" />

(t = 0;)
for (m = 0; m <8; m )
(
for (n = 0; n <7; n )
(
swap (& A [m] [n], & A [m] [n 1]);

)
swap (& A [m] [n], & B [m] [t]);
)
)
for (k = 0; k <8; k )
(

SETBIT (PORTC, k);
STROBE = 1;
j = 0;
while (j <

<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Kølig" border="0" />(
DATA = A [k] [j];
clock (1);
j ;
)
STROBE = 0;
delay_ms (1);

CLEARBIT (PORTC, k);
)

)
void led_matrix_C ()
(

for (k = 0; k <8; k )
(

SETBIT (PORTC, k);

PORTA = C [k];

delay_ms (1);

CLEARBIT (PORTC, k);
)

)]
dette førte til en matrix nu, hvordan man cascad det til en anden [/ code]

 

Welcome to EDABoard.com

Sponsor

Back
Top