Communication of 2 different microcontroller(Rs485)

Discussion in 'Embedded Systems and Microcontrollers' started by Burak Doğançay, Jul 20, 2016.

  1. Burak Doğançay

    Thread Starter New Member

    Jul 20, 2016
    4
    0
    Hello everyone,

    First of all, I would like to inform you that I really apreciate your consideration of response for embedded projects.

    Recently I decided to study on microcontrollers and communication procedures of them.(includes UART,I2C,SPI Serial communication protocols)

    In this case, I started to learn rs485 serial communication for embedded projects.Therefore I will improve my skills for both side(embedded programming and electronics)

    So,I am trying to learn serial communication and configurations of microcontrollers.I started to one project which includes rs485 communication of two microprocontrollers.

    In this project, I would like to send a string value from one microcontroller to another. I have made a project based on gps,gsm and arm microcontroller communication via USART 2 months ago.
    So, I improved myself for arm microcontroller programming and the project works perfectly.

    Bu this time, I would like add something new to this project and that will be consist of rs485 serial communication.In this situation I would like to create a basic microcontroller circuit that will send a data(string value) over rs485 serial communication.

    The project implementation and duty is;

    This new microcontroller circuit will send integer value to my gps,arm microcontroller based project for authentication.
    So, It means that; If we make a communication between these microcontrollers, my new microcontroller based circuit will send a data to old arm microcontroller and then arm microcontroller will get this data from new microcontroller and process related data inside.

    Thus,I should choose a microcontroller which is capable to send single data via rs485 transciever to arm.So, This microcontroller should include Uart pin configuration and it should be available on the pins.The controller should be cheaper and easy to manage and integrate registers,timers,interrupts ..etc.

    Could you please suggest me, what type of controller may i use to send single data via rs485 transciever?

    What should I consider to choose this microcontroller?

    Which model is apropriate (Coul you please inform exact model and it should be cheaper).

    Also configuration of this microcontroller should be easy in the case of rs485 communications(registers,interrupts for rx,tx, sleep mode configuration ...etc)

    Will it be appropriate sample codes on the internet for a given model?

    Thank you in advance.
     
  2. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    Your specific question is not really answerable.

    RS-485 requires a micro with a UART at the bare minimum.
    Since you have provided scarce detail about what your system needs to do, just about any micro-controller with a UART will do.
    You just need to add an RS-485 transceiver chip.

    You will find that controlling the TX enable pin is the most critical aspect of the task.
    Do you intend to create a multi-drop network? or only point to point?

    Texas Instruments makes a few good RS-485 chips, read the application notes for these parts to learn more.
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    With RS-485 it matters a great deal how many nodes you plan to have in the network and how you plan to control the transmitters. Unlike RS-232 which is point to point and full duplex, RS-485 is multi-drop and half duplex. Understanding the distinction will be critical to design success.
     
  4. Burak Doğançay

    Thread Starter New Member

    Jul 20, 2016
    4
    0
    Yeah, this microcontroller is going to handle simple thing.It will just send a data via rs485 data line with transciever.

    And yes it is going to include multidrop networt, because There will be another devices to communicate via this rs485 data line.In this case my old 32-bit arm microcontroller will manage all these devices + this simple microcontroller will send a data for just authentication to arm.But this operation will not be related to other process of devices.

    I just would like to learn, which type of simple microcontroller should ı use.Pic? , atmel atmega 8-bit microcontroller ? or even arm.

    It should be really cheap and configurations(Interrupts, registers...etc) should be understandable with examples
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    It just doesn't matter which one you use. they will all work just fine.
    You are still ignoring the problem of how you will manage the transmitter enables for all of these nodes. I'll give you a hint, please pay attention. All of the little micros with transmitters will need to be receivers so they can know when it is appropriate to transmit. If you ignore this problem you will have devices stepping on each other and as a result no meaningful communication will take place. Tell me you understand the problem.
     
  6. Burak Doğançay

    Thread Starter New Member

    Jul 20, 2016
    4
    0
    I didn't make any project for rs485 communication.Thus, I would like to learn how to manage interrupt and adjustment for data communication of each devices.

    So, I am going to investigate how to program it and how to apply interrupts for rs485 communication.I am planning to use this simple microcontroller as Reciever and transmitter for feedback and different type of operation.(Sending data and get response from main arm microcontroller).But Other devices will be in slave mode.

    For now, I have no idea what type of problems are faced.It should meet the required specifications (temperature considerations, easy to program, Uart communication ).I already specified transciever ıntegrated circuit for communication.
     
  7. Burak Doğançay

    Thread Starter New Member

    Jul 20, 2016
    4
    0
    I understood your question.It means if I use this second microcontroller there will be some problems for data transmitting between devices and these microcontrollers.But ı will think about it after ı choosed a microcontroller.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    That is all fine, but don't waste too much time on the choice.
     
  9. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,146
    204
    Check out MODBUS or even for that matter Kermit protocol.

    Otherwise, you have to roll your own.
     
Loading...