Share this

Design of a cafeteria meal service system based on DS80C410 embedded CAN bus

2026-04-06 04:12:32 · · #1
Abstract: This paper introduces the design of a canteen meal service system based on the DS80C410 embedded CAN bus network, including the system's network structure and hardware design. The hardware and software design of the window unit in the system is highlighted, and the initialization process and message transmission and reception process of the DS80C410 embedded CAN module are described in detail. Keywords: DS80C410, CAN bus, canteen meal service system, window unit 1. Introduction CAN bus (Controller Area Network Bus) is a serial communication network that effectively supports distributed control. It has higher reliability, real-time performance, and flexibility than general communication buses. CAN operates in a multi-master mode, where any node on the network can actively send information to other nodes at any time, without master-slave distinction. The communication method is flexible and does not require node information such as station addresses. CAN bus is now widely used in many fields such as industrial field control, community security, and environmental monitoring. 2. System Structure The communication characteristics of the real-time communication canteen meal service system are very suitable for using the CAN bus. Its short-frame structure is ideal for applications requiring high anti-interference capabilities and real-time communication, but with small single-communication volumes. Its flexible networking features can completely solve the problem of multiple canteens and sales outlets being scattered in large-scale canteen meal service systems. The network structure of the canteen meal service system based on the CAN bus is shown in Figure 1. It adopts a bus-type connection and mainly includes three layers: servers, repeaters, and terminals. The servers include a working server and a backup server, which work simultaneously during operation, serving as backups for each other to ensure system stability and reliability. Repeaters can extend communication distance, increase the number of terminals, change communication rates, and provide filtering and isolation. Terminals are mainly sales windows, and also include lost/unlocked machines, card issuing/recharge machines, etc. Figure 1: Network Structure Diagram of the Canteen Meal Service System Figure 2: Hardware Structure Diagram of the Sales Window 3. Hardware Design of the Sales Window The sales window is the main front-end equipment that directly interacts with meal service personnel and users. Figure 2 shows the hardware structure diagram of the sales window. The Dallas DS80C410 high-speed network microcontroller with an embedded CAN controller serves as the microprocessor for the window machine, responsible for monitoring the entire window machine and keyboard. The MMM is a contactless IC (Mifare) card reader/writer module. Under the control of the microprocessor, this module can perform contactless reading/writing operations on cards. The window machine's communication tasks are completed by the DS80C410's embedded CAN controller under CPU control. The CAN controller receives data from the CAN bus via the PCA82C250 CAN bus transceiver for the CPU to read, and can also send data from the CPU to the CAN bus. The embedded CAN controller is connected to the transceiver's RXD (receive data output) and TXD (transmit data input) pins via P5.1 (C0RX-CAN receive) and P5.0 (C0TX-CAN transmit) pins on the DS80C410 chip, respectively. The window machine hardware also includes a 4×4 keyboard (10 numeric keys and 6 function keys), a 10-digit digital display on both the front and back (displaying identical content), a 32KB EEPROM (used to store consumption records), a watchdog timer, and other circuitry. 4. Window Machine Software Design 4.1 Main Program Design The window machine has two operating modes: networked and offline. The default operating mode is networked operation. Only when a network failure or other reason prevents network connection is the window machine switched to offline operation via a switch. Figure 3 shows the main program flowchart of the window machine. After initialization, the window machine first processes the keyboard and LED displays, and determines whether to collect consumption records. Then, it checks if a card has been read. If a card is read, the corresponding networked or offline subroutine is called to perform the business operation. Figure 3 Window Machine Main Program Flowchart 4.1.1 CAN Initialization The initialization of the window machine includes the initialization of the CAN module. After the system hardware resets, the CAN interrupt is first masked. Then, the CRST (reset) bit in the C0C (CAN control register) of the SFR (Special Function Register) in the DS80C410 is cleared to 0, thus clearing the reset state of the CAN controller. Simultaneously, the SWINT (software initialization) bit is set to 1, disabling CAN bus activity. This allows the program to write to the control registers and extended frame mask registers (C0EGM0~C0EGM3) in the CAN module, setting parameters such as communication baud rate, window machine ID, window machine number, CAN status, CAN port enable, and CAN timing, thus initializing the CAN module. Finally, the CAN interrupt is restored. After initialization, the SWINT bit is cleared to restore CAN bus activity. 4.2 Subroutine Design 4.2.1 Workflow In a networked environment, after the window machine obtains the card number through the MMM, it sends the card number to the server. After receiving the card number, the server searches the database for the user balance corresponding to the card number and returns it to the window machine. The window terminal displays the received user balance. After a transaction is completed, the window terminal sends the total user spending amount to the server. Upon receiving the spending amount, the server updates the corresponding database record and returns an acknowledgment frame (ACK) to the window terminal. If the window terminal loses a frame while sending the read card number (SNR) to the server (i.e., the window terminal did not receive the balance frame from the server), it waits for a retransmission period. If it still does not receive the balance frame from the server, it retransmits the previously sent card number. A maximum of three retransmissions are allowed. If a response frame from the server is still not received after three retransmissions, a corresponding prompt message is displayed. If the user spending amount frame sent by the window terminal to the server is lost after checkout (i.e., the server did not receive the spending amount frame and cannot update the corresponding record), the same method is used to retransmit the user spending amount. Figure 4 shows the flowchart of the network subroutine. Figure 4. Network Subroutine Flowchart. In offline mode, the window machine uses an accounting method, storing all user card numbers and consumption records in the window machine's EEPROM. After the system reconnects to the network, the server retrieves the stored data from each window machine and updates the server database. Since the window machine cannot communicate with the server in real time offline, the program is relatively simple and a flowchart is not shown. Figure 5. Sending Subroutine. Figure 6. Receiving Subroutine. 4.2.2 Frame Sending and Receiving. The CAN module in the DS80C410 provides 15 message centers as storage for sending or receiving data. Frame sending and receiving are implemented through these 15 message centers, and one or more message centers can also be selected to send or receive frames. The priority order of sending or receiving data for these 15 message centers is arranged in reverse order of the message centers. Message centers 1-14 can be set to receive or send data, while message center 15 can only receive data. The control registers (C0M1C~C0M15C) of the message centers are located in the SFR. Each message center has a format register (C0MyF), four arbitration registers, and an 8-byte data area (C0MyD0~C0MyD7). The value of the arbitration register can be set during initialization or during the sending procedure, and its value can be automatically changed as data is received. Additionally, registers C015M0~C015M3 of message center 15 can perform additional filtering. When a window machine in the network is in sending mode, the message center is first initialized, the message to be sent is loaded into the message center, and the value of the message center's arbitration register is sent out as the frame identifier. Figure 5 shows the flowchart of the program using message center 1 to send data, where MSRDY (message center ready), DTUP (data update), and MTRQ (CPU send request) bits are bits of the control register C0M1C of message center 1. When the window unit is in receive mode, the CAN controller will determine whether to receive the frame ID identifier based on the values ​​of the mask register and the arbitration register of the received message center. The frame is only received when the identifier of the received frame matches the value of the arbitration register. Additionally, the CAN module has a media mask register and a media arbitration register, which can perform additional verification on the 0th and 1st bytes of the received data frame. Figure 6 is a flowchart of the program for receiving data using Message Center 2. The MSRDY, DTUP, and MTRQ bits are bits of the Message Center 2 control register C0M2C. 5. Conclusion The DS80C410 is a network microcontroller with Ethernet and CAN. It includes a 10/100 Ethernet MAC, three full-duplex hardware serial ports, eight bidirectional 8-bit ports, an optional CAN 2.0B controller, a 1-Wire® host, 64 I/O pins, and 64KB of internal SRAM for storing user applications and the network stack. The embedded CAN module supports standard (11-bit) and extended (29-bit) identifiers and universal masks, media byte filtering, DeviceNet™, SDS, and high-level CAN protocols, automatic baud rate mode, and SIESTA low-power mode. The cafeteria meal dispensing system based on the DS80C410 embedded CAN bus not only boasts excellent stability, security, and reliability, but also strong real-time response capabilities, convenient network maintenance, a user-friendly interface, and easy software use, upgrades, and porting, all at a low cost. Key innovations of this paper include: the high integration of the DS80C410 with 16MB of contiguous storage, enabling simultaneous monitoring of the window and keyboard; a system clock frequency of up to 75MHz, resulting in a single-cycle instruction time of only 54ns; the embedded CAN module simplifies the hardware structure of the window unit, saving hardware resources; and the 15 message centers of the CAN module enhance communication efficiency. Operating the CAN module is identical to operating the microcontroller's external program/data memory, making software implementation straightforward. References: [1] Dallas/Maxim semiconductor. DS80C410/DS80C411 Network Microcontrollers with Ethernet and CAN, 2005. [2] Dallas/Maxim semiconductor. High-Speed ​​Microcontroller User's Guide, 2004. [3] Dallas/Maxim semiconductor. High-Speed ​​Microcontroller User's Guide: Network Microcontroller Supplement, 2005. [4] Rao Yuntao, Zou Jijun, Zheng Yongyun. Fieldbus CAN Principles and Application Technology [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2003. [5] Ren Min, Zhao Yuehua. Application of Embedded CAN Bus in Intelligent Relay [J]. Electric Power Automation Equipment, 2003, (11): 0060-03, P60~62. [6] Dallas/Maxim Integrated Products Company. CAN Bus and its Integration Solution [J]. Today's Electronics, 2003(5), P29~31. [7] Zou Jijun, Rao Yuntao, Zheng Yongyun, Feng Lin. Application of CAN bus in canteen meal service system [J]. Journal of Xiamen University (Natural Science Edition), 2001(8), Supplement 1, Vol. 40, P252~254. [8] Zou Jijun, Rao Yuntao. Design of canteen meal service system window machine [J]. Journal of East China University of Technology, 2004(3), Vol. 27, P293~297. [9] Tian Xihui, Zhang Qi, Zhang Lianchao, Luo Shitu. CAN bus and its application technology [J]. Microcomputer Information (Measurement and Control Automation), 2004, (10).
Read next

CATDOLL 123CM Milana TPE

Height: 123cm Weight: 23kg Shoulder Width: 32cm Bust/Waist/Hip: 61/54/70cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22