Private Sub botonrojo_Click()
If Sharojo.Visible = False Then
Sharojo.Visible = True
Pserie1.PortOpen = True
Pserie1.Output = "a" & Chr(13)
Pserie1.PortOpen = False
Else
Sharojo.Visible = False
Pserie1.PortOpen = True
Pserie1.Output = "b" & Chr(13)
Pserie1.PortOpen = False
End If
include <16f876a.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP,PUT,BROWNOUT
#use delay(clock=4000000)
#use standard_io(b)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#define LCD_DB4 PIN_B4
#define LCD_DB5 PIN_B5
#define LCD_DB6 PIN_B6
#define LCD_DB7 PIN_B7
#define LCD_RS PIN_C0
#define LCD_RW PIN_C1
#define LCD_E PIN_C2
#include "flex_lcd.c"
char Keypress=' ';
#int_rda
void serial_isr() {
Keypress=0x00;
if(kbhit()){
Keypress=getc();
}
}
void main() {
enable_interrupts(global);
enable_interrupts(int_rda);
printf("\r\n\LCD driver monitor\r\n");
lcd_init();
do {
if(Keypress!=0x00){
lcd_putc(Keypress);
putc(Keypress);
Keypress=0x00;
}
} while (TRUE);
}
#int_rdavoid serial_isr() {
Keypress=0x00;
if(kbhit()){
Keypress=getc();
output_toggle(PIN_B0);
}
}
#int_rdavoid serial_isr() {
Keypress=0x00;
if(kbhit()){
Keypress=getc();
if(Keypress=='1'){
output_toggle(PIN_B0);
}
}
}
#include <18f4550.h> // PIC que se va a utilizar
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL3,CPUDIV1,VREGEN //Ordenes para el programador
#use delay(clock=12000000) //fosc= 12 Mhz
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
// Asignacion del pineado de LCD 16X2, 16 caracteres por linea
// Usando una interfaz de 4 bits
// Uso una LCD con el controlador HD44780
//#define LCD_DB4 PIN_b4 //Bus datos
//#define LCD_DB5 PIN_b5 //Bus datos
//#define LCD_DB6 PIN_b6 //Bus datos
//#define LCD_DB7 PIN_b7 //Bus datos
//#define LCD_RS PIN_b2 //Seleccion de registro
//#define LCD_RW PIN_b3 //Lectura/Escritura
//#define LCD_E PIN_b1 //Enable "Activacion"
//#include "flex_lcd.c" //libreria manejo lcd
char Keypress=' ';
#int_rda
void serial_isr() {
Keypress=0x00;
if(kbhit()){
Keypress=getc();
if(Keypress=='3'){ output_toggle(PIN_B0);
}
}
}
void main() {
char Text[]="\fLCD Test\n";
enable_interrupts(global);
enable_interrupts(int_rda);
printf("\r\n\LCD driver monitor\r\n");
// lcd_init();
delay_ms(1000);
//lcd_putc("Hola"); // Saca algo por el LCD
//lcd_gotoxy(0,2);
do {
if(Keypress!=0x00)
{
putc(Keypress);
//lcd_putc(Keypress);
Keypress=0x00;
}
} while (TRUE);
}
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL3,CPUDIV1,VREGEN