2011年4月7日星期四

Expansion of a C51 microcontroller design and application of parallel port

c51 microcontroller is the most commonly used in our life series, mcs-51 family of microcontrollers with four parallel port (p0, p1, p2, p3 mouth), but for a slightly more complex applications, the real parallel for users port, only p1 port is available, often for extended Moreover, the device i2c and spi port to be occupied by some of the p1, forcing users to extend the parallel port to meet the actual needs. In practice, the commonly used parallel port interface chip are 8255,8155, compare the two chips feature complete, you can use in relatively complex systems, but the case of the system in general, these functions are often idle. Then you can use some port lines have been idle for a strobe extension of the parallel port, so you can take full advantage of the limited single chip i / o resources, in this design is the expansion of p1 into one or several ports 8 bit parallel port, eight port on each access to eight light-emitting diodes as the output switch diode is used to do, here the design of the marquee lights and water programs, so that the opening of the switch-off control; The author with the control switch designed a total of Yang led digital tube, LED lights to display the current number, to be more intuitive dual control effect, and then through the mouth p0 d / a converter and an amplifier output an analog signal, results can be seen by the oscilloscope. So that the entire system with digital signal output and analog output, digital display also features a large practical performance improved.
2, the system hardware design based on 89c51
2.1 Parallel port expansion circuit design
As we all know, c51 series of microcontrollers have four i / o port (p0, p1, p2, p3), then at89c51 no exception, but we usually just use the port as a parallel port p1, and that the remaining population (p2, p3) is idle, so this design, we are using the port as idle p3 signal line to be elected to the parallel port p1 port expansion.
(1) ways to extend the advantages of parallel port
Simple connection;
Do not take up storage space;
(2) programming is also convenient and flexible. But there are also a great disadvantage
Parallel port expansion capability is limited, (such as the use 74ls573 (74ls373) and not to drive the deal, the maximum expansion of the same type of 4 parallel output port, of course, also need the corresponding four strobe.)
Such as the expansion of more parallel port strobe take too many digits, for example, want to extend the eight parallel output port, you need 8 election could signal this time, only the election could signal occupies an 8-bit parallel port, which in the i / o port line limited SCM systems, such a waste of resources, the phenomenon can not be tolerated. In this design, the use of chip 74hc573 (with three-state output octal d-type transparent latch) on port p1 conducted an 8-bit parallel port expansion, strobe use p3 port p3.3 pins.
Commissioning procedures have been adopted, the whole process to achieve the following functions:
p1 eight port expansion, led control light switch 8, the program experimented with this eight light control switch, Happy Valley, experimental procedures can be written from the cycle of l1 to l8 shiny, light-emitting diode emitting at the same time each , led digital display lights up the serial number of the current, such as 11,22,33 and so on. Also allows each diode flashes, flashes may provide time for half a second or longer, and then led flashes in each the same time, so that led blinking LED lights show the current number, for example, l1 light flashing digital display 11 characters, l2 lights flashing, digital display 22 characters and so on. Functions in the digital-analog conversion, which is the preparation of the last, is to use the pointer array to write, dac0832 da achieve the conversion of the chip, which function is to output a sine wave analogue signal, when received at the terminal port of a oscilloscope, the oscilloscope Output a sine wave shape. If the main program flow chart (Figure 6) shows. The above is the function of the whole system, all the procedures have been through the debugging tests, experiments proved to be feasible.
4 Conclusion
The entire system software has been entirely through debugging, proved to be feasible, the entire system's hardware design is simplified in a single chip system design principles to design, was the Conciseness orderly, software development is also very easy to understand. The system design more suitable for application in small systems.

graphic lcd module, character lcd module

没有评论:

发表评论