lcd_init();
sprintf(buf
, "\f Libreria LCD-C32\n ================\n"); SendLCDBuffer(buf);
SendLCDBuffer("Adaptada de FlexLCD\n www.micropic.es");
while (!mtouch_estado(6)); // espera pulsación tecla OK
SendLCDBuffer("\f");
j=0;
while (1) {
#if defined(USB_POLLING)
// Check bus status and service USB interrupts.
USBDeviceTasks(); // Interrupt or polling method. If using polling, must call
// this function periodically. This function will take care
// of processing and responding to SETUP transactions
// (such as during the enumeration process when you first
// plug in). USB hosts require that USB devices should accept
// and process SETUP packets in a timely fashion. Therefore,
// when using polling, this function should be called
// regularly (such as once every 1.8ms or faster** [see
// inline code comments in usb_device.c for explanation when
// "or faster" applies]) In most cases, the USBDeviceTasks()
// function does not take very long to execute (ex: <100
// instruction cycles) before it returns.
#endif
// Application-specific tasks.
// Application related code may be added here, or in the ProcessIO() function.
ProcessIO();
sprintf(buf
, "Temp: %3.1f", ds1629_temperatura
()); SendDataBuffer
(UART_RS232
, buf
, strlen(buf
)); lcd_gotoxy(1,1);
SendLCDBuffer
(buf
, strlen(buf
));
ds1629_get_date(&dia,&mes,&ano,&diasem);
ds1629_get_time(&hora,&minuto,&segundo);
sprintf(buf
, "%02u/%02u/%02u %02u:%02u:%02u ",dia
,mes
,ano
,hora
,minuto
,segundo
);
SendDataBuffer
(UART_RS232
, buf
, strlen(buf
)); lcd_gotoxy(1,2);
SendLCDBuffer
(buf
, strlen(buf
));
sprintf(buf
, "1-3: %4X %4X %4X", mtouch_estado
(1),mtouch_estado
(2),mtouch_estado
(3)); lcd_gotoxy(1,3);
SendLCDBuffer(buf);
sprintf(buf
, "4-5: %4X %4X %4X", mtouch_estado
(4),mtouch_estado
(5),mtouch_estado
(6)); lcd_gotoxy(1,4);
SendLCDBuffer(buf);
delay_ms(100);
if (mtouch_estado(6))
break;
SendLCDBuffer("\f");
x=1;
y=1;
while (1) {
lcd_gotoxy(x,y);
SendLCDBuffer(buf);
HaPulsado=0;
lcd_gotoxy(x,y);
if (mtouch_estado(1)) {
y--;
if (y==0) y=1;
HaPulsado=1;
}
if (mtouch_estado(5)) {
y++;
if (y==5) y=4;
HaPulsado=1;
}
if (mtouch_estado(2)) {
x--;
if (x==0) x=1;
HaPulsado=1;
}
if (mtouch_estado(4)) {
x++;
if (x==21) x=20;
HaPulsado=1;
}
if (HaPulsado) {
delay_ms(250);
SendLCDBuffer(" ");
}
};