08-10-2007 07:39 PM
08-11-2007 09:37 AM
08-12-2007 03:35 PM
08-12-2007 11:58 PM
Hi,
Your code seems sufficient to operate the digital output according to the position of the switch provided that you called GetCtrlVal to get the position of the switch before the DAQmx code.
The second parameter to function DAQmxWriteDigitalScalarU32 is 1, which means you do not need to call DAQmxStartTask separately.
The error code means: "digital lines are reserved or unavailable". You can search your error code in the daqmx.h file to get a quick info on any error or warning (which are positive). This error is probably because "Dev1/port3/line3" is not a valid channel name without a hardware.
Hope this helps,
08-13-2007 12:57 AM
08-13-2007 04:57 AM - edited 08-13-2007 04:57 AM
Hi Joyce,
My first name is Eren. Balci is the last name 🙂
Could you paste the following lines in your code and tell me what happens?:
DAQmxCreateDOChan (taskRF, "Dev1/port3", "", DAQmx_Val_ChanForAllLines); //use the port as a whole
DAQmxStartTask (taskRF); //start task
DAQmxReadDigitalScalarU32 (taskRF, 10.0, &RFstatus, 0); //read current value
DAQmxWriteDigitalScalarU32 (taskRF, 0, 10.0, (RFswitch == 1) ? (0x08 | RFstatus) : (0xF7 & RFstatus), 0) ;
This uses the port as a whole and sets or clears the bit corresponding to line-3 only and leaves other bits unchanged.
Message Edited by ebalci on 08-13-2007 12:59 PM
08-13-2007 01:04 PM
08-13-2007 04:23 PM