詳細介紹工控軟件組態王與單片機多機串口通訊的設計原理。分析組態王提供的直接與單片機串口通信方法的優點,給出系統基于RS-485總線傳輸的接口電路原理圖。根據組態王提供的通訊協議和單片機多機串口通訊的原理,給出程序設計流程與思路。
Abstract:
In this paper,the design principle of communication between multi-SCM and KingView by serial ports is described in detail.We analysis the advantage of method supplied by KingView,by which KingView can communicate with serial ports of SCM directly,and provide the system’s interface circuit based on the RS-485transmission line.We provide flow diagram of programming and thinking on the basis of communication protocol supplied by KingView and principle of communication among multi-SCM through serial ports.
為了解決磁放大器性能測試過程中,需要對其供給不同數值恒定電流的問題,設計了一種基于DAC7512和單片機的數控恒流源系統。該系統采用AT89C51作為主控器件,將計算機發送的電流控制字命令轉換為D/A轉換器控制字,通過模擬SPI通信接口,寫D/A控制字到DAC7512,從而控制其輸出相應數字電壓值,經差動縮放電路、電壓/電路變換電路和功率驅動電路,最后輸出恒定電流。實驗結果表明,恒流源輸出電流調節范圍為-45~+45 mA、精度為±0.1 mA,分辨率達0.024 4 mA,具有應用靈活,外圍電路簡單,可靠性高的特點。該數控直流恒流源也可為相關產品的測試系統研發提供參考。
Abstract:
In order to solve the need to supply different values constant current for the magnetic amplifier in testing process, numerical control constant current source system was designed based on DAC7512 chip and microcontroller technology. The system used the AT89C51 as the main chip, which can convert the current control word from computer into to D/A control words. And the system wrote D/A control word into the DAC7512 chip to control the output voltage value by the SPI communication interface, which can output corresponding constant current figures by scaling circuit, the V/I converter and power drive circuit. Experimental results show that the current source output current adjustment range is -45~+45mA, accuracy is ± 0.1mA, and resolution ratio is 0.024 4mA