Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Set a value in each digital output separetely in qnx

Solved!
Go to solution

Hello, i have the  two examples of the Eseries for the digital outputs

and they seem to work but when i change the value  i want to set in the dig output 1 it doesn't change .

 

More exactly i changed the example digex1 this way:

//Write 0x00 to 0xFF to the digital lines, can be checked by putting a break point.
    //for(i=0;i<=255;i++)
        theSTC->DIO_Output.writeDIO_Parallel_Data_Out(0);

 

but i always get 5V in the output.

 

So i want to be able to set a different value in each dig output.

how can i do so?

 

thanks 

0 Kudos
Message 1 of 5
(8,890 Views)

I recommend you test the NI-DAQmx build-in examples. These examples are installed with the driver and you can find them in a path like this:

 

C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital

 

A good example can be this:

 

C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Generate Values\Write Dig Chan

 

At the same time, you must dismiss a hardware problem. Have you test in MAX the digital lines? (using test panel).

 

Regards,

0 Kudos
Message 2 of 5
(8,879 Views)
Well, i forgot to mention that i'm working in linux programming in a target PC throught qnx momentics. so the only example i can execute are the examples of eseries for qnx in linux
0 Kudos
Message 3 of 5
(8,875 Views)
Solution
Accepted by topic author kkoutsou

Hello again I managed to change the values i set to the output pin.

Now i'm using the function

DIO_Output.writeDIO_Parallel_Data_Out(0xff); 

 

but i don't know how can i set a value in a particular pin and not in all of them.

 

If anyone knows something it will be very helpful.

 

thanks 

0 Kudos
Message 4 of 5
(8,871 Views)

The DDK and chip objects do not provide a specific function for setting the state of a single digital line. The best way to do this is using a bit mask with boolean logic and updating the whole port.

 

To set a bit, use a logical OR with a '1' in the bit you want to set. To clear a bit, use a logical AND with a '0' in the bit you want to clear.

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 5 of 5
(8,838 Views)