User Tools

Site Tools


tech_note_rs232_comm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tech_note_rs232_comm [2021/04/20 17:40] – jontech_note_rs232_comm [2026/09/22 20:19] (current) – remove references to sending serial commands with Tiger Controller Console brandon
Line 5: Line 5:
 ===== Physical interface ===== ===== Physical interface =====
  
-MS2000 and RM2000 controllers have a physical RS-232 serial port (a 9-pin D-sub connector).  There is a USB Type B connector on all controllers built since ~2008 including TG-1000/Tiger controllers ((For TG-1000/Tiger controllers a separate TG232 card can be added to provide a physical RS-232 port)), which is used with a standard USB cable with Type-B connector on the controller end and the ubiquitous Type-A connector on the computer end.  If your controller can accept more than one physical connector type it does not make a difference which you use.+MS2000 and RM2000 controllers have a physical RS-232 serial port (a 9-pin D-sub connector).  Use with a null modem RS-232 cable.  Since 2008, controllers also have a USB Type B connector.  Use this with a standard USB Type-B to Type-A cable to connect to ubiquitous Type-A USB receptacle on the host PC.  New controllers ship with both a RS-232 and USB cable, and the customer can choose which one to use.
  
-For USB connections, the controller includes a serial comm port emulator chip that requires drivers on the host PC.  Usually the operating system will automatically install the drivers but if not they can be found at https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers.  As of early 2018 there was a bug affecting the "Universal" version of the SiLabs driver when used with the ASI Console programs (depending on .NET), so if you run into trouble with the automatically-installed drivers use the Windows 7/8/10 version 6.x instead.+TG-1000 "Tiger" controllers have USB Type B connector in the required TGCOM communication card.  An optional TG232 card can be added to provide a physical RS-232 port if required.
  
-==== Table 1: Serial Link Info ====+If your controller can accept more than one physical connector it does not make a difference which you use.
  
