"Electronic Postman" System Based on Single Chip Microcomputer and Labview

Publisher:美丽花朵Latest update time:2018-03-25 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    1 Overview

    With the development of the Internet, in order to facilitate people to receive emails in real time, this article introduces an "e-mailman" system based on a single-chip microcomputer and Labview. The PC program is written using Labview, and the network communication function is realized by connecting the single-chip microcomputer with the Ethernet controller ENC28J60, and the received emails are displayed through the LED . In order to simplify the system design, this system adopts the method of directly sending 16×16LED dot matrix data. This method can remove the design of the single-chip Chinese character dot matrix library, greatly simplifying the design and reducing costs.

 

    2. Hardware structure

Hardware diagram of the email carrier

    The hardware structure of the e-mailer is shown in the figure above. The single-chip microcomputer uses the AT89C51ED2 launched by ATMEL, which has 64K bytes of FLASH, 2K bytes of RAM, 2K bytes of EEPROM, supports online programming, 6 8-bit general-purpose I/O ports, hardware watchdog timer, serial peripheral interface (SPI) that can work in host and slave mode, 9 interrupt sources, 4 levels of interrupt priority, and 3 16-bit timer counters.

    ENC28J60 is a new stand-alone Ethernet controller with only 28 pins launched by MICroChip, which is conducive to creating small, low-cost and streamlined embedded network systems. The ENC28J60 Ethernet controller uses the industry-standard SPI serial interface and only needs 4 lines to connect to the main control microcontroller. It has a built-in 10Mbps Ethernet physical layer device (PHY) and media access controller (MAC), which can reliably send and receive information packet data according to the industry-standard Ethernet protocol. ENC28J60 has programmable filtering functions, special filters, including Microchip's programmable pattern matching filters; it can automatically evaluate, receive or reject MagiCPACket, unicast (Unicast), multicast (Multicast) or broadcast (Broadcast) information packets, reducing the processing load of the main control microcontroller: built-in programmable 8KB dual-port SRAM buffer, can realize flexible and reliable data management mechanism.

    2.1 Connection between AT89C51ED2 and ENC2&J60

    The ENC28J60 operates at 3.3V and is easily integrated into a 5V system. The SPI's CS, SCK, and SI inputs, as well as the RESET pin, can all withstand 5V: On the other hand, if the host controller runs at 5V, when the SPI and interrupt inputs are driven by the 3.3VCMOS outputs on the ENC28J60, it is likely that they will not meet the specification requirements, and a unidirectional level converter is required. This system uses an inexpensive 74HCT08 (quad AND gate) to provide the necessary level conversion. The conversion circuit is shown in the figure below, with the microcontroller working in host mode and the ENC28J60 working in slave mode.

Conversion circuit

    2.2LED display module

LED display circuit

    The LED display circuit is shown in the figure above, which adopts row scanning. Among them, the P4 port controls the number of scan rows, the P2 port controls the column register selection, and the PO port sends the LED dot matrix data. The dot matrix data of each word occupies 32 bytes. The single-chip microcomputer first selects the first row, and then selects the first 74LS244; then writes the first byte of the dot matrix data of the first word through the PO port, and then selects the second 74LS244; then writes the 17th byte of the dot matrix data of the first word through the PO port, and then selects the third 74LS244; then writes the first byte of the second word through the PO port, and then writes in sequence until the 17th byte of the dot matrix data of the 16th word; then selects the second row and scans in sequence.

    3. Software Design

    The MCU first initializes SPI, and then initializes the Ethernet controller ENC28J60 through SPI, and waits for interrupts after initialization. When ENC28J60 receives the email, it sends an interrupt request to the MCU. After the MCU responds to the interrupt, it receives data through SPI. After successfully receiving the data, it sends the feedback information "OK" character, and then displays the email through the LED display, first displaying the first 16 words, and then displaying the last 16 words. In addition, this system can also complete ARP response and PIN g command response.

    3.1 Main program design

    ①MCU SPI control register

    The definitions of each bit of SPCONSPCON are shown in the following table. Set SPCON=010101108, that is, the synchronous clock selects FLCKPERIPH/8, enables the serial port, enables, selects the master mode, the idle state is low level, and the rising edge shifts in data.

SPCONSPCON Definition of each

    ②ENC28J60 Ethernet control register 1 (ECON1)

The ECON1 register is used to control the main functions of the ENC28J60

    The ECON1 register is used to control the main functions of the ENC28J60. The definitions of each bit are shown in the table above. ECON1 contains receive enable, transmit request, DMA control and storage area selection bits. Set ECON1 = OOOO0110B to write the data packet through the current filter into the receive buffer and access the register in Bank2.

    It is also necessary to set the Ethernet interrupt enable register EIE, MAC control register MACONi, MAC control register MACONI and MAC address. For detailed setting methods, please refer to the system microcontroller source program and ENC28J60 data sheet.

③ Main program flow chart The main program flow chart is shown in the figure below.

Main program flow chartMain program flow chart

    3.2 Interrupt service program design The interrupt service program flow chart is shown in the figure below.

Interrupt service program design Interrupt service program flow chart

    3.3 PC Program Design The PC program is written in Labview. When using Labview (LaboratoryVirtu-), program code is basically not written, but a flow chart is used instead. Labview has built-in library functions of TCP/IP, ActiveX and other software standards that are easy to apply. This system uses Labview's UDP control to implement the UDP protocol, which is convenient and fast.

    ①PC program interface

C machine program interface

    The PC program interface is shown in the figure above. Enter the destination address of the email, such as "202.96.170.165" in the destination address box, select the destination port number 8001 and the receiving feedback information port number 8002, then enter the email content and click the Run button to send the email. When the microcontroller receives the email, it will feedback the "OK" message, indicating that the email has been successfully received by the microcontroller.

    ②PC flow chart

    The PC flow chart is shown below.

PC flow chart

    The upper part of Figure 7 is the sending program, and the lower part is the receiving program. The DLL technology is used to convert Chinese characters into 16x16 dot matrix data in the sending program. The conversion program is made into DLL and can be called in Labview.

    4. Conclusion

    This system uses the Ethernet controller ENC28J60 to configure the single-chip network system, which has a simple structure and convenient design. It also uses the LED display to display emails, which has a simple solution, low price and strong practical value.


Keywords:MCU Reference address:"Electronic Postman" System Based on Single Chip Microcomputer and Labview

Previous article:Design of airborne operation control system based on AT89S52 UAV aviation remote sensing platform
Next article:Design of CAN bus distributed measurement and control system based on single chip microcomputer AT89C52

Recommended ReadingLatest update time:2024-11-15 16:43

Introduction to the design method of low power consumption circuit of PIC microcontroller
introduction Since the 1990s, with the continuous reduction of the feature line width of integrated circuits and the corresponding increase in chip density and operating frequency, reducing power consumption has become a major consideration in the design of submicron and deep submicron VLSI. The increase in power cons
[Microcontroller]
Introduction to the design method of low power consumption circuit of PIC microcontroller
Music player program based on 51 single chip microcomputer
;The MCU crystal oscillator used in this program is 11.0592MHz ;lThere are two songs in the program, the latter one is "Only Mom is Good in the World". The formats of the two song lists are different. If you have any questions, please leave a message. ;Daolang's The First Snow of 2002 SPK BIT P0.0
[Microcontroller]
Precise delay arrangement (12T single chip microcomputer)
Note: 1. The compiler software is "Keil uVision3" (Keil uVision2 can also be tried). If you use other compiler software, it will not be accurate. 2. The header file needs to be included . 3. The delay time of all functions is calculated under the 12Mhz crystal oscillator. If other crystal oscillators are used, they
[Microcontroller]
Using VB to realize serial communication between single chip microcomputer and computer
//ex99 MCU data sending program #include //Header file containing MCU registers /******************************************************** Function: Send one byte of data to PC ****************************************************/ void Send(unsigned char dat) {    SBUF=dat;    while(TI==0)       ;     TI=0; }
[Microcontroller]
Low power consumption and high energy efficiency power supply MCU solution
  When batteries need to power a product for years or even decades, continuous improvement of MCU integration products and slight modification of basic processor architectures cannot meet the rapidly increasing energy-saving needs. For many energy-sensitive products, such as meters, building automation products, secur
[Microcontroller]
Low power consumption and high energy efficiency power supply MCU solution
51 MCU 18B20 temperature and serial port experiment
Pictures speak louder than words The temperature is displayed on the serial port speed regulator . This software can be  downloaded from http://www.51hei.com/mcudown/   Microcontroller Development Utility Software The source code of the microcontroller part is as follows :   //11.0592 crystal #in
[Microcontroller]
51 MCU 18B20 temperature and serial port experiment
pic MCU DS18B20 sampling LCD1602 display
#include "1602.h"  #include "18b20.h"  #include "main.h"  __CONFIG(0X0B31);  main()  {      char msg  = {"  Temperature:  ","              .C"};     delay_us2 (40, 40);      delay_us2 (100, 200);      initial();      while(1) {          start_convert();          change_to_ascii (get_temp (), &msg );              displ
[Microcontroller]
5 mistakes that new LabVIEW developers must make
While NI LabVIEW software has long helped engineers and scientists quickly develop functional measurement and control applications, not all new users follow LabVIEW programming best practices. LabVIEW graphical programming is unique because it is immediately apparent whether a user is following coding best practices b
[Analog Electronics]
5 mistakes that new LabVIEW developers must make
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号