Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 8452 writing to a digital input output pin

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. 

0 Kudos
Message 1 of 4
(267 Views)

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.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 4
(249 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(216 Views)

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

0 Kudos
Message 4 of 4
(182 Views)