Elisa,
Hello. I am not sure if you are already programming one of National Instruments Digital I/O cards, but I would recommend using the 6533 or the 6534 (has 32MB of onboard memory). National Instruments provides example programs that will help you program these boards and synchronize digital input and output.
If you already have a board and need help programming it. I would post another entry with more details about the hardware setup and the programming language you are using, ie LabVIEW, C++, CVI, etc.