LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control relays with LabVIEW

Hello Everyone. I am trying to control relays with LabVIEW but I don't know where to start. I have a pcb with  MAX4820 Cascadable Relay Drivers with Serial/Parallel Interface and multiple relays DK2A-5V. The idea that I can connect multiple motors and with the relays I can select which one to drive. I have also USB-8451 box which In pan to use. Please help me how to start and connect it to LabVIEW so I can control it. Thank you 

 

0 Kudos
Message 1 of 3
(153 Views)

Connect the 4820 in cascade configuration to the SPI lines of 8451

santo_13_0-1726663147924.png

In your code, configure SPI to be N x 8 bits long (where N is number of chips cascaded together).

 

Example, if you have 2 chips cascaded, you need to configure 8451 to send 16-bit long packet where the LSB of the 16-bit corresponds to OUT1 of the last chip in the chain and MSB of 16-bit data corresponds to OUT8 of the first chip in the chain connected to 8451.

 

Now, in you code, taking the SPI example, form this 16-bit data as needed to set/reset the relays and write to 8451 and all chips in the chain are updated at the end of the SPI write.

 

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
Message 2 of 3
(146 Views)

Hello again. I connected my NI-8452 to my board with MAX4820 in the following way :

left pinf from max4820, right 8452 box

MOSI-SPI_MOSI
DGND-GND

5v - eternal 5 v power supply

CS0-CS(0)

A3,A2,A1,A0 - DIO(2),DIO(3), DIO(4), DIO(5)

SET-DIO(0)

RST-DIO(1)

SCLK-SPI_SCLK
I try to run this example that I fond in the community but I only able to turn on off all relays and I have no idea how to fix it so I can control each individual relay. 
Port number is set to 0, when I change it to a different number i have an error indication that port number is not correct. When it is 1, I can turn on relay, I hear a click and leds are on, when I change it to 0 I can turn them off, eds are off. How I can change this code so I can control each individual relay ? Thank you so much

Lily3000_0-1726739036087.png

 

0 Kudos
Message 3 of 3
(90 Views)