I have an application where I need to simultaneously read 24 bits (Ports 0-2) and write 8 bits (Port 3), using an external clock. The way it is done now is I create a read task and I create a write task. I send my external clock to PFI4 and PFI5, because two clock inputs are required (one for read, one for write). And I send a trigger signal to PFI3 to start and synchronize the tasks.
However it is not working correctly. My clock is ~15MHz and the reads and writes are off by a random number of a few clock cycles. For example when I start writing out Port 3, the reading into Ports 0-2 will start 2 or 3 or 4 clock cycles later.
Is there a way that I can read and write simultaneously that will work correctly??