Analysis of Graphical Programming Methods for Single Chip Microcomputers

Publisher:脑洞飞翔Latest update time:2011-11-02 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Single-chip microcomputers can be programmed in assembly language, high-level languages ​​C and Basic, or graphical languages. Programmable controllers are widely used in industrial control. The microcontrollers in their CPU modules are often ordinary single-chip microcomputers, while programmable controllers can be programmed in ladder diagrams or flowcharts. The current intelligent educational robot controllers all use single-chip microcomputers, and most of these robots support flowchart programming. The Ability Storm series robots of Shanghai Guangmaoda Electronic Information Co., Ltd. use VJC visual flowcharts and C language programming; the Zhongming robot series uses Robot Express software programming, which is also a visual flowchart and C language programming; the Lego series of Simia, Bosiweilong robots, the VEX series robots of the United States, and the robot DIY series of Ssangyong can all be programmed in visual flowcharts and C language. The core of the control system of these robots is a single-chip microcomputer. It can be seen from this that the development of ordinary single-chip microcomputers can definitely use flowchart programming. In fact, the flowchart compilation software of the robot can be used as the programming software of the corresponding single-chip microcomputer in turn. The following example uses a detailed explanation of how to use graphical programming for single-chip microcomputers.

1 Problem Description

On a certain machine, two motors drive the workbench to move sequentially through ball screws, as shown in Figure 1. The two motors are controlled by a single-chip microcomputer system to achieve the specified sequential action. When the travel switch KX1 is pressed, motor D1 drives the clamping mechanism to move right. When it moves right to the impact block pressing KX2, motor D1 stops, and this state is delayed for a period of time T1. Motor D2 starts to move in the following order: when the travel switch KX3 is pressed, motor D2 drives the workbench to move right. When the workbench moves right to the impact block pressing KX4, motor D2 stops, and this state is delayed for a period of time T2; then motor D2 reverses and drives the workbench back to the left. When the workbench returns to the left and presses KX3, motor D2 stops, and motor D1 reverses at the same time, loosens the clamping mechanism until KX1 is pressed, and motor D1 stops.

Click here to view the image in a new window
Figure 1 Sequential actions of the clamping mechanism and the workbench

The sequence is shown in Figure 2.

Click here to view the image in a new window
Figure 2 Action sequence diagram

2. Composition of single chip microcomputer control system

There are many schemes to realize the above control functions, such as relay contactor control system, programmable controller control system, single-chip microcomputer control system, etc. This paper uses single-chip microcomputer control system to realize the above control action. The composition of single-chip microcomputer control system is shown in Figure 3.

Click here to view the image in a new window
Figure 3 MCU control system structure diagram

The single-chip microcomputer uses the MC68HC11E1 of Motorola. In order to meet the needs of the simulation experiment, the single-chip microcomputer control system uses the main control board of the Ability Storm robot ASUII of Shanghai Guangmaoda Electronic Information Co., Ltd. The travel switches KX1~KX4 are simulated by the collision switches on the robot, and the collision switch circuit is shown in Figure 4(a). The motors D1 and D2 are simulated by the driving motors of the two wheels of the robot, and the circuit is shown in Figure 4(b). Among them, the motor drive chip selected is SN754410 of TI.

Click here to view the image in a new window
Figure 4. Collision switch circuit and drive motor circuit on the AbilityStorm robot

3 VJC Procedure Flow

Use the programming development environment VJC1.6 of the Ability Storm robot (which can be downloaded from the website of Shanghai Grandar Electronic Information Co., Ltd. www.grandar.com ) to compile, debug and download the program. For the above-mentioned single-chip dual-motor start-stop control system, the flowchart compiled by VJC1.6 is shown in Figure 5. For the actual single-chip control system, as long as the corresponding sensors and their drive circuits, motors and their drive circuits are changed to components that adapt to the actual object, this single-chip control board and corresponding programming software can still be used. Further applications can expand the software and hardware system.

The overall program is a cyclic program. In each cycle, the four collision switches are detected in turn, and the motor is started or stopped according to the motor's action sequence. The use of program modules and the setting of variables are omitted here. Please refer to the manual or contact Shanghai Guangmaoda Electronic Information Co., Ltd.

The flowchart of FIG5 can be converted into a C language program in the VJC1.6 environment. For details, please refer to the use of VJC1.6.

