i am trying to communicate with the pc thru the PIC16f690, vice versa,, by pickit2's USART tools, where the following steps have been done;
1- i've written the program
unsigned short i;
void main() {
Usart_Init(2400);
do {
if (Usart_Data_Ready()) {
i = Usart_Read();
Usart_Write(i);
}
} while (1);
}
2- then i have connect the RX, TX of the PICKIT2 to the TX,RX of the microcontroller ,reversley .
3- i have selected the baud rate 2400 in the usart tool then connect,,
no response form the pic..
please help if you can detect ot expect the problem<< i am wating yu men
I think from PIC side you are doing a Read from UART.You need to do a Write operation from PIC side, so the character will be shown on the PC UART tool.
You don't need a MAX chip with the PICkit 2 UART tool. It's a TTL-level interface that connects just as a MAX chip would (i.e., send the data normally with no inversion).
Even with Mikro C Pro, you have little job to configure your inputs and outputs ...
RB5/AN11/RX/DT RB7/TX/CK
an example ...
Code:
/*
* Project name:
UART1 (Simple usage of UART1 module library functions)
* Copyright:
(c) Mikroelektronika, 2005-2010.
* Revision History:
20081218:
- initial release;
* Description:
This code demonstrates how to use UART1 library routines. Upon receiving
data via RS232, MCU immediately sends it back to the sender.
* Test configuration:
MCU: P18F8520
http://ww1.microchip.com/downloads/en/DeviceDoc/39609b.pdf
Dev.Board: BIGPIC6 - ac:UART1
http://www.mikroe.com/eng/products/view/300/bigpic6-development-system/
Oscillator: HS, 10.0 MHz
Ext. Modules: -
SW: mikroC PRO for PIC
http://www.mikroe.com/eng/products/view/7/mikroc-pro-for-pic/
* NOTES:
- Turn on UART1 switches SW12.1 and SW12.2 (board specific).
*/
char uart_rd;
void main() {
ADCON1 |= 0x0F; // Configure AN pins as digital
CMCON |= 7; // Disable comparators
UART1_Init(19200); // Initialize UART module at 19200 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Start");
UART1_Write(10); // Line feed
UART1_Write(13); // Carriage return
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
}
}
}
BTW ... you should upgrade to V 4.15 ... as it's free !!!