تصميم واجهة الأجهزة يتكون نظام التحكم الموضح في هذا البحث من كمبيوتر صناعي والعديد من أجهزة الكمبيوتر ذات الرقاقة الواحدة - AT89C2051. يستخدم نقل البيانات بين السيد والعبد اتصال تسلسلي غير متزامن. نظرًا لأن منفذ الاتصال التسلسلي للكمبيوتر الصناعي عبارة عن واجهة RS {6}} 232C ، فإن المستوى المنطقي له متماثل مع الأرض ، والذي يختلف عن خرج مستوى TTL بواسطة المنفذ التسلسلي للحاسوب المصغر أحادي الشريحة AT89C2051. لذلك ، من الضروري ضمان نقل موثوق للبيانات بين الاثنين. يجب توصيل محول المستوى بخط الاتصال. تتضمن رقائق محول المستوى الشائع رقائق ICL232 و MAX232. يستخدم هذا النص شريحة تحويل المستوى MAX232.
Multiple single{{0}}chip computer communication circuit 2 software design 2.1 AT89C2051 single-chip computer multi-computer communication function AT89C2051 single-chip microcomputer serial port has: serial send buffer/receive buffer (SBUF), serial port control register (SCON), special function register ( PCON). There are 4 working modes by setting SCON, among which working modes 2 and 3 are suitable for multi-computer communication. The serial communication mode 3 of the AT89C2051 single-chip microcomputer is a 9-bit data asynchronous communication mode with a variable baud rate, and is also the most widely used mode in multi-computer communication at present. Here, AT89C2051 transmits a frame of information with 11 bits in total: 1 start bit, 8 data bits, 1 bit can be programmed to be the 9th bit of "1" or "0" and 1 stop bit, among which The ninth bit of data can be used as a parity bit, and can also be used as an identification flag for "address frame" and "data frame".
وظيفة اتصالات الكمبيوتر الصناعية: الكمبيوتر الصناعي مجهز بمنفذ اتصال تسلسلي غير متزامن (عنوان منفذ COM1 هو 3f8H ، وعنوان منفذ CM2 هو 2f8H) ، وجهاز الاستقبال / المرسل العالمي غير المتزامن (UART) على لوحة الواجهة عبارة عن قطعة من 8250 أو قطعة من الهيكل ، طريقة البرمجة نفس الشريحة 8250 مع 10 سجلات بالداخل. برمجة الاتصال التسلسلي للكمبيوتر الشخصي ، يحتاج المبرمجون فقط إلى استخدام أوامر الإدخال / الإخراج لإدخال / إخراج السجلات في UART ، وذلك لتعيين معدل البث بالباود للاتصال التسلسلي ، وتنسيق نقل البيانات ، سواء للسماح بالمقاطعات ، أو إرسال البيانات أو تلقيها انتظر.
طريقة اتصال جديدة متعددة - للآلات في - طريقة الاتصال التقليدية متعددة الأجهزة ، تم استخدام بت التماثل كبت مميز لرمز عنوان الإرسال (رقم القناة) أو البيانات ، والتحقق من يعتمد اتصال البيانات على طريقة التراكم والتحقق. لا يؤدي استخدام هذه الطريقة إلى زيادة الحمل على البرنامج وكمية البيانات للاتصال فحسب ، بل يؤثر أيضًا على أداء الوقت الحقيقي -. 2.3.1 المبادئ الأساسية للاتصال
The data is 5 2 - set to "0" directly, and make plus , clear, then no matter what the value of the ninth bit data ( plus 9 8) is, the lower computer can generate serial reception interrupt, so the ninth bit can be used as Error detection parity bit too. For example, when the upper computer communicates with a lower computer, the address code is sent first, and then the data command is sent after the handshake is successful. At this time, the FLAG of the lower computer is set to "1", which is equivalent to the "pocket" of the machine has been opened. The computer continuously fetches data from the lower-position computer, and issues a command to restore the FLAG in the lower-position computer to "0" after fetching without error to realize "closing the pocket".
عندما يرسل الكمبيوتر السفلي البيانات إلى الكمبيوتر العلوي ، فإنه يرسل أولاً طول البيانات المراد نقلها ، ثم يبدأ في إرسال البيانات الصالحة.
It is agreed that {{0}}H is the fetch command, 0FFH is the reset command, the communication adopts even parity, and the baud rate is set to 2400b/s. The flow chart of the main function of the PC is given above, as shown. The PC communication program is written in VC plus plus 6.0 language. The communication module of the lower single-chip microcomputer includes the main program and the interrupt service program, and its program flow chart is shown in and respectively. How to realize the one-to-one communication between the upper computer and the lower computer with the corresponding sending address? Software method can be used. The specific method is as follows: a flag variable FLAG is set up in the lower computer program, and FLAG is set to "0" during initialization. When the upper computer sends data, each lower computer will generate a receiving interrupt, and the interrupt service routine first judges the value of the local FLAG. . If FLAG is "0", compare the received data with the local address, if it is consistent, set FLAG to 6", and send back the local address code as a response, otherwise jump out of the interrupt service routine immediately; if FLAG is "1" , indicating that the control command sent by the upper computer is transferred to the corresponding command processing program, and finally jumps out of the interrupt service routine and returns to the main program. After the communication between the upper computer and the lower computer is completed, the FLAG of the lower computer is set to "0" .If the handshake fails, the upper computer sends a reset command to the lower computer, and then starts the handshake again, if it fails three times, it will turn to error processing.
Implementation method and reliability measures of industrial computer software ①Number each lower computer and use it as the address code of the computer.
الخلاصة توضح هذه المقالة طريقة واحدة فقط للواجهة التسلسلية لنظام التحكم الموزع ، ولكن هناك العديد من طرق واجهة الاتصال بين كل جهاز ، مثل: التوصيل المباشر للمنفذ التسلسلي (عندما تكون المسافة قصيرة) ، الاتصال عبر المودم ، إلخ. في برمجة البرامج ، تتم كتابة الآلة التابعة مباشرة بلغة التجميع للحاسوب الصغير ذي الشريحة الواحدة - ؛ ويمكن أيضًا تنفيذ وحدة روتين الاتصال للكمبيوتر الصناعي بعدة لغات. لذلك ، في تصميم النظام المحدد ، يمكن اختيار إحدى الطرق وفقًا للوضع الفعلي ، ويمكن النظر في تقنية اكتشاف الأخطاء وتصحيح الأخطاء في البرمجة ، ويمكن إكمال الاتصال الموثوق.

