Nimal, I noticed that in your code, you have two while loops that are running in parallel. This is going to cause synchronization problems for one loop is going to dominate the other. Specifically, the loop with DIO Read will not allow the loop with DIO Write to execute until it has acquired all of the samples that it has set to read per loop iteration. A better practice would be to only have a single while loop and then cause data to be written by DIO Write and then have data read by DIO Read. You can connect the error cluster from DIO Write to DIO Read which will cause DIO Read to execute immediately after DIO Write. In your current application it is possible for execution to be stuck in one loop and rarely execute the code in the other. You may also be able to place delays in both loops, but combining them both into single loop would be the best.
Regards, Bill B.