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: 

PIR sensor input via RS232 to LabView

Good Evening all,

 

Just wondering if anyone out there would be able to help me with a labView program design problem.

 

Currently my LabView program is monitoring 2 PIR sensors using the 'VISA read' function. The two sensors are connected to a PIC programmed with a flowcode program,when sensor 1 is activiated a '1' character is sent to LabView and when sensor 2 is activiated a '2' character is sent to LabView.

 

What I am then trying to do is design a 2D array, ie a look up table, to store fixed pan and tilt values for two servos which will control the position of a camera. Upon PIR sensor 1 activating, the LabView program will read the one byte of data ie '1', from this LabView will select the two preset bytes from the 2D array for that PIR sensors position, ie 1 byte of data for the pan position and 1 byte of data for the tilt position.

 

These values will then have to be transmitted to a PIC controlling the position of the pan and tilt servos to move the camera to view the area covered by the activated PIR senor. I understand that I will most likely need to use a stacked sequence LabView program for this design, with the Visa Read function on the ground floor and the Visa Write function on the top floor but at the moment I am struggling with the middle section, ie using the 1 byte input with refernece to a 2D array lookup table to select and output 2 bytes of data to control the pan and tilt servos.

 

If anyone could help me with this programming design problem it would be much appreciated. Thank you for your time.

 

Regards Tom

0 Kudos
Message 1 of 4
(2,722 Views)

Don't use a stacked sequence structure.  You certainly won't need it.

 

If you can give an example of how the 1 byte to 2D lookup array would work, I'm sure we can help you figure out how to code it in LabVIEW.  If you had a 2D array lookup table, I would expect you'd need to inputs, one to select the row and one to select the column.  So your 1 input byte doesn't make sense to me.

0 Kudos
Message 2 of 4
(2,706 Views)

Good afternoon,

Thank you for your reply with reference to my LabView program idea/problem. I have attached a block diagram idea for my proposed labView program, with your knowledge is this by chance feasible?

Regards,

Tom

0 Kudos
Message 3 of 4
(2,683 Views)

You just need to create the 2-D lookup table as an array constant.  It looks like you want to take one of your bytes and choose that row.  Just feed that byte into the row index of index array.  You may need to subtract one from your value since array indices are zero-based, and your lookup table appears to be 1-based.

0 Kudos
Message 4 of 4
(2,668 Views)