SCON register is used to set the mode of serial communication. The project uses Mode1, in which the data length is of 8 bits and there is a start and a stop bit. The SCON register is bit addressable register. The following table shows the configuration of each bit. SM0 SM1. The controller raises the TI flag when the 8-bit character is transferred. This indicates that the next byte can be transferred now. The TI bit is raised at the beginning of the stop bit.
On receiving the serial data, the microcontroller skips the start and stop bits, and puts the byte is SBUF register.
The RI flag bit is then raised to indicate that the byte has been received and should be picked up. Hyper Terminal. To start a new connection, go to File menu and click on new connection.
The connection window opens up. Give a name to your connection and select 1 st icon and click on OK. Serial Communication uses only two data pins to establish communication between Microcontroller and external devices.
In this mode of communication data is transferred one bit at a time. This article describes Interfacing of with PC to establish communication through its serial port RS It a bit addressable register used to set the mode in which serial communication takes place in the controller. The above figure shows the configuration of the SCON register. Here is the list of functions of each bit. SM2: Multiprocessor mode control bit, logic 1 enables Multi processor mode and 0 for normal mode.
REN: Enables Serial reception. If set, it enables the reception otherwise the reception is disabled. TB8: It is the 9th bit of the data that is to be transmitted. This lets the program to know that it needs to read the value quickly before another byte is read.
The Upper four bits are configuration bits. SM0 and SM1 set the serial mode between 0 and 3. The four modes along with the baud rates are in the table given below. In modes 0 and 2 the baud rate is fixed which is based on the oscillator frequency. In modes 1 and 3 the baud rate is variable which depends on how often Timer 1 overflows. SM2 is a flag bit for Multiprocessor communication.
By this way, program knows that a byte has been received and it needs to be processed. If 9th bit is clear, the RI flag will never be set. We will clear this RI bit so that the flag is set upon reception of any character. REN is Receiver Enable bit. Set this bit if we want to receive data through serial port. It is defined as number of bits transmitted or received per second and is usually expressed in Bits per second bps. After setting the operation mode of serial port, the program must configure the serial ports baud rate which is only applicable to Serial Port modes 1 and 3.
For mode 0 and 2 oscillator frequency determines the Baud Rate. Baud rate is always the oscillator frequency divided by For crystal of frequency For them, the baud rate is determined by how frequently timer 1 overflows. The more frequent timer 1 overflows, the higher the baud rate. There are many ways due to which timer 1 overflows at a rate that determines a baud rate. The most common method is:. Now lets explain and go through each in detail.
System inputs are necessary to make the micro controller functional. So the first and most important of this is power, marked as Vcc with a GND ground potential.
Without proper power supply, no electronic system would work. Take a look at the schematic diagram below a functional microcontroller. As mentioned above, control signals are used for external memory interfacing. You can also see a 0. For describing pin diagram and pin configuration of , we are taking into consideration a 40 pin DIP Dual inline package.
Now lets go through pin configuration in detail. Pin : Named as Vcc is the main power source. You may note some pins are designated with two signals shown in brackets. Pins Known as Port 0 P0. If there is no external memory requirement, this pin is pulled high by connecting it to Vcc. Pin ALE aka Address Latch Enable is used to demultiplex the address-data signal of port 0 for external memory interfacing.
Pins- Known as Port 2 P 2. Pin Named as Vss — it represents ground 0 V connection. Pins 18 and Used for interfacing an external crystal to provide system clock.
Pins 10 — Known as Port 3. This port also serves some other functions like interrupts, timer input, control signals for external memory interfacing RD and WR , serial communication signals RxD and TxD etc.
This is a quasi bi directional port with internal pull up. Pin As explained before RESET pin is used to set the microcontroller to its initial values, while the microcontroller is working or at the initial start of application. Pins 1 — Known as Port 1. Unlike other ports, this port does not serve any other functions. There is no need of any detailed explanation to understand internal architecture of micro controller. Just look at the diagram above and you observer it carefully.
The system bus connects all the support devices with the central processing unit. From the figure you can understand that all other devices like program memory, ports, data memory, serial interface, interrupt control, timers, and the central processing unit are all interfaced together through the system bus.
RxD and TxD serial port input and output are interfaced with port 3. Before going deep into the memory architecture of , lets talk a little bit about two variations available for the same. They are Princeton architecture and Harvard architecture. Princeton architecture treats address memory and data memory as a single unit does not distinguish between two where as Harvard architecture treats program memory and data memory as separate entities. Thus Harvard architecture demands address, data and control bus for accessing them separately where as Princeton architecture does not demand any such separate bus.
Example:- micro controller is based on Harvard architecture and micro processor is based on Princeton architecture. Thus has two memories :- Program memory and Data memory. Now lets dive into the program memory organization 0f It has an internal program of 4K size and if needed an external memory can be added by interfacing of size 60K maximum. So in total 64K size memory is available for micro controller. By default, the External Access EA pin should be connected Vcc so that instructions are fetched from internal memory initially.
0コメント