16F88 hyperterminal

General discussion on mikroC.
Post Reply
Author
Message
man definitely
Posts: 2
Joined: 24 Feb 2010 15:22

16F88 hyperterminal

#1 Post by man definitely » 10 Apr 2010 13:28

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 * /

Code: Select all

void main (void)

{
int gauche=0;
char rec=0;
char codeRecu=0;
char code1=0b01100001;/*la lettre a allumé les diodes*/
char code2=0b01111010;/*la lettre z pour arreter les diodes */
OPTION_REG=0b00000111;
OSCCON    =0b01110010;/*8Mhz INTRC_IO*/
CMCON = 7;
ANSEL = 0;/*digital*/
TRISA = 0b00010000;
TRISB = 0b00110100;
rec=Soft_Uart_Init(PORTB, 2, 5, 9600, 0);
Delay_ms(100);
while (1)

{
PORTB = 0b00000000 ;
PORTA = 0b00000000 ;
codeRecu=Soft_Uart_Read(&rec);
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
}
Soft_Uart_Write(rec);
}

Post Reply

Return to “mikroC General”