The FLC system provides an RS232/UART interface for remote control and monitoring. This API allows external systems to execute routines, control hardware, and monitor the status of the laser system.
To connect to the RS232 API, use the following parameters:
All commands follow a simple text-based format:
command [parameter1] [parameter2] ...
For example:
write_digital ONHV 0 true
Responses are returned as strings and can be one of the following formats:
OK or a specific success messageERROR: <error message>True <data> or False <error message>The RS232 API commands are divided into two main categories:
When executing routines that require parameters, values should be provided in the correct order and format:
"value")123, 45.67)true or false (lowercase)For example, if a routine requires a wavelength parameter:
run_set_wavelength 1064.5
If a command fails during execution, an error message will be returned with the following format:
ERROR: <error message>
Common errors include:
This document describes the RS232 API commands available for the routines subsystem.
write_digitalCallback function for the digital output buttons (ToggleButtons).
Format: write_digital <name> <portnum> <state>
Parameters:
- name: string
- portnum: integer
- state: boolean value ("true"/"false" or "1"/"0")
Example: write_digital ONHV 0 true
Returns: Success/error status and the written value
Description: This command directly controls the digital outputs of the control board. It's used to toggle hardware components on and off, such as power supplies, high voltage sources, and pulse generators.
write_analogCallback function for the analog output buttons (DACGroup).
Format: write_analog <name> <portnum> <value>
Parameters:
- name: string
- portnum: integer
- value: float
Example: write_analog DAC1 2 3.5
Returns: Success/error status and the written value
Description: This command controls analog outputs, allowing precise control of voltage levels for components such as DACs (Digital-to-Analog Converters). It's used for controlling variable parameters like power levels and timing signals.
adc_single_offloadPerform single offload Example command: 'GET adc_single_offload'
Format: adc_single_offload
Example: adc_single_offload
Returns: ADC data or success message
Description: This command reads the current ADC data from BRAM (Block RAM) registers and returns the values. It's useful for checking analog signal values at a specific moment in time.
adc_continuous_offloadPerform single offload Example command: 'GET adc_single_offload'
Format: adc_continuous_offload <state>
Parameters:
- state: boolean value ("true"/"false" or "1"/"0")
Example: adc_continuous_offload true
Returns: ADC data or success message
Description: This command controls the continuous reading of ADC data. When enabled, the system will continuously read and transmit ADC values until disabled. This is useful for monitoring analog signals over time.
The following routines are registered in the routines subsystem and can be executed via RS232:
run_measure_and_check_signalsCheck Signals
Format: run_measure_and_check_signals
<frequency>
Example: run_measure_and_check_signals
"example_string"
Description:
Steps:
run_measure_and_check_signalsCheck Signals
Format: run_measure_and_check_signals
Example: run_measure_and_check_signals
Description:
Steps:
This document describes the RS232 API commands available for the NLOS subsystem.
write_digitalCallback function for the digital output buttons (ToggleButtons).
Format: write_digital <name> <portnum> <state>
Parameters:
- name: string
- portnum: integer
- state: boolean value ("true"/"false" or "1"/"0")
Example: write_digital ONHV 0 true
Returns: Success/error status and the written value
Description: This command directly controls the digital outputs of the control board. It's used to toggle hardware components on and off, such as power supplies, high voltage sources, and pulse generators.
write_analogCallback function for the analog output buttons (DACGroup).
Format: write_analog <name> <portnum> <value>
Parameters:
- name: string
- portnum: integer
- value: float
Example: write_analog DAC1 2 3.5
Returns: Success/error status and the written value
Description: This command controls analog outputs, allowing precise control of voltage levels for components such as DACs (Digital-to-Analog Converters). It's used for controlling variable parameters like power levels and timing signals.
adc_single_offloadPerform single offload Example command: 'GET adc_single_offload'
Format: adc_single_offload
Example: adc_single_offload
Returns: ADC data or success message
Description: This command reads the current ADC data from BRAM (Block RAM) registers and returns the values. It's useful for checking analog signal values at a specific moment in time.
adc_continuous_offloadPerform single offload Example command: 'GET adc_single_offload'
Format: adc_continuous_offload <state>
Parameters:
- state: boolean value ("true"/"false" or "1"/"0")
Example: adc_continuous_offload true
Returns: ADC data or success message
Description: This command controls the continuous reading of ADC data. When enabled, the system will continuously read and transmit ADC values until disabled. This is useful for monitoring analog signals over time.
The following routines are registered in the NLOS subsystem and can be executed via RS232:
run_divide_frequencyDivide Frequency
Format: run_divide_frequency
<divider>
Example: run_divide_frequency
123.45
Description:
Steps:
run_check_laser_statusCheck Laser status
Format: run_check_laser_status
Example: run_check_laser_status
Description:
Steps:
run_arm_laserArm Laser
Format: run_arm_laser
<frequency>
Example: run_arm_laser
"example_string"
Description:
Steps:
run_disarm_laserDisarm laser
Format: run_disarm_laser
Example: run_disarm_laser
Description:
Steps:
run_shutdown_laserShutdown Laser
Format: run_shutdown_laser
Example: run_shutdown_laser
Description:
Steps:
run_emission_onEmission ON
Format: run_emission_on
Example: run_emission_on
Description:
Steps:
run_emission_offEmission OFF
Format: run_emission_off
Example: run_emission_off
Description:
Steps:
run_emission_on
run_shutdown_laser
run_emission_off
run_measure_and_check_signals
adc_single_offload
write_digital PS_ON 0 true
write_digital ON11V 0 true
write_digital ONHV 0 true
write_analog DAC1 2 3.5
adc_continuous_offload true
# Monitor data for some time
adc_continuous_offload false
The RS232 API is implemented using a UART router that:
All routines marked with register-api: true in their YAML configuration are automatically registered for RS232 access with the prefix run_.
The system uses regex pattern matching to identify commands and extract parameters. Function handlers are registered for each command pattern using the @uart_route decorator or through automatic registration of routines.