Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

HeLp Me ,, otherwise...

Status
Not open for further replies.

lm339

New Member
hi every body,,

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 am very thankfull to you men<<
 
Last edited:
What compiler are you using?

Additionally please change your subject line. It's inappropriate at best. And if it's accurate in the slightest seek immediate mental health services.

Title changed by moderator.
 
Last edited by a moderator:
Dear LTX71CM, first it ,, i enlareged the suffring ,, and unfortunately i could not change the supject line,,

second, i am using a MikroC compiler V2.8,

hopefuly you can help.

thanks a lot man
 
Do you have a max232 chip (or equivalent) to do the inversion and level shifting?

Mike.
 
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).
 
Hi,

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 !!!

Alain
 
Last edited:
gayan soyza,, thanks,
pommie,,thanks
jon chandler,,, thanks

acetronics ,,thanks alot 4 your helping,, i got from you ,,that ,, the problem is in the I/O pins of the pic and the version of the compiler,,

is that it? i am using a pic16f690. and i see in the manual USART dose it differ than UART ?
thank you
 
Status
Not open for further replies.

Latest threads

Back
Top