-^ ^MS2000 and RM2000 ^TG-1000/Tiger ^ +===== Serial Link Info ===== 
-^Baud Rate | <wrap>9600 (default), \\  + 
- 19200, 28800, or 115200 \\  +^ ^MS2000 and RM2000 ^TG-1000 "Tiger" ^ 
-([[ms2000_operation#dip_switches|set by DIP switch]]) </wrap> | 115200 |+^Baud Rate | [[ms2000_operation#dip_switches|set by DIP switch:]] 9600 (default), 19200, 28800, or 115200 | 115200 |
 ^Data Bits | 8 || ^Data Bits | 8 ||
 ^Parity | None || ^Parity | None ||
 ^Stop Bits | 1|| ^Stop Bits | 1||
 ^ Flow Control | None ||    ^ Flow Control | None ||   
 +
 +===== Serial Port Drivers =====
 +
 +For USB connections, the controller includes a serial COM port emulator chip that requires drivers on the host PC.  Usually the operating system will automatically install the drivers, but if not the drivers can be found at the Silicon Labs [[https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers|CP210x USB to UART Bridge VCP Drivers]] downloads page.  
 +
 +As of early 2018 there was a bug affecting the "Universal" version of the SiLabs driver when used with the ASI Console programs (depending on .NET).  If you run into trouble with the automatically-installed drivers then uninstall and use the Windows 7/8/10 version 6.x instead.
 +
 +For troubleshooting connectivity issues in Windows with a USB cable: open Windows Device Manager and expand the section "Ports (COM & LPT)".  There should be an entry with name beginning "Silicon Labs CP210x" that appears when you plug the cable into the controller and disappears when you unplug the cable.  If this happens then the Windows driver is working correctly; note the port name (e.g. "COM3") for use with software.  If you don't see such an entry appearing and disappearing with the cable connection then there is a problem unrelated to software, likely in the Windows drivers but perhaps in the cable or controller.
 +
 +[{{documentation/device_manager.jpg| Windows Device Manager}}]
  
 ===== Software ===== ===== Software =====
Line 24: Line 34:
 All software control is using the serial commands sent over the serial port (or virtual serial port with USB connection).  There are many software choices available. All software control is using the serial commands sent over the serial port (or virtual serial port with USB connection).  There are many software choices available.
  
-Only one program can use the serial port at a time due to the nature of serial ports.  So only one of these softwares can be used at a given time to send commands and receive replies from the ASI controller.+Only one program can use the serial port at a time due to the nature of serial ports.  So only one of these softwares can be used at any one time to send commands and receive replies from the ASI controller.
  
  
-==== ASI Console, ASI Tiger Console, and ASI Tiger Control Panel ====+==== ASI Console, Tiger Controller Console, and Tiger Control Panel ====
  
-ASI Console: for MS2000, RM2000 and FW1000 controllers.  Info and download at [[http://www.asiimaging.com/index.php/support/downloads/asi-console/|here]].  Only software that allows updating firmware onto these controllers.+[[:asi_console|ASI Console]]: for MS-2000, RM-2000 and FW-1000-SA controllers. This is the only software that can be used to update firmware on those controllers. It has some control buttons and the ability to send serial commands.
  
-ASI Tiger Console: for TG-1000/Tiger controllers.  Info and download at [[http://www.asiimaging.com/index.php/support/downloads/tiger-controller-console/|here]].  You can send serial commands using the input box at the bottom of the scripting tab once you have it set up.  Only software that allows updating firmware onto these controllers. +[[:tiger_controller_console|Tiger Controller Console]]: for TG-1000/Tiger controllers. This is the only software that can be used to update firmware on TG-1000/Tiger controllers.
- +
-Tiger Control Panel: for TG-1000/Tiger controllers.  Like the Tiger Console it lets user send serial commands to the controller, but it is generally easier to use and has a few additional utilities like displaying live axis position and states.  Info and download [[tiger_control_panel|here]].+
  
 +[[tiger_control_panel|Tiger Control Panel]]: for TG-1000/Tiger controllers. Lets you send serial commands to the controller, and has utilities like displaying live axis position and states.
 ==== Micro-manager ==== ==== Micro-manager ====
  
Line 57: Line 66:
    - Send serial commands directly using the pyserial library    - Send serial commands directly using the pyserial library
    - Use pymmcore package to access the MMCore layer of Micro-Manager where ASI devices have excellent support    - Use pymmcore package to access the MMCore layer of Micro-Manager where ASI devices have excellent support
-   - Use Pycro-manager to access the full Micro-Manager API including MMCore+   - Use pycromanager to access the full Micro-Manager API including MMCore
      
 See the [[python|Python]] page for details. See the [[python|Python]] page for details.
- 
  
 ==== LabView ==== ==== LabView ====
Line 73: Line 81:
 === Termite === === Termite ===
  
-An free and easy to use terminal program is Termite ( https://www.compuphase.com/software_termite.htm ). Below is a screenshot of the setup dialog and how it should be configured for talking with our controllers (through RS232 or USB):+A free and easy to use terminal program is [[https://www.compuphase.com/software_termite.htm|Termite]]. Below is a screenshot of the setup dialog and how it should be configured to communicate with our controllers using either an RS232 cable or USB cable:
  
 {{document:termite-setup.png|Termite Setup Dialog }} {{document:termite-setup.png|Termite Setup Dialog }}
  
-Note: your //Port// and //Baud rate// setting requirements may be different than shown, e.g. baud rate is 112500 for Tiger controllers.+Note: your //Port// and //Baud rate// setting requirements may be different than shown, e.g. baud rate is always 115200 for Tiger controllers.
  
  
Line 91: Line 99:
 Various proprietary high-level microscope control software which support ASI controllers (e.g. Molecular Devices’ Metamorph, Nikon Elements) uses serial commands to communicate with the controller.  The communication details are generally hidden from the user. Various proprietary high-level microscope control software which support ASI controllers (e.g. Molecular Devices’ Metamorph, Nikon Elements) uses serial commands to communicate with the controller.  The communication details are generally hidden from the user.
  
- 
- 
-===== Command ===== 
-  
-The controller’s instruction set is implemented using the following format: 
- 
-  COMMAND X=?????? Y=?????? Z=?????? <Carriage Return> 
- 
-The COMMAND is a string of ASCII characters such as ''MOVE'' or ''HOME'', which must be followed by a space.  All commands are case insensitive.  Many commands have abbreviated versions that help cut down on typing time and serial bus traffic. 
- 
-Next are the axis parameters.  (Bracketed ''[ ]'' parameters are optional.) The axis name is given, followed immediately by an equal sign and the axis parameter value.  Each axis must be separated from the one before by one blank space.  One or more axes may be specified on a single command line.  An axis symbol typed without an ''='' assignment is often assumed to mean ''=0'', but that behavior isn’t guaranteed in general (it does, however, work for the commonly-used ''MOVE'' and ''MOVREL'' commands).  Sometimes the command format may not require a parameter value (e.g., ''INFO X''). Commands will accept integer or decimal numbers; internal truncation or rounding will occur if fractional decimals are of no meaning to the command. 
- 
-''axis'' or ''[axis]'' is the placeholder for the axis name, which is a single character. All 26 alphabet characters A-Z can be used as axis names, and the special character ''*'' means “all axes” (not including filterwheels).  For example, ''X'' and ''Y'' are typically used for a sample translation stage, ''Z'' and ''F'' are commonly used for focus axes, and ''A-D'' are the default letters for scanner axes.  Filter Wheels are designated by numbers, TG-1000 can accommodate up to 10 wheels numbered 0-9.   
- 
-For Tiger: When ''[Addr#]'' appears in the format, then the intended card address must be prepended to the serial command, as the command is Card-Addressed. 
-''…'' indicates more arguments can be sent with the same command. 
- 
-All commands are completed with a Carriage Return (ASCII hex code: ''0D'').  The controllers receive ASCII characters one at a time and place them into their memory buffer.  With the exception of single hex code commands like the tilde ''~'', the controller will not process a command in the memory buffer until the Carriage Return ''<CR>'' has been received.  
- 
-===== Reply ===== 
-Upon receiving a Carriage Return <wrap reply><CR></wrap>, the Controller will process the command stored in its command buffer, clear the command buffer, and return a reply. 
- 
- 
-=== MS-2000 Reply Syntax === 
- 
-When a command is recognized, the controller will send back a colon '':'' (hex code: 3A) to show that it is processing the command.  When processing of the command is complete, an answer is returned with any requested information, typically beginning with the letter ''A''.  In some cases, the answer part of the reply is delayed until the completion of the command.  The reply is terminated by a carriage return and a linefeed character ''<CR><LF>''.  In the examples below, the ''<CR>'' and ''<CR> <LF>'' are implied.  This programming manual gives examples in the MS-2000 reply syntax unless otherwise specified. 
-== Examples == 
- 
-<asi> $ Typed commands are in THIS TYPEFACE 
-Controller replies are in THIS TYPEFACE</asi> 
- 
-<asi> 
-$ MOVE X=1234 Z=1234.5 <CR> 
-:A <CR><LF> 
-$ MOVE X Y Z <CR> 
-:A <CR><LF> 
-$ WHERE X <CR> 
-:A 0 <CR><LF> 
-$ MOVE X=4 Y=3 Z=1.5 <CR> 
-:A <CR><LF> 
-$ WHERE X Y Z <CR> 
-:A 4 3 1.5 <CR><LF> 
-$ WHERE Z Y X <CR> 
-:A 4 3 1.5 <CR><LF> 
-</asi> 
- 
- 
-=== Tiger Reply Syntax === 
- 
-The TG-1000 has two reply syntaxes; the active one is set using the <wrap cmd> [[commands:vb|VB F]] </wrap> command.  The default syntax is backwards compatible with the MS-2000 controller, including all the quirks and inconsistencies between commands.  The Tiger syntax is more self-consistent and in some cases more explanatory (e.g. with ''WHERE''), but is not backwards compatible.  Choice of reply syntax is completely arbitrary and does not affect operation. 
- 
-In the Tiger syntax no <wrap reply> :A </wrap> is sent back.  Furthermore, whenever an axis position or command value is returned (i.e. whenever the command is a query), the axis letter is always specified.  Consequently, when no information needs to be sent back and there is no error the controller simply replies with ''<CR><LF>'' only. 
- 
-The above examples in Tiger reply syntax are as follows: 
- 
-<asi> 
-$ MOVE X=1234 Z=1234.5 <CR> 
-:A <CR><LF> 
-$ MOVE X Y Z <CR> 
-:A <CR><LF> 
-$ WHERE X <CR> 
-:A 0 <CR><LF> 
-$ MOVE X=4 Y=3 Z=1.5 <CR> 
-:A <CR><LF> 
-$ WHERE X Y Z <CR> 
-:A 4 3 1.5 <CR><LF> 
-$ WHERE Z Y X <CR> 
-:A 4 3 1.5 <CR><LF></asi> 
-==== Query of Parameters ==== 
- 
-Most commands used to set parameter values can be queried for the current values using the question-mark syntax: <wrap cmd> CMND X? Y? Z? F? </wrap> 
- 
-The controller will respond with CMND’s current settings, e.g. <wrap reply> :A X=0 Y=1 Z=10 F=2 </wrap> 
- 
-This feature is most useful when using a terminal program to change controller parameters to verify that you have made the changes that you think you did, or to check present settings.  
- 
- 
-==== Error Codes ==== 
- 
-When a command is received that the controller  cannot interpret, for one reason or another, an error message is returned in the following format:  
-<asi> :N-<error code></asi> 
- 
-The error codes are as follows: 
-^:N-1 |Unknown Command (Not Issued in TG-1000)                                             | 
-^:N-2 |Unrecognized Axis Parameter (valid axes are dependent on the controller)            | 
-^:N-3 |Missing parameters (command received requires an axis parameter such as x=1234)     | 
-^:N-4 |Parameter Out of Range                                                              | 
-^:N-5 |Operation failed                                                                    | 
-^:N-6 |Undefined Error (command is incorrect, but for none of the above reasons)           | 
-^:N-7 |Invalid card address                                                                | 
-^:N-8..:N-10 |Reserved                                                                         | 
-^:N-11..:N-20 |Reserved for filterwheel                                                            | 
-^:N-21 |Serial Command halted by the HALT command                                                  | 
-^:N-30..:N-39 |Reserved                                                                            | 
  
  
Line 196: Line 110:
  
 Because the TG-1000/Tiger controllers are modular, servicing most commands require that the communication card parse them, relay the message to the relevant card (e.g. for motorized axes or micro-mirror or PLC), and then relay the response.  This adds some extra time compared with the MS2000 family of controllers.  For instance, querying a position using home-built serial software takes 7ms on Tiger and about half that on MS2000.  The intra-controller communication happens at 57600 baud, though it could be extended to 115200 if needed.  For use with Micro-Manager, for example, this extra intra-controller communication time is irrelevant because it happens within the 10ms polling period that Micro-Manager appears to use. Because the TG-1000/Tiger controllers are modular, servicing most commands require that the communication card parse them, relay the message to the relevant card (e.g. for motorized axes or micro-mirror or PLC), and then relay the response.  This adds some extra time compared with the MS2000 family of controllers.  For instance, querying a position using home-built serial software takes 7ms on Tiger and about half that on MS2000.  The intra-controller communication happens at 57600 baud, though it could be extended to 115200 if needed.  For use with Micro-Manager, for example, this extra intra-controller communication time is irrelevant because it happens within the 10ms polling period that Micro-Manager appears to use.
 +
 +=== Low Level Commands ===
  
 If communication speed is of the utmost importance, it is possible to use binary commands in which case the controller doesn't need to parse the human-readable commands.  For MS2000 these are called low level commands and [[low_level_command|documentation is here]].  For TG-1000 these are called W commands and the [[tiger_w_commands|documentation is here]].  Avoiding the parsing will save about a millisecond or so.  Depending on the exact nature of the command the number of bytes transmitted can be more or less than with the usual high-level commands. If communication speed is of the utmost importance, it is possible to use binary commands in which case the controller doesn't need to parse the human-readable commands.  For MS2000 these are called low level commands and [[low_level_command|documentation is here]].  For TG-1000 these are called W commands and the [[tiger_w_commands|documentation is here]].  Avoiding the parsing will save about a millisecond or so.  Depending on the exact nature of the command the number of bytes transmitted can be more or less than with the usual high-level commands.
Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181
tech_note_rs232_comm.1618954837.txt.gz · Last modified: (external edit)