Jump to content
OMRON Forums

Reading Values in Excel (CSV File) Using a Smart Camera


Recommended Posts

This procedure intends to provide a very simple way to read output values from Microscan Smart Cameras into an Excel spreadsheet (CSV format).
If the output value from the camera contains a comma (as part of a string, for example) it will be treated as a separator and not as part of the read value. In this case, please, use the “Reading Values in Excel (TXT File)” .
 

1.    Reading Text Files in Excel

Usually, there are two ways to import data from text files into Excel: delimited text file (.txt) and comma separated values text files (.csv).
This procedure presents the use of comma separated values text files (.csv), with the comma character (,) used as the separator of each field of text.
Attention: If the output value from the camera contains a comma (as part of a string, for example) it will be treated as a separator and not as part of the read value. In this case, please, use the “Reading Values in Excel (TXT File)” document.

2.    PuTTY Software

This simple solution use PuTTY (http://www.putty.org/) to read output values from Microscan Smart Cameras: PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.
You can download PuTTY here.

3.    Simple Example

A simple example is used to demonstrate this functionality: reading output values from two Count Tools (Number of Parts) in AutoVISION and FrontRunner:

User-added image

Microscan - Excel_CSV_AV.avp

User-added image

Microscan - Excel_CSV_FR.avp

 

Both AutoVISION (Microscan - Excel_CSV_AV.avz) and FrontRunner (Microscan - Excel_CSV_FR.avz) files are available.

4.    Defining Output Format

TCP/Serial Output (AutoVISION) and Formatted Output (FrontRunner) accept the following special characters:
 
\a bell
\b backspace
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\’ single quote
\” double quote
\? question mark
\ooo octal ASCII value (\145 = 'e')
\xhh hexadecimal ASCII value (\x4C = 'L')

4.1      Defining Output Format – AutoVISION

The comma character ( , ) must be inserted between each value to be transmitted (as many as needed). At the end of the transmission, a Carriage Return (\r) and a New Line (\n) must be also inserted (\r\n).
User-added image
 

4.2      Defining Output Format – FrontRunner

With much more flexibility, the Output Format can be defined in the same way as in AutoVISION (just one output string for all information) or in separate output string for each information.
Anyway, the comma character ( , ) must be inserted between each value to be transmitted (as many as needed) , and a Carriage Return (\r) and a New Line (\n) must be also inserted (\r\n) at the end of the transmission.
User-added image
Defining Output Format in FrontRunner (just one line for all information) – Step Tree Editor View
Format: %d\t%d\r\n
Additional information is available into “Visionscape Tools Reference” (Chapter 1, “Formatted Output”).


5.    Connecting PuTTY

Into Session Category, enter the IP Address of the Smart Camera (for Emulator mode, enter ‘127.0.0.1’), the TCP Port defined in the JOB to send out the information (the above examples use the port ‘49211’) and select Telnet as the Connection Type:
User-added image
Moving to Logging (into Session Category), select All session output option (Session logging) and define the Log file name as CSV extension.
Click on   Browse…  to define the path for this file:
User-added image
Click on User-added image  to connect to the device / emulator.
PuTTY window is updated as soon as the data is sent out by the device / emulator (the CSV file is also updated):
User-added image



6.    Opening CSV file in Excel

When finished the acquisition (or even during the operation), double click on the CSV file:
User-added image
All data will be into the spreadsheet (the CSV file can now be saved as an Excel file):
User-added image
The first row contains PuTTY log info
 

Operating System

Any

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...