7
Robotics O TO 9 COUNTER USING IC555 Serial Port communication with PIC Microcontroller On December 2, 2011, in Microcontroller Projects , PIC Projects , Projects , by karthik Most of the time, the system we develop need to be connected with the computer to transfer the data, because memory present in Microcontroller has limited capacity. In this project PIC Microcontroller will communicate with Computer thro’ UART protocol. Block diagram: PARTS Needed: 1.PIC16F877 2.DB9 CABLE 3.MAX232 1.PIC16F877 Pic16f877 is used to communicate with PC.

Roboticso to 9 Counter Using Ic555

Embed Size (px)

Citation preview

Page 1: Roboticso to 9 Counter Using Ic555

Robotics O TO 9 COUNTER USING IC555

Serial Port communication with PIC Microcontroller On December 2, 2011, in Microcontroller Projects, PIC Projects, Projects, by karthik

Most of the time, the system we develop need to be connected with the computer to transfer the data, because memory present in Microcontroller has limited capacity. In this project PIC Microcontroller will communicate with Computer thro’ UART protocol.

Block diagram:

PARTS Needed:1.PIC16F8772.DB9 CABLE3.MAX2321.PIC16F877Pic16f877 is used to communicate with PC.

Page 2: Roboticso to 9 Counter Using Ic555

2.DB9 CABLE

3.MAX232MAX 232 is for communication between a controller and pc

Page 3: Roboticso to 9 Counter Using Ic555

How it works:Most of the time, the system we develop need to be connected with the computer to transfer the data, because memory present in Microcontrollerhas limited capacity.  In this project PIC Microcontroller will communicate with Computer thro' UART protocol.Circuit Diagram:

Code:

#include <pic.h>

Page 4: Roboticso to 9 Counter Using Ic555

#pragma config OSC =HS

#pragma config PBADEN =OFF

#pragma config WDT =OFF

#pragma config LVP =OFF

unsigned char uart_names;

unsigned char uart_signal;

void init_uart(void);

void UART_putc(unsigned char c);

void InterruptHandlerLow ();

void main()

{

init_uart();

while (1)

{

if (uart_signal==1)

{

UART_putc(uart_names);

uart_signal=0;

}

Page 5: Roboticso to 9 Counter Using Ic555

}

}

#pragma code InterruptVectorLow = 0x18

void InterruptVectorLow (void)

{

_asm

goto InterruptHandlerLow

_endasm

}

#pragma code

#pragma interrupt InterruptHandlerLow

void InterruptHandlerLow ()

{

if (PIR1bits.RCIF==1)

{

if(RCSTA&0x06)

{

RCSTAbits.CREN=0;

cUART_char=RCREG;

RCSTAbits.CREN=1;

Page 6: Roboticso to 9 Counter Using Ic555

}

else

{

uart_names = RCREG;

uart_signal = 1;

}

}

}

void init_uart(void)

{

uart_signal=0;

TRISCbits.TRISC7=1;

TRISCbits.TRISC6=0;

SPBRGH = 0x02;

SPBRG = 0x08;

RCSTAbits.CREN=1;

RCSTAbits.SPEN=1;

BAUDCONbits.BRG16=1;

TXSTAbits.SYNC=0;

TXSTAbits.BRGH=1;

Page 7: Roboticso to 9 Counter Using Ic555

TXSTAbits.TXEN=1;

RCONbits.IPEN = 1;

IPR1bits.RCIP=0;

PIE1bits.RCIE=1;

INTCONbits.GIEL = 1;

}

void UART_putc(unsigned char c)

{

TXSTAbits.TXEN=0;

TXREG=c;

TXSTAbits.TXEN=1;

while(TXSTAbits.TRMT==0)

{

Nop();

}

}