De uma olhada neste video
http://br.youtube.com/watch?v=NS6-T3bGNd4
obs: a única diferença é que o cavalo esta andando no video, neste código deixei o bixinho "patinando"..rs
abraço a todos
Simplicio
/*********************** Animação de Display LCD ************************
Centro de Tecnologia Microgenios
Programa: Animação LCD
Compilador: MikroC
Cristal: 8Mhz
Microcontrolador: PIC18F452
Objetivo: enviar para o display LCD o valor da variável contador
http://br.youtube.com/watch?v=NS6-T3bGNd4
*************************************************************************/
//1º caracterer************
const char character1[] = { 32 , 32 , 32 , 32 , 3 , 7 , 14 , 14};
const char character2[] = { 32 , 32 , 32 , 32 , 15 , 31 , 31 , 31};
const char character3[] = { 32 , 32 , 32 , 32 , 3 , 31 , 31 , 31};
const char character4[] = { 32 , 1 , 31 , 31 , 31 , 27 , 19 , 16};
const char character5[] = { 12 , 24 , 16 , 1 , 1 , 1 , 32 , 32};
const char character6[] = { 31 , 31 , 30 , 23 , 32 , 32 , 16 , 32};
const char character7[] = { 31 , 31 , 1 , 1 , 1 , 1 , 32 , 32};
const char character8[] = { 28 , 28 , 4 , 4 , 8 , 32 , 32 , 32};
const char character1a[] = { 32 , 32 , 32 , 32 , 32 , 7 , 15 , 30};
const char character2a[] = { 32 , 32 , 32 , 32 , 14 , 31 , 31 , 31};
const char character3a[] = { 32 , 32 , 32 , 32 , 7 , 31 , 31 , 31};
const char character4a[] = { 32 , 2 , 31 , 31 , 31 , 27 , 19 , 16};
const char character5a[] = { 16 , 32 , 32 , 1 , 1 , 1 , 32 , 32};
const char character6a[] = { 31 , 31 , 27 , 18 , 1 , 1 , 17 , 32};
const char character7a[] = { 31 , 31 , 1 , 1 , 1 , 1 , 32 , 32};
const char character8a[] = { 24 , 28 , 4 , 8 , 16 , 32 , 16 , 32};
const char character1b[] = { 32 , 32 , 32 , 7 , 15 , 14 , 28 , 24};
const char character2b[] = { 32 , 32 , 32 , 15 , 31 , 31 , 31 , 3};
const char character3b[] = { 32 , 32 , 32 , 3 , 31 , 31 , 31 , 31};
const char character4b[] = { 1 , 31 , 31 , 31 , 27 , 27 , 16 , 16};
const char character5b[] = { 19 , 19 , 2 , 2 , 4 , 32 , 32 , 32};
const char character6b[] = { 31 , 7 , 14 , 6 , 1 , 32 , 32 , 32};
const char character7b[] = { 15 , 7 , 19 , 15 , 32 , 16 , 32 , 32};
const char character8b[] = { 16 , 24 , 12 , 4 , 2 , 1 , 32 , 32};
void escreve(char pos_row, char pos_char, char pos_row1, char pos_char1,char num) {
char i;
if (num == 1){
LCD8_Cmd(64);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character1[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character2[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character3[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character4[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character5[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character6[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character7[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character8[i]);
LCD8_Cmd(LCD_RETURN_HOME);
lcd8_chr(pos_row, pos_char, 0);
LCD8_Chr_cp(1);
LCD8_Chr_cp(2);
LCD8_Chr_cp(3);
lcd8_chr(pos_row1, pos_char1, 4);
LCD8_Chr_cp(5);
LCD8_Chr_cp(6);
LCD8_Chr_cp(7);
}
if (num == 2){
LCD8_Cmd(64);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character1a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character2a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character3a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character4a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character5a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character6a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character7a[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character8a[i]);
LCD8_Cmd(LCD_RETURN_HOME);
lcd8_chr(pos_row, pos_char, 0);
LCD8_Chr_cp(1);
LCD8_Chr_cp(2);
LCD8_Chr_cp(3);
lcd8_chr(pos_row1, pos_char1, 4);
LCD8_Chr_cp(5);
LCD8_Chr_cp(6);
LCD8_Chr_cp(7);
}
if (num == 3){
LCD8_Cmd(64);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character1b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character2b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character3b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character4b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character5b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character6b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character7b[i]);
for (i = 0; i<=7; i++) LCD8_Chr_Cp(character8b[i]);
LCD8_Cmd(LCD_RETURN_HOME);
lcd8_chr(pos_row, pos_char, 0);
LCD8_Chr_cp(1);
LCD8_Chr_cp(2);
LCD8_Chr_cp(3);
lcd8_chr(pos_row1, pos_char1, 4);
LCD8_Chr_cp(5);
LCD8_Chr_cp(6);
LCD8_Chr_cp(7);
}
}
void main() {
unsigned char contador = 100;
unsigned char texto[10];
trisd = 0; //configura todos os pinos do portd como saída
trise = 0; //configura todos os pinos do porte como saida
ADCON1 = 0x06; //configura todos os pinos de A/D como I/O de uso geral
lcd8_config(&porte, &portd,2,1,4,7,6,5,4,3,2,1,0); //
lcd8_cmd(lcd_clear); //apaga display LCD
lcd8_cmd(lcd_cursor_off); //desliga cursor
while(1){
escreve (1,1,2,1,3);
delay_ms(100);
escreve (1,1,2,1,2);
delay_ms(100);
escreve (1,1,2,1,1);
delay_ms(100);
}
}