From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino - SPI - DAC converter

The attached images are the circuit structure of the hardware, and the revised block diagram, in which there is no error message at running but no voltage output either. I have to solve this probblem very urgently and I appreciate your help wholeheartedly.

0 Kudos
Message 11 of 22
(987 Views)

Where in the circuit are you measuring the voltage (the one which does not change)?

 

Have you verified with an oscilloscope or logic analyzer that the SPI signals are all correct in level and in timing? This seems like the first place to look considering the error message you were getting.  Also try placing Error Out indicators on the error wire at various places in the VI to see which instance of the LIFA VIs first throws the error.

 

I notice that prior to the loop you write to pins 6,7,10,9 and inside the loop the sequence is 7,9,10,6.  I am not familiar with what those pins do, so cannot comment on the correctness of the sequences, but it is something to check.

 

Lynn

0 Kudos
Message 12 of 22
(977 Views)

Hi Lynn,

The pin assignments are:

piezo_select = 3; //Relay that switches between piezos

go_button = 5; //piezo/wire button

clr = 6; 

sync = 10;

ldac = 7;

alarm = 8;

r_sel = 9;

led = 2.

 

I copied the SPI data set from an online image so it means nothing in this case. As the DAC resolution is 12-bit, I suppose the SPI data has to be converted to 8-bit resolution. Is the SPI data configuration necessary in my case?

 

The piezo is wired to pin 5, and when I directly digital write pin 5, there is voltage output, but very low and not adjustable; when digital write to other pins, there is no voltage output.

 

Can you help me on this? It's really urgent.

0 Kudos
Message 13 of 22
(974 Views)

Hi Lynn,

When I modified the vi to the format in the attached image, there is no error but no voltage output at all.

0 Kudos
Message 14 of 22
(970 Views)

This is the circuit structure, attached

0 Kudos
Message 15 of 22
(966 Views)

Hi Dennis,

I have been waiting for your further feedback today but unfortunate. Could you please review my recent posts and see weather you can fix my problem? I have been struggling on it for over one week and really have to solve it in very limited time.

0 Kudos
Message 16 of 22
(951 Views)
Sorry, I have not used the spi interface.

Official support for lifa is at https://decibel.ni.com/content/groups/labview-interface-for-arduino

You might have better luck posting there.
0 Kudos
Message 17 of 22
(946 Views)

Since changing the sequence of the calls eliminated the error, it seems that you have made some progress.

 

In looking at your image I do not see anything which looks like data. How do you tell the Arduino what voltage (or PWM duty cycle) you want?

 

I suspect that your problem is in not thoroughly understanding the data requirements of the overall system.  The version of LIFA I have has several VIs for PWM which you do not appear to be using. You have nothing wired to the SPI Data ports of the SPI VIs. IF you are not sending the Arduino any data, then the output sitting there unchanged is exactly what you told it to do!

 

Lynn

0 Kudos
Message 18 of 22
(926 Views)
Hi Lynn,
My understanding is that Digitalwrite sub Vi has the data input function: at value 0, the voltage input is 0V, and at value 1, the input is 5V or 3V, depending on the board type. As you see in the image, there are several digital write wired in different pins, but seems that these commands are not transmitted to pin 5.
0 Kudos
Message 19 of 22
(918 Views)

You write to pin 5 in two places. Outside the loop the value wired to the Pin Mode (Input) is Input, which converts to 0. Inside the loop the value is always 0. If it never changes, why do you expect the output to change?

 

Lynn

0 Kudos
Message 20 of 22
(913 Views)