E_KARVELAs
Joined: 14 Feb 2007 Posts: 46 Location: Greece & Cyprus
|
Dot matrix led 8x8 with 16f628 and 74hc595 |
Posted: Tue Feb 20, 2007 12:33 am |
|
|
HI
My name is Evagoras ''sorry for my bad English''
i make this routine for showing the message ''from Evagoras electronic enginiering''
well the circuit i make is working but the scrolling is going across the 74hc595.
i mean it is not goint through the 74hc138 as normaly it should be,but it's going through the 74hc595 as i'm puting the byte out...
This is a problem cus i can't put further 595 for more matrix.
i'm new to ccs c ,now learnig to college maybe i done something wrong with the code i came up!!!
it's simply so is no difficul to read...
i have two cuestions:
first: what i'm doing wrong with the scrolling code i realy need to fix this so i can put more 595 for suporting more matrix
second: im trying to make a rutine with statement (switch() case ) to search the characters and not puting then like the code i make ,so any opinion it woud be my pleasure to hear..
Code: | #include <16F628.h>
#fuses XT,NOWDT,NOPUT,NOBROWNOUT,NOMCLR,NOLVP
#use delay(clock=4000000)
#byte PORTB = 0x06
#byte PORTA = 0x05
#define DATA PIN_B4
#define LATCH PIN_B5
#define CLK PIN_B6
long counter=0x00, i,PLK=0X00;
long m=0x00, D=(0x00),pointer=0x00;
long adrs;
const byte DIG[]={
0x10,0x7e,0x90,0x80,0x40,0x00, // f
0x3e,0x10,0x20,0x20,0x10,0x00, // r
0x1c,0x22,0x22,0x22,0x1c,0x00, // o
0x3e,0x20,0x18,0x20,0x1e,0x00, // m
0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x92,0x92,0x92,0x82,0x00, // E
0x38,0x04,0x02,0x04,0x38,0x00, // v
0x04,0x2a,0x2a,0x2a,0x1e,0x00, // a
0x30,0x4a,0x4a,0x4a,0x7c,0x00, // g
0x1c,0x22,0x22,0x22,0x1c,0x00, // o
0x3e,0x10,0x20,0x20,0x10,0x00, // r
0x04,0x2a,0x2a,0x2a,0x1e,0x00, // a
0x12,0x2a,0x2a,0x2a,0x04,0x00, // s
0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x92,0x92,0x92,0x82,0x00, // E
0x00,0x82,0xfe,0x02,0x00,0x00, // l
0x1c,0x2a,0x2a,0x2a,0x18,0x00, // e
0x1c,0x22,0x22,0x22,0x04,0x00, // c
0x20,0xfc,0x22,0x02,0x04,0x00, // t
0x3e,0x10,0x20,0x20,0x10,0x00, // r
0x1c,0x22,0x22,0x22,0x1c,0x00, // o
0x3e,0x10,0x20,0x20,0x1e,0x00, // n
0x00,0x22,0xbe,0x02,0x00,0x00, // i
0x1c,0x22,0x22,0x22,0x04,0x00, // c
0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x92,0x92,0x92,0x82,0x00, // E
0x3e,0x10,0x20,0x20,0x1e,0x00, // n
0x30,0x4a,0x4a,0x4a,0x7c,0x00, // g
0x00,0x22,0xbe,0x02,0x00,0x00, // i
0x3e,0x10,0x20,0x20,0x1e,0x00, // n
0x00,0x22,0xbe,0x02,0x00,0x00, // i
0x1c,0x2a,0x2a,0x2a,0x18,0x00, // e
0x3e,0x10,0x20,0x20,0x10,0x00, // r
0x00,0x22,0xbe,0x02,0x00,0x00, // i
0x3e,0x10,0x20,0x20,0x1e,0x00, // n
0x30,0x4a,0x4a,0x4a,0x7c,0x00, // g
};
void output_74hc138() // void for switching the next arrow of 74hc138
{
set_tris_a(0x00);
PORTA=PLK;
++PLK;
if (PLK>0X07) {
PLK=0X00;
}
output_high(LATCH);
output_low(LATCH);
delay_us(2000); //give same time for show the row
}
void main() {
set_tris_b(0x00);
PORTB=(0x00);
PORTA=(0x00);
for(;;){
adrs = counter + pointer;
++counter;
if (counter>7){
counter=0;
++m;
if (m>4) { // m :how many time will be show the same frame
++pointer; // if the frame show 4 time then get next frame for show
m=0x00; // show next frame 4 time ,and again...
}
}
D=DIG[adrs]; //register wich is going to 74hc595
for(i=0;i<8;++i) { // Clock out bits from the eo array
if ((D & 0x80)==0) //
output_low(DATA); //
else // GETING THE DATA READY TO 74HC595
output_high(DATA); //
D=D<<1; //
output_high(CLK); //CLOCK THE 74HC595
output_low(CLK); //
}
void output_74hc138(); // SWITCH THE NEXT ROW ON OF 74HC138
if (adrs>203) { // if adrs is at the end of the
//table start from the begining again
adrs=(0x00); //
} //
}
} |
_________________ ---- GREECE ----
Last edited by E_KARVELAs on Tue Feb 20, 2007 1:59 am; edited 4 times in total |
|