摘要
用VB ActiveX控件可实现单片机与上位PC间的串行通讯。上位机用VB6.0编程,打开VB项目,添加Mscomm、Label、TextBox等控件并设置控件属性,再进行代码设计。下位机用汇编语言编程,设置串行口的工作方式与波特率、发送并接收数据。单片机从EEPROM中读取数据,通过RS-232将其传入PC进行校验,校验正确回送校验指令1,单片机继续发送数据并将数据存储,校验不正确,回送数据0,单片机重发数据直到正确为止。
The serial communication between PC and MCU is realized with VB ActiveX. Upper PC is programmed with VB6.0, open VB item, add Mscomm, Label and TextBox controls etc., and set attribute of controls, and then design code. Lower PC is programmed with assemble language, set working mode and baud rate of serial port, send and receive data. MCU reads data from EEPROM, and send it to PC via RS-232, send back checking commond 1 after checked, MCU continuously sends data, store data and checks data, if data is not right, send-back commond 0, MCU sends data again until data is right.
出处
《兵工自动化》
2004年第2期70-72,共3页
Ordnance Industry Automation