pietro10
Junior Member level 1
hello
PIC16F88 beams max 232 mikroC windows XP hyperterminal
the code below to make a serial peak with Hyperterminal
LED blink red if I pressed the letter 'a' keyboard
and to extinguish the letter 'z'
but typed letters 'a' or 'z' on the keyboard has no effect
/ * PB0 PB7 out in order the two transistor 2N222A * /
/ * PA0, PA1, PA7, PA6 out in order both ULN2803A * /
/ * PA4 PB4 enter into left stop right * /
/ * PA2 out in order to control the transistor bridge voltage divider * /
/ * PA3 come in to verify the intention bridge voltage divider * /
/ * PB2 in PB5 enter to USART * /
/ * The letter a = 01100001 = 01111010 the letter z * /
void main (void)
{
int gauche=0;
char codeRecu;
char code1=0b01100001;
char code2=0b01111010;
OPTION_REG = 0b00000111;
OSCCON = 0b01100010;
ANSEL = 0;
CMCON = 0x07;
TRISA = 0b00010000;
TRISB = 0b00110100;
Usart_Init (9600);
Delay_ms(100);
while (1)
{
PORTB = 0b00000000 ;
PORTA = 0b00000000 ;
if (USART_Data_Ready())
{
codeRecu=USART_Read();
}
if (codeRecu==code1)
{
gauche=1;
}
else if (codeRecu==code2)
{
gauche=0;
}
if(gauche)/*diodes allumé*/
{
PORTB = 0b10000001 ;// bit7 AND bit0 5VDC
PORTA = 0b01000001 ;// Bit6 AND bit0 5VDC
delay_ms (1000) ;// Tempo
PORTA = 0b10000010 ;// bit7 AND Bit1 5VDC
delay_ms (100) ;// Tempo
}
}
}
PIC16F88 beams max 232 mikroC windows XP hyperterminal
the code below to make a serial peak with Hyperterminal
LED blink red if I pressed the letter 'a' keyboard
and to extinguish the letter 'z'
but typed letters 'a' or 'z' on the keyboard has no effect
/ * PB0 PB7 out in order the two transistor 2N222A * /
/ * PA0, PA1, PA7, PA6 out in order both ULN2803A * /
/ * PA4 PB4 enter into left stop right * /
/ * PA2 out in order to control the transistor bridge voltage divider * /
/ * PA3 come in to verify the intention bridge voltage divider * /
/ * PB2 in PB5 enter to USART * /
/ * The letter a = 01100001 = 01111010 the letter z * /
void main (void)
{
int gauche=0;
char codeRecu;
char code1=0b01100001;
char code2=0b01111010;
OPTION_REG = 0b00000111;
OSCCON = 0b01100010;
ANSEL = 0;
CMCON = 0x07;
TRISA = 0b00010000;
TRISB = 0b00110100;
Usart_Init (9600);
Delay_ms(100);
while (1)
{
PORTB = 0b00000000 ;
PORTA = 0b00000000 ;
if (USART_Data_Ready())
{
codeRecu=USART_Read();
}
if (codeRecu==code1)
{
gauche=1;
}
else if (codeRecu==code2)
{
gauche=0;
}
if(gauche)/*diodes allumé*/
{
PORTB = 0b10000001 ;// bit7 AND bit0 5VDC
PORTA = 0b01000001 ;// Bit6 AND bit0 5VDC
delay_ms (1000) ;// Tempo
PORTA = 0b10000010 ;// bit7 AND Bit1 5VDC
delay_ms (100) ;// Tempo
}
}
}
Code: