Hi,
I’m not sure, if I understand you correctly. You currently configure
both messages to periodically transmit at 1 Hz (sample rate input of
the CAN InitStart VI). Additionally, the timed loop is also configured
to execute every second.
If you change the sample rate of the CAN InitStart VIs to ‘0’, the CAN
write calls will only transmit the message, when the CAN Write VI is
called, thus, you could put a case structure around each CAN Write and
select with a Boolean control whether to write the message or not.
Further more: The case structures with the CAN Start/Stop VIs are
probably not that effective: When the VI starts, it takes the current
state of the M201
and M202 control and based on their state the message is either enabled
or not. Once LabVIEW executes the times loop, the state of the two
controls is not re-evaluated and thus you cannot stop/restart the
message while the VI runs.
Maybe your intention was to have them in the timed loop? If that is the
case you should change the mode of the CAN InitStart VIs to ‘output
recent’ as otherwise you’re passing data to the CAN Write with every
loop, but in case the task is stopped the data is buffered and
transmitted when the task is restarted. That would mean that upon
staring the task old data is transmitted. The ‘output recent’ mode
prevents that any data is buffered.
-B2k