Design of fieldbus communication interface based on Profibus-DP

Publisher:as8849402Latest update time:2012-04-17 Source: 现代电子技术 Keywords:Profibus-DP Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

O Introduction

Profibus is an open standard that has nothing to do with manufacturers and has no intellectual property protection. Therefore, anyone in the world can obtain the standard and design their own software and hardware solutions. There are two options for the development of the Profibus-DP communication interface: single-chip microcomputer + software; single-chip microcomputer + Profibus communication chip ASIC.

In solution 2, the Profibus-DP protocol is completely implemented by the Profibus communication ASIC, and the microcontroller mainly processes the user program. Therefore, the development cycle of solution 2 is relatively much shorter. This article will use the microcontroller + Profibus communication ASIC to implement the design of the Profibus communication interface.

1 Basic characteristics of Profibus-DP

Profibus includes three compatible series: Profibus-FMS, Profibus-DP, Profibus-PA. FMS provides a large number of communication services for completing cyclic and non-cyclic communication services at medium transmission speed; DP is an optimized high-speed and low-cost communication connection, suitable for occasions with high real-time requirements, mainly used for communication between automatic control and distributed peripherals; PA is designed for process automation, has intrinsic safety, and is used in occasions with high safety requirements and bus-powered stations.

1.1 Protocol Structure

The Profibus-DP protocol uses the first layer (physical layer) and the second layer (data link layer) of the ISO/OSI model, removes layers 3 to 7, and customizes the user interface layer. This protocol structure ensures fast and effective data transmission.

1.2 Message Structure

Profibus-DP data encoding uses asynchronous non-return-to-zero system, and the no-load level of the transmission line is "1". In order to avoid data loss caused by conflicts during data transmission, a 33-bit (synchronous time) no-load state must be guaranteed before each request message is sent. There is no gap when all data is transmitted between single characters, that is, seamless. The formats of various messages are shown in Figure 1.

1.3 Profibus-DP slave state machine

Figure 2 is a simple diagram of the DP slave state machine. The various ovals represent different states, the lines with arrows represent the transitions between states, and the text on the lines represents the conditions that must be met for the state transitions.

Only in the Power_on state can the slave station receive the "Set_Slave_Address" message from the Class II master station to change the slave station address. The slave station should have a non-volatile memory to store the slave station address. After internal startup, the slave station enters the wait_Prm state and waits for the "Wait_Prm" message. The parameterization message is given by the user during configuration, including some standard information, such as identification number, synchronization locking capability, and some user-defined data. In addition, in this state, the slave station can also receive the "Get_Cfg" message and the "Slave_Diag" message, but refuses to process other messages and cannot communicate data. If Set_Prm is correct, the slave station enters the wait_Cfg state and waits for the "Check_Cfg" message, which specifies the master station's configuration information for it, that is, the number of input and output bytes in data exchange. In addition, the "Get_Cfg" message and the "Slave_Diag" message can also be received. When the parameterization and configuration communicate correctly, in this state, the slave can receive the following messages: Data_Exchange_Ok, Writing_outputs, Reading_Inputs, Global_Control, Slave_Diag, Get_Cfg, etc. After receiving the status request from the master, the slave responds with a high-priority diagnostic message. The diagnostic information includes standard diagnostic information and user-related information.

2 Communication Interface Hardware Design

The Profibus-DP communication protocol chip selected in this article is SPC3. SPC3 integrates all Profibus-DP protocols. SPC3 will complete all DP-SAP settings in DP mode. SPC3 integrates 1.5 KB of dual-port RAM, including parameter registers, mode registers, status registers, interrupt controllers, etc. The watchdog timer integrated in SPC3 has three working states: baud rate detection, baud rate control and slave control. The internal USART can realize the mutual conversion between parallel data streams and serial data streams. The micro-sequence controller controls the entire working process. The idle timer directly controls the timing of the serial bus.

Considering the speed requirements of Profibus, this paper selects the high-speed, low-power 16-bit MSP430 microcontroller and adopts the Intel working mode. The CPU and SPC3 interface circuit is shown in Figure 3. For the MSP430 microcontroller, SPC3 is equivalent to an external RAM that it expands. The microcontroller can access the register of SPC3 by accessing the external RAM. One end of the RS 485 driver is connected to SPC3, and the other end is connected to the bus through a 9-pin D-type plug. The RS 485 driver selects SN75SLS176 to meet high-speed data communication. [page]

3 Communication interface software design

