Wednesday 7 April 2010

Adding Custom Icons to the Function Palette for User Libraries

After you have created our own library in LabVIEW and inserted them into the Functions palette, you could design a custom icon for your library.

You could follow the following steps to add a new submenu into Functions palatte.

1. Open a new VI in LabVIEW.

2. Select Tool->Advanced->Edit Palette Set to display the Edit Controls and Functions Palette Set dialog box.

3. The Edit Controls and Functions Palette Set and Functions palettes will be prompt out as below.


 4.Right-click the Controls or Functions palettes and select from the options on the shortcut menu to edit a palette set.

For example, you want to edit the palette icon at user libraries.
a) Select User Libraries.
b) Right click on the specific user library that you want to change the icon and choose Edit Subpalette Icon.

c) You will  be prompt with Icon Editor. Finish your new icon design and select B&W->256 Colors->OK.



5. After you edit the palettes, click the Save Changes button in the Edit Controls and Functions Palette Set dialog box to open the Preview Palette Changes dialog box and save the changes. Click the Cancel button to cancel any changes you made in this editing session and close this dialog box.


Hope you will fun to design your own custom icon for your library!

Thursday 2 April 2009

Generate Code 128 Barcode in Excel

Code 128 barcode is a high-density linear symbology that encodes text, numbers, numerous functions and the entire 128 ASCII character set (from ASCII 0 to ASCII 128). The barcode itself consists of a start character, data digits, a modulo 103 check digit and a stop character as shown below:



Barcode is just like any other font. First of all, you need to install barcode fonts on the Window system before you can use it anywhere, including Labview, notepoad or any other text editor. You may download the barcode fonts free from here.

Steps to install Font Code 128:

For Window XP
Go to control panel and open it. Then, find the fonts folder and double click on it. Finally, drag the fonts (files ending with .tiff) into the font folder.

For Window Vista
After extracting the fonts, right click on each font and select "install" in the popup menu.

On both systems, it is very likely that you will not see the fonts until after you reboot.

Since Code 128 barcode requires a check digit in the barcode (or it will not scan), you need to a converter unless you are writing your own application to create a barcode.

So, you can download the .NET DLL here to compute the check digit and creating the barcode string for use in your applications. This DLL encodes the data in multiple variants (b and c) to save linear space.

Barcode Generation in External Text Editor using Labview:

Technically, when you write into a file, you would still be writing a string of ASCII characters. Meaning that by default, you would be seeing numbers when you open it using any external text editor.

The problem with notepad is that is is capable of only displaying ONE font style for the whole document. For your implementation, you would need to display at least two (the human readable font and the barcode font) and this functionality is provided by Microsoft Word/Excel.

Next trouble is that you won't be able to change the text style just by using the basic File IO functions in Labview because there is no configuration options for font styles. A workaround would be to use the Report Generation Toolkit's VI.

With this, you can choose to save your file either in Word or Excel by changing the font format through Excel Easy Text.vi as shown below.




Code 128.vi

Sunday 15 March 2009

Save Multiple Waveform Graphs Into A Single JPEG File

Still remember the time i struggled very hard to save 4 waveform graph into a single jpeg file as my customer need the solution urgently.

I was able to save a waveform graph into a jpeg file but not for four waveform graphs. Luckily, the asean.support@ni.com team managed to find the solution for my problems and saved my day. And, i would like to take the opportunity here to share it out.

Firstly, get the image from each Waveform Graph. Then, use the Unflatten Pixmap.vi to unflatten each image data into 24-bit pixmap. Append them together as an array and save them as one jpeg file. The sample shown below can append each image at bottom or to the right.

Block Diagram for Image append to the right:



Result of jpeg file:



Block Diagram for Image append to the bottom:



Result of jpeg file:



Wednesday 18 February 2009

Create INF file for Zebra Printer TLP 2844

In my recent project, i need to control Zebra Printer TLP 2844 to print out the barcode. In order to do that, i need to create an INF file using the VISA Driver Development Wizard as stated in the NI link http://zone.ni.com/devzone/cda/tut/p/id/4478#toc3. The reason behind this is Zebra Printer TLP 2844 is a raw USB instrument which does not conform to USB Test and Measurement Class(USBTMC) protocal.

Unfortunately, i can't find the USB vendor ID and product ID in the Device Manager when i plugged it in my desktop for the first time.



However, the Device Manager had already identified my printer information and it seems that i already had the driver for TLP 2844 installed. But, actually i not yet installed the driver for TLP 2844. The driver that i installed before was S4M which is a different printer family from Zebra.

Finally, i figured out that i need to install the default driver come with the printer model (TLP 2844), then it showed up the device ID and product ID.

Lesson learned : Never proceed to create INF file before the instrument's driver is installed.

Advice from NI Technical Support , Joshua de Ia Llana:
Both the Vendor ID and Product ID are manufacturer specific and are required before you can create an INF File. These are the informations you drivers use to communicate with the device, making them absolutely necessary. Though sometimes these are not given explicitly and you might need to call them up for the information.


Thanks Joshua.

Sunday 28 December 2008

Create cool icons with mouse hover effect in Labview

It has been my dream to create my GUI toolbar looks like the Mozilla Toolbar.Finally my dream comes true when i came across the JKI website on how to create this effect.

There is a video provided by JKI on how to do it, but unfortunately it needs Labview 7.1. So i try to modify the steps and perform this using only Labview 8.2.

1. Place a system button on the VI
.


















2. Right click on the button=>Advanced=>Customize



















3. Change to customize mode by clicking on the screwdriver like icon.



And, you will get something like this.



4. Open a new VI and place a classic Flat Square Button on the VI.



5. Right click on the classic button=>Advanced=>Customize



Change to customize mode by clicking on the screwdriver like icon(same as step 3).



6. Right click on the Boolean control. Go to Picture Item and click on the first picture.



7. Right click on the classic boolean control and choose 'Copy to Clipboard'.



8. Then go to system button control VI, right click on the control. Choose 'Import from Clipboard at Same Size'.



9. Change back to Edit Mode and color the control with system color.



10. Go to the Menu Toolbar, select Edit=>Import Picture to clipboard. Then, select the icon picture you want to put.

11. Right click on the control button and then click 'Import Picture from clipboard'=>'Decal' to put icon picture inside the button.



12. Finally, you will get something like this.



Change the button label.



13. When finish, go to File=>Apply Changes and this will automatically change the system boolean controlSave the control.

14. Run the VI and you will see the difference when your mouse goes near the button.