11-27-2007 01:52 PM
03-14-2008 03:20 PM - edited 03-14-2008 03:21 PM
Hi Aaron-
The bitfields you attempt to write are problematic for a few reasons. First, AI_Disarm is only safe to use for idle counters and may not work reliably if the acquisition is currently running (which it sounds like you have observed). AI_STOP_St is a read-only bit, so writing it will have no effect. Finally, AI_Start_Stop controls an unrelated functionality (essentially, it decides whether an AI_Start -> AI_Stop cycle constitutes a "scan". This is actually the only mode of the STC2 that makes much sense to use on M Series).
There are a couple of bitfields in AI_Command_2 that might help. AI_End_On_SC_TC is a strobe bit that disarms the AI_SC, AI_SI, AI_SI2, and AI_DIV counters when an SC_TC event occurs. AI_End_On_End_Of_Scan provides the same functionality for when an AI_Stop occurs. So basically, you could determine a regular interval boundary number of scans to stop on (using End_On_SC_TC) or just stop at the end of the "current" scan (using End_On_End_Of_Scan).
I haven't tested this, but it should work. Let me know if you have problems using either of these methods. Hopefully this helps-