Frederic;
If you are using Labview, you can find a good example for you to start at Search Examples->I/O Interfaces->Data Acquisition->Digital Input and Output->Immediate Digital Input and Output->Write to One Digital Port.vi.
If you are using any other Programming Language which NI-DAQ has API for, you can fing some examples at C:\Program Files\National Instruments\NI-DAQ\Examples, if you already have NI-DAQ installed on your machine.
Hope this helps.
Filipe