Adding Additional Inputs
First, edit the settings_custom.conf in ExperPort/Settings, adding the following line for each new input you would like to add:
INPUTLINES: X; N
where X is the letter you would like to use in your protocol to indicate this input, and N is the port on the breakout box from which this value will be read. (Note that the physical port number will be N + the
inputline_misc; offset value specified in Settings_Custom.conf.
INPUTLINES: X; 128; % The eighth port (assuming the input offset is 0) on the breakout box will correspond to Xhi, Xin,... in the add_state calls.
Updating the StateMachineAssembler
To add additional input lines you will need to get a new version of Send.m and stateMachineAssembler.m. These new files can be identified by the following comment at the top of the script 'Additional Input Lines added December 2012 CDB'
To take advantage of the additional input lines in your protocol, you
will need to modify the line on which you call StateMachineAssembler.
You will need to set the
n_input_lines parameter to your total
number of input lines, and set
use_happenings to 1.
StateMachineAssembler expects your inputs to be lettered CLRABDEF…. If
you specified a different lettering in Settings_Custom.conf, you will
need to also supply this lettering in the 'line_names' parameter. In
all, your call to StateMachineAssembler might look like this:
You should now be able to use these additional lines in your state machine in the usual way, with or without happenings (e.g. 'Xin','Xhi')
This procedure will you to exploit addition input lines. However there are two consequences of this procedure. First you must be aware that these changes may affect the line mappings for other rigs that share the same breakoutbox. These rigs may need to change their inputlines_misc offset parameter as specified in either custom.conf or brodylab_rig.conf.
Slowing Down the RTFSM
You may need to change the clock speed on your FSM to handle the extra inputs. IF the FSM is not able to query all of its inputlines in one clock cycle it may crash.
- Go to the folder on your RTLINUX machine where you installed the FSM. Usually it is /usr/src/rtfsm,
- Open the file
_s_start.shusing your favorite editor (e.g. vi, nano, gedit). You will likely need to sudo edit it.
- Find the line that reads
insmod ./RealtimeFSM.ko task_rate=2000
- Change the task rate to something slower. The value is in Hz, so 2000 means 0.5 ms states.
- Reboot the machine