Saturday, March 23, 2013

Serial communication between PC and 8051

Serial communication is widely used when the control system has to be actuated from the computer(PC).I will show you as how to send data from PC to 8051. In return, 8051 will acknowledge the data which we sent. So basic component  required in serial communication is MAX232 IC. It is used to convert Rs232 voltage levels to TTL and vice versa. Read more here. Max232.

I have used Matlab to send data serially from PC, and used 8051 to receive the serial data and display appropriately. Simulation is done in Proteus.
Serial communication between PC and 8051


We have used Virtual serial port emulator. Connect two ports in pair. I have connected COM2 and COM3.  Edit  COMPIM as COM3. Next, write a serial code which travels through COM2 in  MATLAB.Since both com ports are in pair, if you write in COM2 data will get through COM2 and through rest of circuitry.



I have used compim. So that matlab and proteus are connected.I have used 2 inverters in the main circuit before max232 because, MAX232 inverts the data.These inverters are very important.Otherwise you'll not be able to send the serial data and serial communication fails.
Here is the Simple Matlab code for serial communication, shown below
fprintf(s,'2') will send 2 to the 8051..  In the code I have written such that, if i send '2' from PC to 8051 serially. 8051 will receive the serial data and checks if it received correctly and acknowledges by displaying "got2" in the virtual terminal.
Serial communication Proteus simulation


Set the circuit as shown in the figure. And if anyone needs project code and simulation. Let me know!

50 comments:

  1. hi. can u please e mail me the code and the schematic for the pc serial communication using matlab? mail is smandy_dan@yahoo.com ty

    ReplyDelete
  2. hi. can u please e mail me the code and the schematic for the pc serial communication using matlab? mail is surdipsurdip@gmail.com ty

    ReplyDelete
  3. hiee...can u plz mail me d code ...to send data from pc to 8051 using c..asap
    snehmaske@gmail.com...

    ReplyDelete
  4. I have mailed codes and schematic for all of you. Happy learning!! Thanks for contacting!

    ReplyDelete
  5. hi. can u please e mail me the code santione92@hotmail.com

    ReplyDelete
  6. Replies
    1. Yes i have mailed you. Please Provide feedback if it helps you in your Project.

      Delete
  7. Can u just mail pls everything at shah.maanav.07@gmail.com

    ReplyDelete
  8. can you mail asap the whole thing at gagandeep.bawa@hotmail.com

    ReplyDelete
  9. I have mailed to both of you.Check out.See the video for better understanding!

    ReplyDelete
  10. please mail code to me rahuldeepak@gmail.com

    ReplyDelete
  11. Can u just mail pls everything at kmsatheesha@gmail.com

    ReplyDelete
  12. heee...
    can u mail me code and simulation ...
    mail id : vasantpatel3584@gmail.com

    ReplyDelete
  13. hi.
    plz can you mail me the layout and everything else you have. my email id is baswati586@yahoo.com

    ReplyDelete
  14. heyy..can u please mail me everything related to this project including the code.my email id is nitinpurohit258@gmail.com

    ReplyDelete
  15. Hassan and Nitin, check the mail.

    ReplyDelete
  16. hi. can u please e mail me the code and the schematic for the pc serial communication using Proteus ? mail jaganikushal@gmail.com thnx

    ReplyDelete
  17. can u please mail me everything related to this project including the code.my email id vajuethiopia@gmail,com

    ReplyDelete
  18. Hi! A good job! Please send me files of this your project. Thank You!
    My e-mail is: zh1 at inbox.ru
    Thank You for your job!

    ReplyDelete
  19. hello ! can u mail me codes for interfacing of PIR sensor to 8051 to MatLab webcam triggering ??? if you can than pls send me on hetupatel11h2@gmail.com
    thank you..

    ReplyDelete
  20. sir please me the code.....pranav24031993@gmail.com

    ReplyDelete
  21. can you please me the files for sachinsajjan1@gmail.com

    ReplyDelete
  22. kindly mail me the code, thank you,
    mwasiddiqui@outlook.com

    ReplyDelete
  23. can you please send me the codes and simulation file at faisal_mustafa5@yahoo.com. thankyou..

    ReplyDelete
  24. please mail me the matlab code on sonawane.mandar65@gmail.com

    ReplyDelete
  25. please mail me the codes and simutation details.

    ReplyDelete
  26. can you please mail me the code and proteus schematic

    ReplyDelete
  27. can you please your contact number

    ReplyDelete
  28. Can you please send me c code for this project to:
    s.askaruly@gmail.com
    Thanks

    ReplyDelete
  29. can you please mail me the code.

    hellsluck@gmail.com

    thankyou

    ReplyDelete
  30. can u mail e evythng related toproject ,..preetiaman.kaur703@gmail.com

    ReplyDelete
  31. please email me simulation

    bilal.akbar2@gmail.com

    ReplyDelete
  32. Can you plz mail me the code to vinaysrihari93@gmail.com

    ReplyDelete
  33. can u pls mail me the code @ rks29507@gmail.com

    ReplyDelete
  34. Hi, can you please mail me the code and Proteus schematic -

    ReplyDelete
  35. sir please can u mail me proteus simulation code it is very urgent

    thanks a lot for video it solve my all problem
    ismailbagalkote@gmail.com

    ReplyDelete
  36. Hi can you please send me the project files?
    my email ID is chetansupe@gmail.com

    ReplyDelete
  37. sir please can u mail me the project files?
    my email is mutazmesmar20@gmail.com

    ReplyDelete
  38. if anyone have simulation and code can u pleas mail me aumar2826@gmail.com

    ReplyDelete