ABL electronic PIC16 Personal Computer User Manual


 
The example demonstrates simple data exchange via USART. When PIC MCU
receives data, it immediately sends the same data back. If PIC is connected to the
PC (see the figure below), you can test the example from mikroC terminal for
RS232 communication, menu choice Tools > Terminal.
MikroElektronika:
Development
tools
-
Books
-
Compilers
18 7
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
char i = 0, j = 0;
long addr;
unsigned short dataRd;
unsigned short dataWr[64] =
{1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,
1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,
1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,
1,2,3,4};
void main() {
PORTB = 0;
TRISB = 0;
PORTC = 0;
TRISC = 0;
addr = 0x00000A30;
// valid for P18F452
Flash_Write(addr, dataWr);
addr = 0x00000A30;
for (i = 0; i < 64; i++) {
dataRd = Flash_Read(addr++);
PORTB = dataRd;
Delay_ms(500);
}
}//~!
Library Example