Microcontroller in design does not need to use more external component to do particular task. This is because microcontroller has several built-in basic elements that can replace the external component task.
Registers are therefore memory locations where the role is to help with performing various mathematical operations or any other operations with data wherever data can be found at the current situation. Two independent entities (memory and CPU) which are interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for example, the contents of two memory locations are added and the results are return back again to memory, and need a connection between memory and CPU. Simply stated, that must have some "way" through data goes from one block to another.
When working with it, the port acts like a memory location. Something is simply being written into or read from it, and it could be noticed on the pins of the microcontroller. The figure above shows the input/output unit of microcontroller.
2.5 Serial communication
Beside the above matter, the possibilities of communication with an outside world were added to the already existing unit. However, this way of communicating has its drawbacks. One of the basic drawbacks is the number of lines which need to be used in order to transfer data. What if it is being transferred to a distance of several kilometers? The number of lines times number of kilometers doesn't promise the economy of the project. The number of lines must be reduced in such a way that its functionality would not. Suppose if three lines were involved, and that one line is used for sending data, other for receiving, and the third one is used as a reference line for both the input and the output side. In order for this to work, the rules of exchange of data need to be set. These rules are called protocol. Protocol is therefore defined in advance so there wouldn't be any misunderstanding between the sides that are communicating with each other. The following protocol is considered. The logical unit "1" is set up on the transmitting line until transfer begins. Once the transfer starts, lower the transmission line to logical "0" for a period of time (which will designate as T), so the receiving side will know that it is receiving data, and so it will activate its mechanism for reception. Now go back to the transmission side and start putting logic zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest value. Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit, let us bring the logical unit "1" back on the line which will mark the end of the transmission of one data. The protocol above is called in professional literature NRZ (Non-Return to Zero).
It is possible to receive and send data at the same time separate lines for receiving and sending were used. So called full-duplex mode block which enables this way of communication is called a serial communication block. Unlike the parallel transmission, data moves here bit by bit, or in a series of bits what defines the term serial communication comes from. After the reception of data it must be read from the receiving location and stored in memory as opposed to sending where the process is reversed. Data goes from memory through the bus to the sending location, and then to the receiving unit according to the protocol. The figure above shows the serial unit of microcontroller.
2.6 Timer unit
After the serial communication was explained, the data can be received, sent and processed.
However, in order to utilize it in industry a few additionally blocks were needed. One of those is the timer block which is significant because it can give information about time, duration, protocol etc. The basic unit of the timer is a free-run counter as shown in the figure above which is in fact a register whose numeric value increments by one in even intervals, so that by taking its value during periods T1(start time) and T2 (end time) and on the basis of their difference the time elapsed can be determined. This is a very important part of the microcontroller which requires constant understanding.
2.7 Watchdog
One more thing that needs attention is a flawless functioning of the microcontroller during its run-time. Suppose that as a result of some interference (which often does occur in industry) the microcontroller will stop executing the program, or worse, it starts working incorrectly.
Of course, when this happens with a computer, simply it can be reset and it will keep working. However, there is no reset button on the microcontroller and thus solve the problem. To overcome this obstacle, one more block was introduced called watchdog as shown in the figure above. This block is in fact another free-run counter where the program needs to write a zero for every time it executes correctly. In case that program gets "stuck", zero will not be written in, and counter will reset the microcontroller upon achieving its maximum value alone. This will result in executing the program again, and correctly this time around. That is an important element of every program to be reliable without man's supervision.
2.8 Analog to Digital Converter
As the peripheral signals usually are substantially different from the ones that microcontroller can understand (zero and one), they have to be converted into a pattern which can be comprehended by a microcontroller. This task is performed by a block for analog to digital conversion or by an ADC as shown in the figure below. This block is responsible for converting an information about some analog value to a binary number and for follow it through to a CPU block so that CPU block can further process it.
Thin lines which lead from the center towards the sides of the microcontroller represent wires connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines. Chart on the following picture represents the center section of a microcontroller.
That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires there are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory to address and the other one is as wide as data, and in this case are 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller as shown in the figure below.



0 comments:
Post a Comment
Hi: This is PICINF.blogspot.com comments section. Here you are requested to write your question or problems in detail. Write the question in such a way that, it have all necessary information, sothat i can understand and reply.If you want to send pictures and codes then e-mail me (rghkk@hotmail.com).Thanks.