پروژه های ramin.yousefi2@gmail.com AVR,ARM,PIC,8051

لطفا ایمیل بزنید

راه اندازی ماتریس 8*8
 

 

در این پروژه بعد از اجرا، یک سری اشکال و حروف پشت سر هم به نمایش در می آیند.

برنامه در ادامه مطلب ....


#include <lpc213x.h>
void msDelay(unsigned short DelayTime);
unsigned int speed=500;
unsigned char Locate;
unsigned char R_data[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char A1_alephba[][8]={
{0X00,0X66,0XFF,0XFF,0XFF,0X7E,0X3C,0X18}, // LOVE !
{0XC3,0XE7,0XFF,0XDB,0XC3,0XC3,0XC3,0XC3}, // M Locate in array = 1 #### MY STYLE!
{0X18,0X3C,0X66,0X66,0X7E,0X66,0X66,0X00}, // A Locate in array = 2
{0XC3,0XC3,0XC3,0XFF,0XFF,0XC3,0XC3,0XC3}, // H Locate in array = 3
{0XFC,0XFE,0X06,0X7E,0XFC,0XC0,0XFE,0X7E}, // S Locate in array = 4
{0X18,0X3C,0X66,0X66,0X7E,0X66,0X66,0X00}, // A Locate in array = 5
};
void refresh(){
unsigned char i,d;
unsigned int sp;
sp=speed/16; if(sp<=0) sp=1;
for(d=0; d<sp; d++){ //delay loop
for(i=0; i<8; i++){
IOCLR0 = 0xFF;
IOSET0=R_data[i]; // Jaroob
IOCLR0 = 0xFF00;
IOSET0=(~A1_alephba[Locate][i])<<8; // Value
msDelay(1);
}
}
}
int main (void)
{
 
// Pin0.0 to Pin0.15 Output Matrix
IODIR0 = 0xFFFF;
IOCLR0 = 0xFFFF;
while(1){
 
for(Locate=0;Locate<6;Locate++) {
refresh();
msDelay(1);
}
}
 
}
//-------------------------------------------------- Delay
void msDelay(unsigned short DelayTime)
{
unsigned short time=0,delay=0;
for( delay=0 ; delay<DelayTime ; delay++)
for( time=0 ; time <6666 ; time++ );
}