06-11-2025 01:11 AM
Hello all,
I am using a NI8452 DIO to control a timing signal for a circuit. The following is the line of code where I am setting digital output to its DIO :
ni.setdiowrite(0,0,0)
delay(10ms)
ni.setdiowrite(0,0,1)
the above code should loop. The entire code is done in VS code in python environment and I am using ni8452.py library files.
My issue is to execute ni.setdiowrite(0,0,1) takes about 1ms. I don’t want that much slow rise and fall time. I want that line to execute in like ns or even micro sec is fine. Is it the inherent delay of the USB line through which I am communicating or is there a way to make this communication faster through coding which I am missing out on.
please let me know this is quite urgent.
06-11-2025 03:21 AM
When running on a non-RTOS like Windows, nothing is guaranteed to execute in a stipulated time and if Windows is busy with other applications, it may even take several hours for your 10ms delay code to execute.
You need hardware timed DIO hardware to generate precise timing.
06-13-2025 06:54 AM
The 8452 does allow for running a script. There is an interface for a SPI script and an I2C script. Both of these allow for using the DIO lines. So it may be possible to use one of these interfaces to get the timing you are looking for.
06-17-2025 12:55 AM
Thank you for your reply.
Do you know how can control precisely the DIO using the SPI or I2C. It would be great if you could share some code examples.
Like I am trying to generate a pulse wave of 15Hz with as minimum delay as possible whenever I am trying to send signal to DIO to change it value I am getting that delay and it is hampering with the proper pulse formation