How to Use LINX Custom Commands

2

For those of you using LabVIEW MakerHub LINX to control your microcontroller with LabVIEW, there is a way to implement some Arduino code and libraries and add extra functionality to your project. LINX supports “custom commands” where you can implement a custom function to do pretty much anything you want that isn’t supported directly in LINX. In my Instructable, I go over an example of writing a custom command for the PmodCLP which uses parallel data interface (basically writes digital channels high or low quickly). Because LINX only has a loop rate of about 200Hz, it is too slow to directly control the PmodCLP. Thus the need for a custom command!

20150629_121254
To add a custom command, you’ll need the Arduino IDE or MPIDE so that you can edit the LINX firmware to add your custom command. This involves creating a function that passes in an input array from LabVIEW, the number of bytes of the input, a response array, and the number of bytes the response is. The response will contain the information that you send back to LabVIEW. For more information on how exactly to write the custom command, check out the instructable linked above. Once you’re done editing the code, upload the firmware to your board.

mpide

In LabVIEW, you can access the custom command VI by going to Functions Palette->MakerHub->LINX->Utilities->Custom Command to call the custom function. In the custom command VI, you will have the input which is a byte array containing the information that you are sending to the custom command (the input array mentioned earlier).  You’ll also need to feed in the number you assigned your custom command (you can  have up to 16). A picture of how to use the custom command VI is below. The VI executes the custom command that you wrote and returns the information that you told it to.

customblockclpCustom commands can be used for Arduino libraries as well! I wrote a custom command for the DHT11 humidity and temperature sensor using an existing Arduino library that reads information from the sensor each time the custom command is called. Try using custom commands for anything that can’t be done natively in LINX.

20150629_151955

Share on FacebookTweet about this on TwitterShare on Google+Pin on PinterestShare on RedditShare on TumblrShare on LinkedInShare on StumbleUponEmail this to someone
Share.

About Author

2 Comments

  1. Hi
    i have a kit of arduino of 37 sensors with a CD of all codes for these sensors , as per above is it possible to make a custom command and how for the DHT11 or 18B20 sensors , please put that in example since i have no any experience in C++ or if there is a video to explain how to make the custom command.

    please advise

Leave A Reply