+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 4
    Points: 610, Level: 5

    Join Date
    Aug 2018
    Posts
    72
    Helped
    0 / 0
    Points
    610
    Level
    5

    PIC18F micro controller to send and receive atcommand

    I have PIC18F45k40. I am trying to communicate with LOra module. Can someone suggest me simple example to send At command and get response for same.


    i have attached datasheet for reference.Lora device..pdf

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 83,142, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,673
    Helped
    4538 / 4538
    Points
    83,142
    Level
    70

    Re: PIC18F micro controller to send and receive atcommand

    You should be able to use any UART driver library or write your own. The LOra module uses 115200 Bauds serial protocol so all you have to do is hook it up to the PIC TX and RX pins then configure the USART for that speed. The RXDATA and TXDATA registers are your data from the module and to the module respectively.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 4
    Points: 8,032, Level: 21
    Achievements:
    7 years registered

    Join Date
    Jan 2015
    Posts
    1,125
    Helped
    351 / 351
    Points
    8,032
    Level
    21

    Re: PIC18F micro controller to send and receive atcommand

    If you are asking that question then I suggest that you will have a very hard road ahead of you with an awful lot to learn before you are successful. I don't say this to put you off but to get you to take small steps towards your goal.
    To me, it sounds like you don't have much experience with microcontrollers, and at least the PIC18F family of devices.
    Start with the 'flash a LED' task as that will at least get you able to program the chip (i.e. get to know the IDE, how to set the CONFIG bits, how to program the MCU, how to set the oscillator up to the required frequency, how to use a basic peripheral such as a timer and how to use the GPIOs).
    Next move on to how to use the UART module to send and receive characters with a PC (i.e. how to set the Baud rate, how to map the Tx and Rx signals to a GPIO pin using PPS).
    Add to that the use of ring buffers (at least for receiving characters).
    Move on to sending strings through the UART to your Lora chip but at this point I'd suggest you use the PC to see the strings that it sends back.
    Next learn about how to parse character strings - this is NOT a trivial thing but if you are to understand what the Lora chip is sending back to you then it will be essential. Also think about how you will handle errors, mal-formed response strings and other communication failures that might occur.
    Add in the string parsing code and interpret what the Lora chip is sending back to you.
    Finally you can add all of the code over the top of that to make the Lora chip send/receive whatever data you are wanting to use.
    I know this sounds a lot but each step builds on what you have done in the previous step. Also your next project will be MUCH easier as you can start at the appropriate place in the sequence and build out from there. The learning curve can be quite steep (for example, I've not mentioned learning how to debug your faulty code in any of the above steps!!!!!) but once you have the basics under your belt then it becomes much easier.
    Susan


    1 members found this post helpful.

--[[ ]]--