Thanks for visiting my Blog, your comments will be appreciated! Come back soon for new interesting Posts.

martes, 13 de abril de 2010

Programming ATMEL microprocessors with LabVIEW

Sometimes, some products require to be programmed before any test can be conducted. One of the most popular microprocessor is ATMEL, the question is how can you integrate or automate this process within a regular testing process?. In my case, I require the use of a standard ISP Programmer from ATMEL called AVRISP MKII, which you can see below.
This is an USB programmer, take in consideration that this programmer does not feed +VCC to the microprocessor unless you modify it with a resistor and a diode to feed voltage, the other way is to externally power up the micro.
Click the slideshow below to view images about AVRISP MKII modification to feed power supply from computer USB. One consideration, this power supply is just to program the micro, please make sure that if you want to operate your product or experiment I will encourage you to use an external power supply. The diode is a 1N4148 and the resistor is a 47R0 Ohms.

Click to play this Smilebox slideshow: AVRISP MOD

Another way to do Power Supply modding can be found here.
Now, under ATMEL AVR Tools Folder you wil find AVR Tools HELP, select AVRISP MKII and go to "Command Line Software". Here, you are provided with instructions to make simple batch files that you can send directly from DOS or you can also send this from LabVIEW for automatic programming. An example of this will be:

C:\Program Files\Atmel\AVR Tools\STK500\STK500.exe -cUSB -dATtiny25 -e -if"Path and Filename.hex" -pf –vf

This, instructs the programmer to program via USB (where the programmer was setup) an ATtiny25 device with the Path+Filename.hex and verify that the flash memory of the device was programmed. The following VI shows how to do this.

You can add verification steps to ensure that the Flash. EEPROM, fuse and lock bits were properly programmed.

miércoles, 7 de abril de 2010

Zebra TLP 2844-Z/GK420d Printers via USB and LabVIEW

Has anyone faced the problem of sending ZPL or raw data to a small Zebra Printer connected via USB Port? it's been troublesome to find out how to write to a USB Virtual COM Port from LabVIEW TM? Have you seen the data is being send to the Zebra printer spooler but nothing is printed out? Maybe these are questions with no answer for you, but there are possibilities, recent research has led me to implement a barcode Fail label with such specific data, I ran out on all these problems. My first trial was the use of a more native language within Windows, that was Visual Basic 6.0 TM which faced the very first problem the USB is not considered by Windows as a COM or physicall port rather is a virtual COM port, obviously not identified by the OS.

There is a work around, actually two, one is to create an alias virtual COM port programmatically and the second to use the Printer object (both are not within the scope of this blog). After several trials I was successfull and decided to move to LabView.

One critical and important detail is to properly configure the Printer processor to be used, for some reason if you select the model printer you have installed (in my case Zebra GK420d) as the defaul printer this will not work! ZPL code will not be interpreted and will print the code itself.

First thing, go to Start->Control Panel->Printers and click on Add a Printer. You will select Add a local printer on the popup window. You will look for the port in which your printer was configured, usually USB001 (see picture below) but if you had already another device using this then make sure you select the right one or your application will not work.

Continue with the wizard installation, when prompted to select the printer driver make selection for Generic - Generic / Text Only and finish the installation, make sure you make this the default printer.

This is fifty percent of the work, at this point you are maybe asking yourself how you will be sending the ZPL to the USB virtual port, you have maybe already tried many different things starting with VISA which will not work for sure because this virtual port is not listed. Well there is an option and for this you will require to have installed the "REPORT GENERATION" TOOLKIT VIs, if you haven't done this find your TOOLKIT installation disk to install it. Below you will find an example of my application, there you see how the report generation VIs are used for this purpose.

One last thing, download Zebra Setup Utilities (the link provided is for model GK420d) and configure your label size, the speed and darkness of printing (this will impact on your print quality), printing method (direct or thermal transfer), the media type (how the printer knows when it reached the next label after print) and the media handling (tear off, peel off, cutter, etc). You must do this to have the print design exactly located within the size configuration of your label, otherwise you will be wasting labels or have incorrect printouts.

The end result with this method is the following Fail Label, in my case this is a thermal label with the following dimensions: Width = 1.57in Height = 1.00 in.

NOTE: I have this solution in Visual Basic 6.0 TM if you needed please contact me.