Programs compiled in the VJC1.6 environment, whether flowcharts or C language programs, can be directly downloaded to the flash memory or EEPROM of the microcontroller, which is why this programming and development method is popular. However, this method is currently only used in the program development of intelligent robots with microcontrollers as the core. There is no such graphical programming environment specifically for microcontroller development. I believe that this method will appear in the near future.

Click here to view the image in a new window
Figure 5 Dual motor start-stop control flow chart

Conclusion

The functions realized by the single-chip microcomputer system here are equivalent to a programmable controller system, and the programming language is a flowchart language. It can be seen that some single-chip microcomputer systems can be slightly expanded to become a fully functional programmable controller that can use flowchart programming, C language programming and assembly language programming, thus keeping pace with existing programmable controllers in the field of industrial control.

Keywords:MCU Reference address:Analysis of Graphical Programming Methods for Single Chip Microcomputers

Previous article:1-wire system TM card single chip equivalent replacement
Next article:Clock Synchronization in Distributed Data Acquisition Systems

Recommended ReadingLatest update time:2024-11-17 04:54

Research on the application of complex system based on single chip microcomputer with dual CPU
This paper introduces the characteristics of the MC145152-2 chip and analyzes the method of designing a 1 800 MHz frequency synthesizer using this chip. This frequency synthesizer has low phase noise and high frequency stability, and it will be widely used in mobile communications and other fields. Keywords: freq
[Industrial Control]
Research on the application of complex system based on single chip microcomputer with dual CPU
Analysis of the transplantation of embedded real-time operating system μC/OS-II on S12 microcontroller
  1 Introduction   In an embedded system that adopts the foreground and background system software design mode, the main program is an infinite loop, a single task is executed sequentially, and asynchronous events are handled by setting one or more interrupts. This system is OK for simple applications, but for applica
[Microcontroller]
Analysis of the transplantation of embedded real-time operating system μC/OS-II on S12 microcontroller
Use of MCU Timer 0
The function of this program is to make the PA port flash every 0.5 seconds. The program is as follows   include avr/io.h #include avr/interrupt.h #define F_CPU 8000000UL int k; int main(void) {    DDRA=0XFF;    PORTA=0xff;    TCCR0=0X05;    TCNT0=256-F_CPU/1024*0.5;    TIMSK=0X01;    sei();    while(1
[Microcontroller]
Play with 51 microcontroller (1): light up the LED light
01 New project and lighting of small LED lights. LED lights are light-emitting diodes. They have unidirectional conductivity. For light-emitting diodes, it is necessary to select a suitable current-limiting resistor based on its voltage drop and rated current. Open the Keil4 software. Select Project, New uVision Proje
[Microcontroller]
Play with 51 microcontroller (1): light up the LED light
1. Introduction to CC2530 microcontroller
A single-chip microcomputer is an integrated circuit chip that contains multiple functional components such as a central processing unit CPU, random access memory RAM, read-only memory ROM, input and output I/O interfaces, interrupt control system, timer/counter and communication. The microcontroller used in th
[Microcontroller]
1. Introduction to CC2530 microcontroller
Detailed Analysis of Electromagnetic Compatibility Design of Single Chip Microcomputer System
 As MCU systems are increasingly used in consumer electronics, medical, industrial automation, intelligent instrumentation, aerospace and other fields, MCU systems are facing increasingly serious threats from electromagnetic interference (EMI). Electromagnetic compatibility (EMC) includes two aspects: emission and se
[Microcontroller]
Detailed Analysis of Electromagnetic Compatibility Design of Single Chip Microcomputer System
Review of STM32F103 MCU reset circuit
When designing a "single-chip microcomputer control circuit board", four circuits are generally required: "power supply circuit part", "crystal oscillator circuit part", "reset circuit part" and "download circuit part". Different "IC chips" require different "power supply voltages" for operation, most of which are "+3
[Microcontroller]
Review of STM32F103 MCU reset circuit
Next-generation automotive microcontrollers: STMicroelectronics technology analysis
STMicroelectronics (ST) has been deeply involved in the automotive market for more than 30 years, and its products and solutions cover most application systems in ordinary vehicles. With the development of the market, STMicroelectronics' products are also constantly upgraded and improved, and its important product,
[Automotive Electronics]
Next-generation automotive microcontrollers: STMicroelectronics technology analysis
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号