To establish serial communication between two PIC16F877A microcontrollers
Description
In this experiment, 8-bit digital input is applied at Port-B to one of the PIC16F877A microcontroller which acts as a master in serial communication. The input value is transmitted by the master serially via Serial Peripheral Interface (SPI) to the second PIC16F877A microcontroller, which acts as a slave. The slave then outputs the value to its Port-B. Following three lines are used for serial communication
Serial Data Out (SDO)
Serial Data In (SDI)
Serial Clock (SCK)
The SDO for master acts as SDI for slave and vice-versa. Serial clock is invariably provided by the master. The SPI communication settings are done using SSPCON register.
Transmission is initiated by the Master by writing to the SSPBUF register. When transfer is complete, Synchronous Serial Port Interface Flag (SSPIF) will be set. This can cause an interrupt if peripheral interrupt is enabled.
Assembly Code
Master microcontroller code
; This program reads Port B value from Master PIC microcontroller
; and sends it to slave PIC microcontroller
I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. ACCEPTCheck Privacy Policy
Manage consent
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.