« Affichage avr lcd » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 32 : | Ligne 32 : | ||
const uint8_t lcdanimation[] PROGMEM="--_--\0"; | const uint8_t lcdanimation[] PROGMEM="--_--\0"; | ||
const uint8_t msg1[] PROGMEM="HakBBS, plateforme\0"; | const uint8_t msg1[] PROGMEM="HakBBS, plateforme \0"; | ||
const uint8_t msg2[] PROGMEM="de Hacking en\0"; | const uint8_t msg2[] PROGMEM=" de Hacking en \0"; | ||
const uint8_t msg3[] PROGMEM="conditions reelles!!!\0"; | const uint8_t msg3[] PROGMEM=" conditions reelles!!! \0"; | ||
// custom LCD characters | // custom LCD characters | ||
Ligne 81 : | Ligne 81 : | ||
{ | { | ||
int delay= | int delay=300; | ||
LCDclr(); | LCDclr(); | ||
CopyStringtoLCD(msg1, 0, | CopyStringtoLCD(msg1, 0, 0); | ||
for(uint8_t i=0;i< | for(uint8_t i=0;i<20;i++) | ||
{ | { | ||
Ligne 100 : | Ligne 100 : | ||
} | } | ||
CopyStringtoLCD(msg2, 0, 1); | LCDclr(); | ||
CopyStringtoLCD(msg2, 0, 1); | |||
for(uint8_t i=0;i< | for(uint8_t i=0;i<20;i++) | ||
{ | { | ||
Ligne 115 : | Ligne 116 : | ||
} | } | ||
CopyStringtoLCD(msg3, 0, | LCDclr(); | ||
CopyStringtoLCD(msg3, 0, 0); | |||
for(uint8_t i=0;i< | for(uint8_t i=0;i<20;i++) | ||
{ | { |
Dernière version du 17 avril 2010 à 01:58
//------------Main program------------
- include <avr/io.h>
- include <avr/pgmspace.h>
- include <util/delay.h>
- include "lcd_lib.h"
//Strings stored in AVR Flash memory
const uint8_t hackbbs[] PROGMEM="HackBBS\0";
const uint8_t curhome[] PROGMEM="Fireworks\0";
const uint8_t customsymbol1[] PROGMEM="ça rox\0";
const uint8_t customsymbol2[] PROGMEM="$\\o/$\0";
const uint8_t customsymbolout[] PROGMEM="Output symbol\0";
const uint8_t shift[] PROGMEM="Korigan\0";
const uint8_t shiftdemo[] PROGMEM="@->--\0";
const uint8_t lcdblank[] PROGMEM="HackBattleBombShot\0";
const uint8_t lcdanimation[] PROGMEM="--_--\0";
const uint8_t msg1[] PROGMEM="HakBBS, plateforme \0"; const uint8_t msg2[] PROGMEM=" de Hacking en \0"; const uint8_t msg3[] PROGMEM=" conditions reelles!!! \0";
// custom LCD characters
const uint8_t backslash[] PROGMEM=
{
0b00000000,//back slash
0b00010000,
0b00001000,
0b00000100,
0b00000010,
0b00000001,
0b00000000,
0b00000000
};
//delay 1s
void delay1s(void)
{
uint8_t i;
for(i=0;i<100;i++)
{
_delay_ms(10);
}
} void WelcomeHackBBS(void)
{
int delay=300;
LCDclr();
CopyStringtoLCD(msg1, 0, 0);
for(uint8_t i=0;i<20;i++)
{
//delay1s(); _delay_ms(delay); LCDshiftRight(1);
//delay1s();
//LCDshiftRight(1);
}
LCDclr();
CopyStringtoLCD(msg2, 0, 1);
for(uint8_t i=0;i<20;i++)
{
//delay1s(); _delay_ms(delay); LCDshiftRight(1);
//delay1s();
//LCDshiftRight(1);
}
LCDclr();
CopyStringtoLCD(msg3, 0, 0);
for(uint8_t i=0;i<20;i++)
{
//delay1s(); _delay_ms(delay); LCDshiftRight(1);
//delay1s();
//LCDshiftRight(1);
}
}
//demonstration of shift
void demoshift(void)
{
LCDclr();
CopyStringtoLCD(shift, 3, 0);
delay1s();
CopyStringtoLCD(hackbbs, 3, 1);
for(uint8_t i=0;i<5;i++)
{
delay1s();
LCDshiftLeft(1);
delay1s();
LCDshiftRight(1);
}
}
//demostration of blank
void demolcdblank(void)
{
LCDclr();
CopyStringtoLCD(lcdblank, 0, 0);
for(uint8_t i=0;i<5;i++)
{
LCDblank();
delay1s();
LCDvisible();
delay1s();
}
}
//demonstration of animation
void demoanimation(void)
{
LCDclr();
CopyStringtoLCD(customsymbol1, 0, 0);
CopyStringtoLCD(customsymbol2, 0, 1);
delay1s();
LCDdefinechar(backslash,0);
LCDclr();
CopyStringtoLCD(customsymbolout, 0, 0);
LCDGotoXY(8, 1);
LCDsendChar(0);
delay1s();
LCDclr();
CopyStringtoLCD(lcdanimation, 0, 0);
for(uint8_t i=0;i<3;i++)
{
LCDGotoXY(8, 1);
LCDsendChar(0);
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('-');
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('/');
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('|');
delay1s();
LCDGotoXY(8, 1);
LCDsendChar(0);
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('-');
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('/');
delay1s();
LCDGotoXY(8, 1);
LCDsendChar('|');
delay1s();
}
}
int main(void)
{
LCDinit();//init LCD 8 bit, dual line, cursor right
LCDclr();//clears LCD
CopyStringtoLCD(curhome, 1, 0);//Cursor home and display message
delay1s();
LCDclr();//clears LCD
LCDhome();//cursonr home
while(1)//loop demos
{
WelcomeHackBBS();
//demoshift();
//demolcdblank();
//demoanimation();
}
return 0;
}
//-----------end of main program----------