Real-time information collection of workshop monitoring system based on barcode technology

Publisher:BlissfulHikerLatest update time:2006-05-07 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Abstract This paper discusses the implementation of information collection for workshop monitoring systems using barcodes as information carriers, analyzes the required information and its barcode encoding, and introduces the implementation method of real-time data collection using RS-232 serial port interrupt mode under Windows 95 environment, as well as customer /A means to realize dynamic data transmission (DDE) between the data acquisition module and the monitoring module in the server organization mode.

    Keywords barcode data collection dynamic data exchange (DDE) interrupt    

    With the widespread application of computers, production technology has undergone revolutionary changes, and flexible manufacturing systems (FMS) have been widely used abroad. However, for most enterprises in my country, highly flexible manufacturing systems are still an unbearable burden. In some electrical appliance industries with large production volumes, such as refrigerators, washing machines, air conditioners, etc., manual assembly is the mainstay. , the production line form with many production stations still occupies a dominant position.

    Due to the lack of information monitoring means, this type of production system will have various problems: the lack of quantitative relationship between work station loads, the inability to balance production with changes in production goals and production conditions, the lack of production monitoring information, failure events cannot be handled in a timely manner, and the lack of logistics flow Guidance, poor connection between workstations leads to blockage and material shortage incidents.

    Barcodehereinafter referred to as barcode technology has a wide range of applications due to its advantages such as fast input speed, high accuracy, low cost and strong reliability. The workshop monitoring and management system we developed based on barcode technology is an example of the application of this automatic identification technology in the industrial field. Its purpose is to monitor the production status of the assembly line of a copy machine factory. Barcodes containing various production information are either affixed to components and finished products, or placed at corresponding workstations. The entrance and exit of the assembly line are equipped with automatic barcode scanners, and each workstation is equipped with manual barcode scanners. These barcode scanners pass The barcode scanning network device is connected to the workshop monitoring computer. During actual operation, the automatic or manual scanner sends the barcode information to the workshop monitoring computer, and the monitoring software running on it can dynamically simulate the real-time actions of all assembly lines in the entire workshop. Once faults and alarm information are found at each workstation, the on-duty personnel will be notified promptly. The on-duty personnel can query the fault and alarm information through the system, and dispatch maintenance personnel for emergency repairs according to the reference processing methods provided by the system.

    1 System hardware and software structure

    The hardware structure of the system is shown in Figure 1.

    The software structure of this system is divided into two parts: (1) Data acquisition module: converts barcode information into control signals; (2) Monitoring module: dynamic display and production scheduling of various statuses of the production line. The software operating system uses Windows95. Since the data acquisition module involves low-level hardware operations, C++ is more suitable. The monitoring module takes into account both animation and database operations, so we use VB4.0. The exchange of barcode information between the data acquisition module and the monitoring module process is implemented using the dynamic data exchange (DDE) of the Windows system. The system software structure is shown in Figure 2.

    Based on the above system software and hardware structure, to convert barcode information into control signals that reflect the current status of the production line, we must complete three aspects of work: (1) Production information analysis and coding; (2) Use RS-232 serial port for information collection; (

3 ) Use DDE to realize communication between the data acquisition module and the monitoring module. This article gives the implementation of the above three functions.

    2 Production information analysis and coding    

    The workshop monitoring system must use modern management methods to arrange the production process in the most reasonable manner, detect and eliminate faults in a timely manner, and keep each production process in the most ideal normal working condition. For this purpose, the required production information can basically be divided into the following aspects:

    Artifact monitoring

    The situation of the workpiece (referring to the components or finished products on the assembly line), including the current location, assembly status, assembly time, and key test data.

    Operator monitoring

    Including monitoring of operator positions, working status, technical level, and unexpected requests.

    Production process monitoring

    Including the start/stop of the assembly line, the logistics status of the production system, the variety and quantity of workpieces completed by each production unit, the actual labor load of each station, etc.

    Fault monitoring

    Including direct failures and indirect failures. Direct faults refer to fault information that clearly includes the fault source, such as equipment failure, insufficient parts, etc.; indirect faults refer to system-level faults caused by unknown fault sources, such as system productivity being significantly lower than rated productivity, etc.

    Monitoring of key workstations

    Including the monitoring of various data of important workstations that directly affect the entire production system process. There are mainly workstations with relatively saturated production labor loads, workstations with many production restrictions, such as many types of parts, many supply sources, many auxiliary equipment, etc., workstations with high technical and technological requirements, etc.

    Based on the above analysis of production information, the monitoring and management system must realize automatic identification of tracking and monitoring objects. The best way at present is to use automatic barcode recognition technology. The most commonly used code in industry is code 39, and this system also uses this code system. The barcodes required to design the above production information using the 39-code system are as follows:

    · Workpiece label barcode: Each finished product or important component is affixed with a barcode, which is an identifier of its identity.

    · Attendance bar code: contains the information of the operator at the work station.

    · Operation status barcode: contains assembly start/end information and is used to monitor the operation status of the workstation.

    · Equipment fault/troubleshooting barcode: used to monitor equipment faults.

    · Abnormal alarm barcode: used to indicate various fault information except equipment faults.

    ·Assembly line status barcode: contains information such as the start and stop of production of the assembly line.

    · Undo the input barcode: indicates the cancellation of the previous barcode input, which is used for fault tolerance of workstation data input.

       

    3 RS-232 serial communication of data acquisition module

    In this monitoring system, the barcode information is sent to the serial port COM2 of the workshop monitoring computer through the barcode scanner (COM1 is occupied by the mouse). Therefore, the real-time collection of barcode information is the real-time collection of serial port data. There are three methods to implement serial communication under Windows95 platform:

    (1) Timing collection method. Set a timer to generate a WM_TIMER message every once in a while, and the corresponding function of this message reads the data in the serial port buffer. This method is simple to implement, but has the following disadvantages: First, it is limited by the Windows timer data resolution, and the maximum sampling frequency is 18.2Hz. In addition, the WM_TIMER message has a low priority in the Windows message queue and may not receive a timely response. The most important point is that Windows will merge several WM_TIMER messages in the message queue that have not had time to process into one, which means that the first few timer messages did not get a response, which may lead to data loss.

    (2) Under the Win95 operating platform, use its feature of supporting multi-threading to open a thread specifically to read serial port data. Whenever data arrives from the serial port, this thread is activated and reads the data in the serial port buffer; when there is no data, the thread is suspended. Although the priority of the thread can be set, this collection method is still not called real-time communication.

    (3 Interrupt mode in protected mode. Windows supports a special DOS service called DOS protected mode interface DPMI (DOS protected Mode Interface), which consists of some INT 2FH and INT 31H. You can use the soft interrupt IINT 31H to hang The protected mode interrupt vector handles external real-time events in an interrupt manner. This method is very suitable for barcode information collection that does not have a large amount of data but requires accurate and timely response. Therefore, we adopt this method. The specific implementation plan is as follows:

    When the main window of the information collection module is created for the first time, Windows delivers the WM_CREATE message to it. In the message response function, the 0204H function of INT 31H is called to save the old interrupt vector, and the 0205H function of INT 31H is used to point the interrupt vector to When the new interrupt service routine exits the monitoring and management module, Windows will deliver the WM_DESTROY message to it. In the message response function, the 0205H function of INT 31H is called to restore the old interrupt service routine. The above steps are implemented in the VC++1.52 integrated development environment using embedded assembly. It mainly includes the following functions

    · Initialize serial port 2 (VOID PASCAL InitCom2())

    Save the current status of COM2, and then set the baud rate of COM2 to 9600, 8 bits per character, and 1 stop bit. Allow 0xOc number interrupt.

    · Interrupt initialization (BOOL PASCAL InitComm())

    Call DMPI, save the old protected mode interrupt vector number 0CH, and set up a new protected mode interrupt service routine.

    · Interrupt service routine (void_interrupt_far new_int())

    Process the receipt of information. Determine the type of information. If it is an abnormal message, a custom WM_INTERRUPT1 message is sent to the main window; if it is a general message, a WM_INTERRUPT2 message is sent.

    · Interrupt recovery (VOID PASCAL Restore_Comm())

    Restore COM2 state and restore 0CH protection mode vector.

    Whenever barcode information arrives from the serial port, an 0CH interrupt will occur to ensure that the message is processed in time, thus realizing real-time collection of barcode information.

    4. Implementation of DDE between data acquisition module and monitoring module

    The data acquisition module uses the interrupt method to collect the barcode information of the serial port COM2 in real time, and at the same time, it also needs to pass the collected data to the monitoring module. The information exchange between the two is realized using the dynamic data exchange (DDE) of the Windows system.

    4.1 Dynamic Data Exchange (DDE)

    Dynamic Data Exchange (DDE) is a form of communication between processes, and a DDE session is a means of achieving process communication. It is always carried out between a client program and a server program. The application that initiates the session and asks to receive data is the client program. The program that responds to the client program's requests and provides data is the server program.

    In early versions of Windows, DDE sessions were implemented by sending messages to each other between processes. The DDE protocol is a set of predefined messages. The data sent is contained in the two parameters of the message (wParam and 1Param). .

    In later versions of Windows 3.0, an advanced DDE solution is adopted, namely the Dynamic Data Exchange Management Library (DDEML). DDEML provides a series of APIs that encapsulate traditional DDE messages and various accompanying features in a function. In the calling interface, applications implement DDE sessions by calling functions in DDEML to exchange data or provide services to each other. In DDEML, transactions are passed between processes. A transaction is a request for data and services, which is represented by a set of predefined constants. The entire communication process revolves around transactions: First, the client program issues a request to the server program. After the server responds, the connection is established; after that, the client sends a transaction requesting data to the server, and the server provides the required data to the client. This process can be performed multiple times after the connection is established; finally, when When the client no longer needs the data, it sends a transaction to terminate the connection to the server, thus ending a DDEML session.

    4.2 Implementation of DDE server (the tool is VC++1.52)

    There are three modes of DDE sessions: cold chain, warm chain, and hot chain. Since the collected data must be processed by the monitoring program in a timely manner, we use a hot chain method to transmit data, that is, as soon as data arrives, the collection server will immediately transmit the data to the monitoring program.

    Next we apply the DDEML mechanism to implement data transmission programming. The steps are as follows:

    Step 1. Create callback functions for processing various DDEML transactions (HDDEDATA EXPENTRY_export DdeCallBack(WORD wType,WORD wFmt,HCONV hConv,HSZ hxz1,HSZ hsz2,HDDEDATA hData,DWORD1Data1,DWORD 1Data2)

    In DDEML, transactions are passed between processes. According to actual needs, the transactions that the callback function should handle are as follows:

    ·XTYP_CONNECT and XTYP_CONNECT_CONFIRM

    Verify that the client is connected to the collection server.

    ·XTYP_ADSTART

    Reply to customer's request for hot link start.

    ·XTYP_ADVREQ

    When the collection server receives the information, it passes the information to the client to realize dynamic data exchange.

    ·XTYP_ADVSTOP

    Reply to the customer's request for hot link termination.

    ·XTYP_DISCONNECT

    Reply to request for end of link between client and server.

    Step 2. Initialize DDEML (BOOL PASCAL InitializeDDEML(HWNDhWnd)) informs DDEML that the program will start using the DDE mechanism.

    Step 3. Register service name, subject name and project name (BOOL PASCAL InitializeDDEML(HWND hWnd))

    This involves WINDOWS's three-level service name management system. They are; Service Name (Server Name), Topic Name (Topic Name), and Project Name (Item Name). First of all, an application as a server must have a service name. When a client application wants to talk to the server, it specifies the server when issuing a link transaction, thereby identifying the server; the topic name refers to each service supported by a server. The name of a session-like topic. During a session, the client program can only have a conversation with the server on a certain topic. The client specifies the conversation topic of interest when issuing a link transaction; the project name is the name of various data items about a topic. , after the link is established, customers can request data from different projects, but they can only be within the scope of the current topic. A server can determine the themes it supports and the individual projects each theme has. Therefore, the service name enables clients to find the server, and the subject name and project name together identify the data the client needs.

    Here, the service name is Server, the theme name is TiaoMa, and there are two project names. One is called BaoJing, which is dedicated to transmitting abnormal information; the other is named RuKu, which is specialized in transmitting general information.

    Step 4. End DDEML use (BOOL PASCAL cleanUpDDEML(HWND hWnd))

    When clients no longer need the server's data, the server needs to be decommissioned.

    4.3 The implementation tool of DDE client is VB4.0

    Microsoft's Visual Basic is known as the fast shooter for Windows program development. It is very convenient to use it to develop Windows programs. We develop the multimedia and database operation parts of the monitoring system under VB4.0. Therefore, it is necessary to create a DDE client program under VB. The specific programming content is as follows

   (1) Determine the service name, subject name and project name. Put two text boxes (assumed to be Text1, Text2) in the Startup Form (assumed to be Form1), then right-click on the text box, select Properties in the pop-up menu, and change Text1 and Text2 in the pop-up properties dialog box. The LinkTopic of Text2 is set to "Server1TiaoMa", the LinkItem is "0", the LinkIdtem of Text1 is set to "RuKu", and the zlinkIdtem of Text2 is set to "BaoJing", or you can add the following lines to Sub Form1_Load()

    Form1.Text1.LinkTopic="server1TiaoMa"

    Form1.Text1.LinkItem="RuKu"

    Form1.Text2.LindTopic="server1tiaoMa"

    Form1.Text2.LinkItem="BaoJing"

   (2) Establish a connection. In the main control program, use VB's Shell() function to start the collection server, which is also a DDE server, to start collecting data, and then add the following statements

    Form1.Text1.LinkMode=1

    Form1.Text2.LinkMode=1

   (3) Dismantle the connection. Add the following statements to Sub Form1_Unload():

    Form1.Text1.LinkMode=0

    Form1.Text2.LinkMode=0

    At this time, the DDE client program sends a transaction to terminate the connection to the DDE server, ending a DDEML session process.

    The implementation of DDE is shown in Figure 3.

    This system uses barcode automatic identification technology, so that various information on the workshop production line can be quickly and accurately transmitted to the monitoring and management system, so that the system can make various responses in a timely manner and improve factory production efficiency.

    During the development process, the technical problem of real-time data collection in the Windows operating environment was solved. At the same time, DDE is a good way to exchange information between processes under Windows. Visual Basic, a rapid development tool for Windows applications, has many advantages. It is very convenient to use it to develop multimedia animations, database queries and other programs. However, as an interpreted execution language, we must not use it in real-time monitoring systems at industrial sites. The possible impact of not carefully considering its running speed needs to be overcome by taking appropriate measures.

Reference address:Real-time information collection of workshop monitoring system based on barcode technology

Previous article:100MHz programmable digital signal generator
Next article:Implementation of intelligent cold cathode ionization gauge controller based on fieldbus

Latest Test Measurement Articles
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号