Software design is an important part of developing the Profibus-DP communication interface. Since SPC3 integrates the complete DP protocol, the MSP430 microcontroller does not need to participate in processing the DP state machine during communication. The main task is to transfer the data received by SPC3 according to the interrupt generated by SPC3, organize the data to be sent through SPC3, and organize external diagnosis according to requirements.

The main program flow chart is shown in Figure 4. Before SPC3 works normally, it needs to be initialized to configure the required registers, including setting the interrupt enable of the protocol chip, writing the slave identification number and address, setting the SPC3 mode register, setting the diagnostic buffer, configuring the buffer, address buffer, initializing the length, and deriving the pointers of each buffer and the auxiliary buffer according to the above initial values. According to the determination of the output buffer, input buffer and pointer, the initialization flow chart is shown in Figure 5. The initialization includes: SPC3 hardware reset, hardware mode, setting the SPC3 interrupt mask register, SPC3 internal watchdog, device identification number, and buffer initialization.

The interrupt program flow chart is shown in Figure 6. In Profibus-DP, the following interrupt events are mainly processed: new parameter message event, global control command message event, entering or exiting data exchange state event, new configuration message event, new address setting message event, baud rate detected event, and watchdog event.

4 Conclusion

The selected MSP430 microcontroller has the characteristics of high speed and low power consumption, and the SPC3 chip integrates all the Profibus-DP protocol content. The whole system function is relatively complete and the method of use is simple. This solution is used for the development of Profibus-DP communication interface, which can reduce the development cycle and simplify the development.

Keywords:Profibus-DP Reference address:Design of fieldbus communication interface based on Profibus-DP

Previous article:A personal positioning terminal based on GPSOne technology
Next article:Design of Switching Power Supply Control Using MSP430 Single Chip Microcomputer in Power System

Recommended ReadingLatest update time:2024-11-16 21:00

MSP430 My Low Power System Programming Template
It is mainly implemented using the foreground and background program structure. The foreground program is various interruption and other emergencies, and the background program is the main loop, which handles various tasks caused by various events. #include "MSP430G2553.h" int gTaskFlag=0; //Task flag void sysIni
[Microcontroller]
Msp430 clock design and register description
4.1 Basic Clock Module + Introduction Basic clock module + supports low system consumption and ultra-low power consumption. Using three on-chip clock signals, users can choose the appropriate The basic clock module only needs to connect an external resistor, one or two external crystals, or use an oscillator. Co
[Microcontroller]
Msp430 clock design and register description
Profibus-DP Bus Technology and Its Application in Servo Drive
1 Introduction Profibus is an international, open, manufacturer-independent fieldbus standard, widely used in the field of industrial automation. Profibus is divided into three compatible versions according to application characteristics: Profibus-DP, Profibus-FMS, and Profibus-PA. Among them, Profibus-DP i
[Industrial Control]
Digital-to-analog converter AD420 and its interface technology with MSP430
1 Overview AD420 is a high-precision, low-power all-digital current loop output converter produced by ADI. The output signal of AD420 can be a current signal or a voltage signal. The output range of the current signal is 4mA~20mA, 0mA~20mA or 0mA~24mA, which can be configured through the pins RANGE SELECT1 and R
[Microcontroller]
Digital-to-analog converter AD420 and its interface technology with MSP430
Application of MSP430 single chip microcomputer in power system operation power supply
1 Introduction With the improvement of the modern automation level of power systems and the increasing complexity of high-frequency switching power supply structures, people are prompted to adopt new control methods to quickly reflect module changes in order to significantly improve the stable operation level o
[Microcontroller]
Design of high power factor power supply based on MSP430
  In the operation of the power grid, the power factor reflects the degree to which the apparent power output of the power supply is effectively utilized. We hope that the power factor is as large as possible. In this way, the reactive power in the circuit can be reduced to a minimum, and most of the apparent power wi
[Microcontroller]
Design of high power factor power supply based on MSP430
MSP430 read and write flash program
//****************************************************************************** //****************************************************************************** #include  #define FLASH_ADDRESS 0x01000 //define FLASH information area address segment B unsigned char write_buff ={0x01,0x03,0x04,0x09}; //Used to s
[Microcontroller]
Configuration of UCS in MSP430F5529
Compared with MSP430 (F149), MSP430 (F5529) has more powerful functions. UCS Introduction The UCS of the MSP430F5XX/MSP430F6XX series devices contains five clock sources, namely: XT1CLK, VLOCLK, REFOCLK, DCOCLK and XT2CLK. For a detailed introduction to these five clocks, please refer to the instruction manual of this
[Microcontroller]
Configuration of UCS in MSP430F5529
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号