I am running 100Hz control application with LV8.2 on CompactRIO. I need to record certain variables, about 70 bytes per loop (per 10ms), so I put the file-write vi inside the loop. I'm writing to the flash memory in cRIO, figuring that to be the fastest method. Since the file-write vi is inside the loop, I'm thinking that it will actually write each loop. But what seems to happen in reality is that it puts the data in a buffer and writes it once per second. Here's why I think that: My control loop hums along with 10ms loops for one second, then at the end of each second, one loop will take 30, 40, even 120ms. If I leave everything else intact and take out the file-write, the once-a-second hiccups go away.
I'm thinking that writing the file on the host via TCP/IP would slow things down even more, judging by how much a few real-time indicators on my laptop screen will slow down a vi.
You might suggest separating things into a time-critical (deterministic) and non-deterministic loop. Would that help, though, if the thing insists on writing the entire file once a second anyway? Why won't it just write 70 bytes per loop like I ask instead of saving up 7000 bytes to write at once?
I open and close the file outside the loop (i.e., only at program start up and stop, not each loop). I've tried both text and binary files; the binary files go somewhat faster but don't make the problem go away.