Specifications

Comedi
29 / 148
ret = comedi_do_insn(dev, &configCmd);
if(ret < 0){
comedi_perror("comedi_do_insn: INSN_CONFIG");
exit(1);
}
// Set clock RTSI line as output
ret = comedi_dio_config(dev, rtsi_subdev, rtsi_clock_line, INSN_CONFIG_DIO_OUTPUT);
if(ret < 0){
comedi_perror("comedi_dio_config");
exit(1);
}
/
*
Set routing of the 3 main AI RTSI signals and their direction to output.
We’re reusing the already initialized configCmd instruction here since
it’s mostly the same.
*
/
configCmd.chanspec = 0;
configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START1;
ret = comedi_do_insn(dev, &configCmd);
if(ret < 0){
comedi_perror("comedi_do_insn: INSN_CONFIG");
exit(1);
}
ret = comedi_dio_config(dev, rtsi_subdev, 0, INSN_CONFIG_DIO_OUTPUT);
if(ret < 0){
comedi_perror("comedi_dio_config");
exit(1);
}
configCmd.chanspec = 1;
configCmd.data[1] = NI_RTSI_OUTPUT_ADR_START2;
ret = comedi_do_insn(dev, &configCmd);
if(ret < 0){
comedi_perror("comedi_do_insn: INSN_CONFIG");
exit(1);
}
ret = comedi_dio_config(dev, rtsi_subdev, 1, INSN_CONFIG_DIO_OUTPUT);
if(ret < 0){
comedi_perror("comedi_dio_config");
exit(1);
}
configCmd.chanspec = 2;
configCmd.data[1] = NI_RTSI_OUTPUT_SCLKG;
ret = comedi_do_insn(dev, &configCmd);
if(ret < 0){
comedi_perror("comedi_do_insn: INSN_CONFIG");
exit(1);
}
ret = comedi_dio_config(dev, rtsi_subdev, 2, INSN_CONFIG_DIO_OUTPUT);
if(ret < 0){
comedi_perror("comedi_dio_config");
exit(1);
}
}
An example to slave a m-series device from this master follows. A pre-m-series device would need to use NI_MIO_RTSI_-
CLOCK for the clock source instead. In your code, you may also wish to configure the master device to use the external clock
source instead of using its internal clock directly (for best syncronization).
void comediEnableSlave(comedi_t
*
dev){
comedi_insn configCmd;
lsampl_t configData[3];