标题: [文件操作] 求助!利用现有函数通信COM串口,控制串口设备。 [打印本页]
作者: vince 时间: 2019-6-11 12:14 标题: 求助!利用现有函数通信COM串口,控制串口设备。
本帖最后由 vince 于 2019-6-11 12:24 编辑
下面是该软件的命令函数和结构,希望有大神能帮我做个基本代码架构,可以通信COM串口,我本地的串口端是COM4。
这个设备是马达旋转台的设备,一共有6个旋转等级。- Software Control
- 1. Application Software Operation
- The FW102C(NEB) and FW212C(NEB) come with a CD-ROM that contains application software to control the unit using USB 2.0, or RS232, from a PC. (See Thorlabs Motorized Filter Wheel Software Manual).
- Minimum PC Requirements
- The application program requires a minimum of a Pentium-class machine running Windows XP or newer.
- Command Line Interface
- The FW102C can also be controlled by a command line language through the USB or RS232 ports. This is offered to enable operation through a terminal interface or for those who may want to write their own program to control the wheel. Prior to running the command line interface, the unit should be powered, and a USB or RS232 cable should be connected between the FW102C and the host. The terminal emulator should be configured as follows:
- Parameter Setting
- Baud Rate 115.2 K Bits per Second
- Data Bits 8
- Parity None
- Stop Bits 1
- Flow Control None
-
- If the connection is correct, you will see the following message after pushing the Enter key:
- 2. Command error CMD_NOT_DEFINED
- This message will be followed immediately by the prompt:
- >
- The basic structure of the interface is a keyword followed by either an equals sign “=” or a question mark “?”. The“=” or “?” will determine if the string is a command or a query. All strings (commands and queries) must be terminated by a carriage return (CR) or pressing the ENTER key on the computer.
- 2.1. Command Structure
- Keyword = argument (CR)
- Here, keyword defines the function, and argument is a numerical value followed y a carriage return (CR).
- 2.2. Query Structure
- Keyword? (CR)
- Keyword defines the function, and the question mark (?) indicates a query. The string is terminated with a carriage
- return (CR). Exceptions to this and unique shortcut keys are given in the table on page 11.
- The prompt symbol “>” will appear on power-up and after a command is accepted by the FW102C and indicatesthat the FW102C is ready to receive another command line.
- 2.3. Keywords (Commands and Queries)
- The following table describes all of the available commands and queries:
-
- Command Syntax Description
- Get ID *idn? Returns the model number and firmware version
- Set Position pos=n moves the wheel to filter position n
- Get Position pos? Position Query
- Set Position Count pcount=n Sets the wheel type where n is 6 or 12
- Get Position Count pcount? Returns the wheel type
- Set Trigger Mode trig=0 Sets the external trigger to the input mode
- ~ trig=1 Sets the external trigger to the output mode
- Get Trigger Mode Trig? Returns the trigger mode
- Set Speed Mode speed=0 Sets the move profile to slow speed
- ~ speed=1 Sets the move profile to high speed
- Get Speed Mode speed? Returns the move profile mode
- Set Sensor Mode sensors=0 Sensors turn off when wheel is idle to eliminate stray light
- ~ sensors=1 Sensors remain active
- Get Sensor Mode sensors? Returns the sensor mode
- Set Baud Rate baud=0 Sets the baud rate to 9600
- ~ baud=1 Sets the baud rate to 115200
- Get Baud Rate baud? Returns the baud rate where 0 = 9600 and 1 =115200
- Save Settings save This will save all the settings as default on power up
-
- "All commands and queries are in lower case letters.
- If the keyword, format, or argument are incorrect or out of range, the unit will return an errorstring.
- In addition to the commands given above, there is also special functionality added to thearrow keys of the computer’s keyboard:
- Key Description
- Up Arrow Increments the filter position by 1
- Down Arrow Decrements the filter position by 1
复制代码
作者: cfwyy77_bat 时间: 2019-6-11 13:11
什么叫 “基本代码架构”?
根据你的文档描述,
1.设备的随机光盘就已经有应用程序可以控制操作设备了。
2. 串口命令行的操作命令也详细说明了。 应该虚拟终端串口连接上,按命令语法就可以操作了。
作者: vince 时间: 2019-6-11 13:44
回复 2# cfwyy77_bat
现在是有软件可以控制这个设备的,想做个可以自动化脚本来控制这个设备,可以通过代码来控制旋转平台。
作者: cfwyy77_bat 时间: 2019-6-12 10:27
FW102C是THorlabs的电动滤光轮?
如果是的话,官方的软件帮助目录里面提供了开发的SDK
里面有底层的dll库,demo的C++源码,有了这些你想干嘛都可以,可以做一个命令行工具能接受一些参数,然后bat或者命令行去调用它。或者直接用其它脚本语言如python,vb等去调dll库。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |