Transfering data from one microcontroller to another

Discussion in 'Embedded Systems and Microcontrollers' started by kuannygohcheetatt, Jan 29, 2014.

  1. kuannygohcheetatt

    Thread Starter Member

    Oct 31, 2013
    61
    0
    1. Can a can a microcontroller transfer data through another wirelessly via bluebee?
    2. When programming the microcontroller in c languange in mplabx do i nid to include usart.h and usart.c file? Some of my friend say no nid while others say it requires.
    3. Let say i am sending a character from microcontroller a to b , what should the program flow of receiver b? Should i use interrupt for it?
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    a) Sure, why not?
    b) If you are connecting to the RF module via the UART, and you want to use the library routines, you'll need the .h at least. If you get data to the RF module another way, you'll use something else. In MPLABX, you'll need the .h file but the linker will automatically include the compiled .c from the library. If you don't use the library routines, you'll have to write your own UART routines and include the .c in the project's file list. Which compiler are you using? XC8 does not seem to have canned UART routines in its standard libary. MikroC does.
    c) I always use interrupt driven receivers (and transmitters, too) for async, particularly when there is no handshaking as in RF reception.

    Post a block diagram or schematic with part numbers of what you have so far and we can help you on specifics.
     
    Last edited: Jan 29, 2014
  3. kuannygohcheetatt

    Thread Starter Member

    Oct 31, 2013
    61
    0
    First of all i would like to say thanks to you
    As for my question, i am using blueebee which is a bluetooth device
    My block diagram is switch --- microcntorller --- bluebee for my transmitter part
    And ----bluebee---- microcontroller ----lcd for my receiver part
    Do it make sense? Do i nid to inclide any usart header or usart c file?
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    1. Wireless communication should work.

    2. I am not familiar with mplabx libraries. Yes, normally one would use #include "uart.h" in your main code.

    uart.c would be added to the project at some stage. Look up microchip examples on how to use uart libraries.

    3. Handling the receive data via interrupts makes sense. Transmit data can be handled using polling or interrupts.

    Hope this helps.
     
  5. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    To answer that question, we need to know which compiler you are using. MPLABX supports many different ones. XC8, XC16, XC32, C18 are some of the Microchip offerings. MikroC is another popular one with its own IDE and extensive libraries for popular peripherals (LCD, UART, Keypads, etc.)

    So..
    Which compiler are you using?
    Which PIC are you using?
    What is the part number (or link to its datasheet) of the RF module?

    Without knowing these, its not possible to provide specific answers.
     
  6. kuannygohcheetatt

    Thread Starter Member

    Oct 31, 2013
    61
    0
    I am using pic16f877a e wireless transmission is bluetooth compiler I not sure should be xc8
     
  7. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    As far as I can tell, XC8 does not have canned UART routines for 16Fxxxx, based on the Libraries chapter in the XC8 manual.

    XC8 does provide peripheral libraries for many 18Fxxxx parts. These do include UART functions.

    MPLABX->XC8 Compiler help is your friend here. If you click the (?) in the Dashboard at the left edge of the screen, any available help will pop up. You can also go to C:\Program Files (x86)\Microchip\xc8\v x.xx\docs (Win7-64)to find helpful docs.

    I personally don't do C on 16F if I have a choice, but several members here do with success. If you are just starting out, I would highly recommend you pick a PIC in the 18F family. There are many more library routines for the 18F and its a better C platform by far. It looks like if you stick with XC8 on 16Fxxx, you'll have to write your own UART routines or find them on line or in an appnote. You also might check out MikroC. It seems to have more peripheral support on the lower end PICs. Its not free (though it has a 2K-limited demo version), and does not support the low cost PICkit debuggers.

    AN774 has lots of general info on using UARTs in 16,17 and18 PICs but the source code is in assembler.

    Regardless of your approach, you're still going to have to study up on the comms function to be able to implement even a library-based solution. If you post your work with specific questions, there is much help available here on AAC.

    Good luck!
     
    Last edited: Jan 29, 2014
Loading...