89c2051 networking using RS-485 Protocol

Discussion in 'Embedded Systems and Microcontrollers' started by Reload, Feb 8, 2010.

  1. Reload

    Thread Starter New Member

    Feb 8, 2010
    Hello fellows,

    well now a days i am working on a task, that i need to communicate two or more controllers (89c2051) using medium RS-485. For Example a Master is controlling slave controllers, and the Condition is that i can't not use the 89c2051 serial port for networking purpose, as its reserved for getting data from pc and sending back to pc when master gets data from slave.

    Well i have done alot of home work for it, hardware is also ready working pretty good and i have also successfully program the Master controller to get a Character from PC and then send it to other micro controller(Slave) through rs-485 protocol.

    the technique i am using that i tried to make a virtual serial port on the two port pins of the 89c2051. let me describe a bit.

    two pin of a port is using for this purpose, one pin used for send data and the other is controlling the direction, as in 485 the direction is really important.

    Master controller is waiting in a loop for getting data from PC, if Master received its desire data from pc, it sends this data to slave controller, and this sending is bit by bit. the Master sends a start bit (0) which is an indication to slave that the next bit will be data bit, now 8 bits get transfered to slave. after sending these 8 bits master again sends a stop bit (1) to indicate that 1 byte has transferred.

    i have successfully achieved this in my project, now i need to send the data received by the slave, from the master again send to the Master. it seems really simple that i just need to swap the code, but i am trying for many days unable to achieve it. Master controller unable to detect the start bit (0) from the slave controller and slave controller is sending it perfectly. Now what to do, i think that's a delay problem, but unable to fix it.

    So Experts here, i need your help.
    oh yes, i am using assembly for this purpose.
  2. Reload

    Thread Starter New Member

    Feb 8, 2010
    well i have found the solution, any one need help regarding it can contact on <snip>

    Last edited by a moderator: Feb 16, 2010
  3. bertus


    Apr 5, 2008

    If you have a solution, you can show it here.
    In that way other viewers also may have benefit of it.