Contact our team
+49 7243/2167-24 info@vision-components.com

Software FAQ

Answers and tips of our experts relating to all our software products.

Software
Software
Serial interface VC40xx Smart Cameras Serial interface VC40xx Smart Cameras

Description of the additional serial interface of the VC40xx Smart Cameras.

Hardware considerations

From VC40xx Smart Cameras, the trigger interface allows 4 different uses:

  • trigger
  • I/Os keypad
  • serial interface (VC40xx ONLY).
  • high speed, 3 channel encoder interface

Serial C6 cables for the standard V24 (RS232) interface can be used only with serial VC20xx cameras! The serial interface found on the VC40xx cameras needs a C4 cable, available in length of 5m, 10m and 25m, and with connector on one or on both sides.
Multiple devices can be connected to this interface at the same time, using one or two Y adaptor cables (order no. VK000124).

Using the serial interface

For the time being, the serial interface cannot directly be accessed via the shell (the feature will be available in a future release of VCRT). Yet a serial shell is available as a stand-alone application in the knowledge base (can be downloaded for testing).

Please note: 
VC4xxx Smart Cameras from model VC4038 (not VC4016 and VC4018) feature from July 2006 an encoder interface. With these cameras, only the serial input line is active after startup. The serial output line needs to be enabled prior to its use, in order to protect a connected encoder.

Using the serial interface

VC4xxx Smart Cameras from model VC4038 (not VC4016 and VC4018) feature from July 2006 an encoder interface. With these cameras, only the serial input line is active after startup. The serial output line needs to be enabled prior to its use, in order to protect a connected encoder.

The following macro needs to be called to enable the serial output line:

INTERFACE_MODE(SERIAL);

The program attached below is an example of how to communicate via the serial interface. Compile it and download it to the camera, then start the program. Open a serial session with your terminal program (for example Teraterm), you will see the string "Hello" transmitted from the camera. Then type any character to the serial interface, you will the the characters on the Ethernet side. Before the program quits it sends a big quantity of data (characters) to the serial interface.

Example file: test_kbd2.c

Serial shell Serial shell

Accessing the shell via the serial interface of VC4xxx cameras

Accessing the shell is now also possible using the additional serial interface of the VC4xxx cameras! This means it is possible to start a camera in "serial shell" mode, starting programs or executing shell commands via the serial camera interface.

We provide two solutions to achieve this: using a serial shell program or simply switching the standard I/Os to the serial interface.

Accessing the shell via the serial interface of VC4xxx Smart Cameras

We provide two solutions to achieve this: using a serial shell program or simply switching the standard I/Os to the serial interface.

1. Using the serial shell program

This program has to be used if you need to be able to use both telnet and serial shells at the same time.
At present the following programs have to be uploaded into camera memory (included in file below):

  • sershell.out - executable program that opens the serial shell.
  • shell2.cex - compressed executable shell - compiled as relocatable code. 

Description:
Calling the program "sershell" starts the serial shell. It is now possible to run 2 shells in parallel - one accessible via Telnet Port 23 and the second one accessible via RS232. The serial shell can be activated at camera startup calling"sershell" with help of an auto exec file.

Default baud rate is 115200 bd.

The serial shell can be closed with the shell command "kill 65547".

The current task ID may vary. The task ID can be queried with help of the shell command "procs":

$procs
print task list
NAME PID STATE PRI FLAGS
...
shell2 65547 WAIT 009 00000004

2. Switching the standard I/Os to serial interface

The second solution, if you need either the telnet shell or the serial shell, is to switch the standard I/Os to the serial shell with the program swtty.c included in the file below.

With no argument, the program switches to the serial interface. With any argument, the program switches back to telnet.

Please note:

  • This feature will be integrated in future operating systems. "sershell" works with the current camera operating system VCRT 5.25 and may not work with future camera OS, so program adjustment may be required when porting the code to newer systems.

Downloads: shell.zip

High speed Encoder Interface for VC4xxx Smart Cameras High speed Encoder Interface for VC4xxx Smart Cameras

Serial output now inactive at startup with new camera hardware

All VC4xxx Smart Cameras (apart from VC4016 and VC4018) now feature a high speed encoder interface. 

Please follow the link below to download the new demo program enc_RPM.c. This program measures the turing speed of the encoder.

Please note: The encoder interface is only supported with new hardware (new PWR board).

  • VC Smart Cameras with the new encoder interface show a "1" as 3rd serial number digit (for example: 201XXXX for a VC4038 with encoder interface).
  • VC Smart Cameras without encoder interface show a "0" (for example: 200XXXXfor a VC4038 without encoder interface).

 Please observe: VC Smart Camera operating systems are not interchangeable. 

  • New camera operating systems from VCRT Version number 5.24-8 cannot be installed on cameras with old hardware (check during installation).
  • It is important not to install older operating systems VCRT Version numbers less than 5.24-8 on cameras with new hardware. (For example: 201XXXX for a VC4038 with encoder interface). This may damage the VC Smart Camera. 

 All VC Smart Cameras are now booting with the serial camera output inactve!

Since the serial output is now used as encoder signal input, this signal (V24 TxD out, Pin 1) is now inactive after starting the camera in order to protect an encoder connected.

Turn the serial interface on as shown in the demo program in order to use the serial output. The serial input is active from the camera start. This way the keypad can still be used to stop autoexec execution or to reset the IP address.

Start the md_rs232 program prior to your main program if you do not want to make adjustments to your code. This program simply calls the macro "INTERFACE_MODE(SERIAL), which means the camera starts up as serial camera as before (see file Mode_RS232.zip, download link below).

Encoder interface macros only work from VCRT/VCLIB PC library update version VCRT5.24_VCLIB302.

Also linked to this article is the source code and the compile test program for the encoder interface.

  • type 'iftest4x enc' => encoder TEST
  • type 'iftest4x ser' => serial I/O TEST

The Encoder.pdf shows the correct pin allocation for connecting an encoder (see download link below).

Encoder.pdf

Encoder.zip

VC Smart Cameras with color sensor VC Smart Cameras with color sensor

Specific features and white balance

Description of the differences between VC color cameras

Vision Components sells two kinds of color cameras:

  • "Real" color cameras, with hardware color input look-up table: 
    the VC2065EC, the VC4065/C and VC4465/C.
  • Smart Cameras with color sensor: 
    for example VC4016/C, VC4018/C, VCSBC4016/C, VCSBC4018/C, and theoretically all  VC4xxx Smart Cameras ordered with color sensor.

"Disp" and "wb" shell commands, color LUT

These commands only work now with the VC2065EC. See program "wb.c" for an example of how to adjust the white balance on this camera. See program "whitebal.c" for an example of how to adjust the white balance on cameras with color sensors (especially VC4016/4018C). 
The first step is identical in both cases: use the function WhiteBalanceValues() to calculate white balance values. Then in the first case (VC2065EC) use init_color_lut() to program the hardware color LUT, and in the second case use init_color_table() to program a software color LUT.

Then in the case of a software color LUT, after every picture taking the LUT has to be applied to the picture with the clut_bayer() function.

Bayer pattern

On VC4016/4018C cameras, the bayer pattern may be shifted compared to the bayer pattern of the VC2065EC. This means, if you use color conversion functions like Bayer to RGB, colors will not be right. To solve this, the image variable should begin one line below, that is the start address has to be changed to getvar(CAPT_START) + getvar(VPITCH): 
ImageAssignC(&area, getvar(CAPT_START) + getvar(VPITCH), IMAGE_BAYER, ...);

If the colors still do not seem right, try
getvar(CAPT_START) + 1 or getvar(CAPT_START) + getvar(VPITCH) +1.

Example file: wb.c

Image height adjustment VC4002L Line Scan Smart Camera Image height adjustment VC4002L Line Scan Smart Camera

At camera start up, one image memory page is allocated automatically. The height of the image pre-allocated is 512 pixel (VWIDTH). This 1 Mbyte image memory can not be de-allocated.

Decreasing the image height from 1 to 512 lines can be done just by setting VWIDTH to the corresponding value.

In order to increase the image height to 513 to 16384 lines (representing the full DRAM capacity of 32 Mbytes) allocation of a new image page is required in addition to the VWIDTH adjustment.

The demo program included in the hardware documentation shows how to increase the image height.

Download

Floating point calculations Floating point calculations

The floating point operations are very slow. Is there something wrong in my program?

Texas Instruments TMS320C6xxx DSPs used in VC Smart Cameras are not optimized for floating points operations. Please use integer calculation wherever possible, for example by using a scaling factor. 

See PDF for more information!

If floating point calculation is absolutely needed, the TMS320C62x/C64x FastRTS Library can be used. The execution times are then 2 to 4 times faster than with the "normal" library.

This library is free and can be downloaded from TI.   

Live image transfer from VC Smart Camera to PC Live image transfer from VC Smart Camera to PC

How do I get a live image on my PC (from a VC20xx, VC4xxx or VCSBC4xxx)?

To transfer images from a VC Smart Camera to a PC, use one of our demo-programs "img2.c" or "imgpar.c" which can be downloaded from our Download Center.
Both programs transfer images from the camera to the PC.

  • img2 takes an image and transfers it to the PC, in live or still mode.
  • imgpar has been optimized to run in parallel to other processes: it simply transfers the content of the Logical Page to the PC - without taking images itself. This means you can transfer images taken by any other program, as long as they are in the Logical Page (of course, a modification for another memory zone is possible). imgpar must be launched before your main program with "imgpar &" command. Imgpar is attached to this article.

Remember to compile parallel programs relocatable (i.e. by using project files with "r" at the end - for example: "new525_CCS31r"). Hint: for transfering live images, turn the camera to live mode using the shell command "vd -l .

These programs transfer up to 30 images (640*480 Byte) per second. Please start the program "img2" (resp. imgpar and your other program) on the camera at Telnet port 23. Then start the PC program.

After you start the camera program the camera waits at port
SERVER_PORT (port 2002) for a string RECEIVE_BYTES (24 Bytes).

This string includes the following data:

  1. x position of the image (int value, 4 Bytes)
  2. y position of the image.
  3. dx
  4. dy
  5. incrx
  6. incry

If the string is complete the camera starts transferring the image. It responses the string values at port 23. Then it waits again at port SERVER_PORT for a new string. Is the value dx=0 the program ends.

How to start the raw image transfer via TCP/IP using VC's "ATX Client"?

Please do the following steps:

  1. In order to register the OCX please call from command line:
    -> regsvr32.exe atxcontrol.ocx <-
  2. start img2 on the camera (resp. img3 and your main program) 
  3. start atxClient.exe and type in the

    • IP#,
    • port=2002,
    • x,y, dx,dy (the size and position of the image)

The 'Server' program is just for testing. If you want to use the'Live' feature you need to check the checkbox BEFORE creating the connection. Eventually you'll have to hit 'Shutdown' before you check that box and then reconnect - sorry. Just for testing.

For further information, please consult the read-me file.

Downloads

Trigger timings of VC20xx and VC40xx Smart Cameras Trigger timings of VC20xx and VC40xx Smart Cameras

tDEL: Delay from external trigger input to internal CCD exposure. 
Depending on camera model, e.g. 42.0 µs +/- 100 ns constant!

tEXP: Exposure Time. 
Short exposure: 5, 10, 15, 20 µs
Long exposure: 60, 100, 140 µs

This timing applies to all VC20xx, VC40xx, VC44xx cameras except VC4016, VC4018, VCSBC4016 and VCSBC4018.


Exposure and delay timing for VC2038

Exposure type   tEXP[µsec]   tDEL[µsec]
short   30   50
long   80   50
long   130   50
long   180   50


Exposure and delay timing for VC2048

Exposure type     tEXP[µsec]     tDEL[µsec]
short     18     36
long     36     36
long     72     36
long     108     36


Exposure and delay timing for VC2065

Exposure type   tEXP[µsec]   tDEL[µsec]
short   5   57
short   10   52
short   15   47
short   20   42
long   60   42
long   100   42
long   140   42


Exposure and delay timing for VC4038

Exposure type   tEXP[µsec]   tDEL[µsec]
short   5   49.48
short   10   44.48
short   15   39.45
short   19   35.04
long   50   35.04
long   91   35.04
long   122   35.04


Exposure and delay timing for VC4065

Exposure type   tEXP[µsec]   tDEL[µsec]
short   5   43.29
short   10   38.79
short   15   34.29
short   20   29.07
long   50.5   29.07
long   81   29.07
long   111.5   29.07


Exposure and delay timing for VC4066

Exposure type   tEXP[µsec]   tDEL[µsec]
short   10   55.68
short   15   51.18
short   20   46.68
short   30   41.34
long   72.3   41.34
long   114.6   41.34
long   156.9   41.34
Image Transfer all VC Smart Cameras Image Transfer all VC Smart Cameras

How to use the image transfer program „img2bnew" with different VC Smart Cameras as a background task (without own image acquisition and prints).

  1. Start„img2bnew" as shown in the TeraTerm Screenshot at the end of this article.
    Start from Shell with parameter „&" - this starts the program as a background task - priority 9.
  2. Start the ATX Client - note that the ATX requires an entry in the registry, calling „regsvr32.exe atxcontrol.ocx" from the command line (refer to the ATX Client readme file for details). Provide the correct IP Address and fill in other parameters as required (port is already selected).
    Tick „live mode" and then click the button „Get Image"
    The program now transfers the logical image page (default at power up is the physical page = capture and display page). The image is black for the line scan camera, since this camera (and most other cameras without Video output) start in still mode - not in live mode!
  3. Hit Return on the Telnet Port, so the standard interface returns to the shell ($ prompts displayed again). This can also be done prior to starting the ATX Client. It is now possible to focus the camera or to start any other program from the shell (a program startet from shell without the paramter „&" receives a slightly higher priority: 8). The program started should take images and include waiting times (time_delay() or wait() functions. Otherwise the background program „img2bnew" does only transfer the same memory content or does not get execution time. Since img2bnew transfers the logical image, a differnet image page can be displayed simply by changing the logical page in the main program.
  4. Switch the line scan camera to live mode, using the shell command „$vd -l" (this of course also works with any other camera, note however that the gain values differ).
    It may be a good idea to reduce the shutter first to 1 ms (shell command „$sh 1000"), or the image aquisition takes (default line exüposure time) x (default image height =512 lines) = 5,12 seconds!
    In case the image is too dark, it is possible to in crease the gain using the shell commands „$vd -g 1" or for further increase „$vd -g 2" - this of course also increases the image noise (default gain value is 0).
  5. Caution:
    Although started as a background task all image transfer programs may slow down your main taks occationally (see section 6.3 of the „Programming Tutorial Basics"). This is due to the higher priority of the TCP/IP task referenced during image transfer. This can only be avoided by starting the main program with priority 5. However if doing so, extreme caution is advised not to block any other sytem tasks!
  6. Note regarding „img2bnew":
    This program allocates 0.5 million words (2 million bytes) image memory (see memory define), which is sufficient for all VC cameras and linescan images up to about 970 lines. Adjust this value if needed (add 10 extra lines of memory for the VC4002L).

Downloads

Copying an image from MMC card/Flash EPROM to hard disk Copying an image from MMC card/Flash EPROM to hard disk

I'd like to copy an image from the MMC card (md:/) or the Flash EPROM (fd:/) to my hard disk. What are the different possibilities to do this?

To copy an image using the shell, follow these steps:

(1: tp /*takes an image*/)
2: js fd:/image.jpg /*stores image as Jpeg on Eprom (resp. md:/image.jpg) - important to append ".jpg"! */
3: dwn image /*downloads Jpeg to PC - important not to append ".jpg"! */
After sending the command you will be prompted to activate the download function of your terminal program. With Teraterm you have to select "Log..." from the File menu. Then start the download by hitting any key.
4: rename the downloaded file (myjpegfile) into INPUT.MSF
5: call the function S2B as described in VC/RT. For this, move input.msf into c:/ti/util
and run "s2b" from this directory. (Input is INPUT.MSF - the file OUT.DAT is gernerated
by S2B)
6: rename OUT.DAT in myjpegfile.jpg
7: now you can open it with a graphic program

A FTP client like TotalCommander can also be used, which is much easier and faster. In this case, any file can be copied by drag-and-drop.

Trigger macros Trigger macros

Description of the fast trigger I/O macro functions

TRIGOUT_EXP(): sets the trigger output to exposure controlled mode. The trigger output is set automatically, according to the camera's trigger timings (see article "Trigger timings").

TRIGOUT_USR(): sets the trigger output to user controlled mode. The user can set the trigger output at will with SET_TRIGOUT() and RES_TRIGOUT().

SET_TRIGOUT(): sets the trigger output to active state.

RES_TRIGOUT(): resets the trigger output.

TRIGOUT_POS(): the trigger output is high in active state (during exposition in exposure controlled mode).

TRIGOUT_NEG(): the trigger output is low in active state (during exposition in exposure controlled mode).

TRIGINP_POS(): the trigger input signal is set to rising edge.

TRIGINP_NEG(): the trigger input is set to falling edge.

SET_trig_sticky(): see VCRT 5 documentation.

SET_trig_lossy(): see VCRT 5 documentation.

TRIG_INT_ENABLE(): enable trigger interrupt.

TRIG_INT_DISABLE(): disable trigger interrupt.

Taking a picture with VC Smart Cameras Taking a picture with VC Smart Cameras

How do I take a picture with VC Smart Cameras?

The function capture_request() is the low-level function for capturing an image. All other image-capture functions are based on it.

int capture_request (int exp, int gain, int *start, int mode)

exp is determined from the desired exposure time exptime (µs) with the following formula:
exp = exptime/EXUNIT - 520/944

WARNING: exp is an integer, which means not all exposure times are available.

The value of the system variable EXUNIT depends on the camera model (see table, or use getvar(EXUNIT) on your camera).

Camera 

VC2038

   VC2048

   VC2065

   VC2068

   VC4018

   VC4038

EXUNIT

50

   36

   39

   69

   62

   31

gain is determined from the desired gain G of the ADC with the following formula:
gain = 8.G(dB)-48

start is the start address for image storage.

mode defines the trigger mode: internal (software) if 0, external if 1. All VC4xxx cameras from VC4038 have a 2x binning mode: to activate it, simply add BINNING (defined in VCRT.h) to the mode parameter.

The function capture_request() sends a request to capture an image: each request is given a tracking number and is stacked. The maximum number of requests that can be stacked is 20. On trigger, the first request on the stack is evaluated and the image capture is made: the second request on the stack becomes first and waits for the trigger, and so on. If the trigger is internal, the capture is done immediately. The memory to store the image has to be allocated before using the function. To cancel a capture request use cancel_capture_rq() in a loop (returns 0 when successful, 1 if unsuccessful):

while(cancel_capture_rq());

The function tpict() captures an image with the internal trigger setting, and with standard exposure time and gain settings (which can be obtained with getvar(EXPCNT), getvar(GAIN)). The image is automatically saved in the image memory of the DRAM (see the document "Programming Tutorial Basics").

The function tenable() captures an image in the same way as tpict() with the external trigger setting and standard settings.

Interrupts/events on TI-based cameras Interrupts/events on TI-based cameras

Short description of events functions, used in the demo programs "trigtask.c" and "starttrig.c".
int wait(int id, int timeout)

  • Input Values: id is the event id number, timeout is a timeout value in milliseconds.
  • Returned Values: 1 if event occured, 2 if event occured before wait was called, -1 if event timed out.
  • Comments: waits for an event (set with function set_evt()) within a timout given with parameter timeout. If the event does not occur in this timeframe, the function returns -1.

int set_evt(int id)

  • Input Values: id is the event id number.
  • Returned Values: VCRT_OK if successful, other values: error.
  • Comments: sets the event for wait function. All tasks waiting for this event will immediately make a transition to the ACTIVE state.

void event_connect_to_task(void)

  • Comments: connects the current task to the event services. Should be called by the task, either by the user program or by the task boot procedure linked to the user program. This function has a VCRT trap entry. The function allocates memory for the event pointer table, then opens the events, finally, the pointer to the event table is stored in the task descriptor for the current task. Do not forget to call event_disconnect() on task exit.

void event_disconnect(void)

  • Comments: disconnects the current task from the event services. Should be called by the task, either by the user program or by the task boot procedure linked to the user program (when the task exits execution or the services are no longer needed). This function has a VCRT trap entry. The function closes the connection to the event services, then deallocates the memory used, finally a NULL pointer is stored in the task descriptors' EVENT field.

Predefined events can be used:

#define TIMER 0
#define MM_CARD 1
#define IMAGE_READY 4
#define EXP_READY 5
#define DHCP_READY 6
#define TRIG_READY 7
#define PLC_INT 8
#define I2C_INT 9
The user can also set his own event numbers, starting from number 10.
A complete description can be found in the VCRT documentation (from version 5.08, january 2007).

Reading a JPEG file with jl Reading a JPEG file with jl

I downloaded a JPEG file on my VC Smart Camera and then tried to load in into DRAM with the command "jl", but I got an error message./Displaying a JPEG image on the Smart Camera video output.

VC cameras are not able to read all JPEG pictures yet (the header changes from one program to another), but we are working to solve this issue once for all.
In the meantime, you can use the attached program, which converts a BMP image into a readable JPEG image. Of course, if you already have a JPEG image, you'll have to convert it to BMP with any software, and then use bmpjpg2.exe.

Use the following settings with this software tool (image height and width must be multiples of 8):

  • Quality: 80
  • Performance: Best Quality
  • Scale: 1:1
  • Format: 8 bit
  • Compression/Decompression: "Gray Scale"

Ensure that the file extension in flash memory is *.003 (rename the file during FTP upload if neccessary).

"SampleImages.zip" contains the a bitmap image (1.bmp), a screenshot of the conversion settings (CreateJPG.gif"), the produced Jpg (1080.jpg") and a screenshot of the camera video output ("bild.jpg") after using "jl 1080").
Please also see the attached application example for display of color JPEGs in the overlay.

Downloads

VC4002L line scan demo programs VC4002L line scan demo programs

Collection of demo programs for VC's line scan Smart Camera VC4002L

This article features a collection of demo programs for using VC's line scan Smart Camera VC4002L.

  • img2bnew: special version of the image transfer program for the VC4002L, transfering live images to PC for viewing and capture with the "ATX Client" (attached to this article). This application does not aquire images, since this is done in the main program or in live mode "vd -l". Start this program with the parameter "&". This way img2b runs as a background task.
  • imgL6000: another version of the image transfer program. ImgL6000 runs as a main task, taking and transferring images with 6000 lines.
  • captr.c: Program explaining the use of the 3 different trigger modes of the VC4002L linescan camera. Refer to the VC4002L documentation for details (see link at the end of article).
  • focus_linescan: This program aids lens focussing. Adjust the lens to the maximum value, since the focus value returened depends on the image content and brightness. Use a 0.5mm distance ring (1mm or more for a working distance of less then 200mm). 1" megapixel Cmount lenses with larger focal length (at least f=16mm) should be used.
  • pingpLN: Program showing how to use the linescan camera in "pingpong" mode - storing each alternating image on a differnt image page. This allows transfering or evaluating always the processed image.
  • paralLN: Showing how to use the linescan camera in parallel mode. By starting the next image capture already at the end of the previous one, the cycle time only depends on the image capture time (exposure time + transfer time). Note that all 3 steps - exposure, transfer and processing can only be done in parallel for single line capture mode (image height only one line), since line capture and transfer is done on a line by ine basis.

... more demo programs to follow!

Downloads:

For additional information also refer to the programming section of the VC4002L manual.

JPEG Download, Upload and Display JPEG Download, Upload and Display

Taking an image and downloading as JPEG to the PC using shell commands

(with Ethernet cameras use FTP)
1: tp /*takes an image*/
2: js fd:image.jpg /*stores image as Jpeg on Eprom - important to append ".jpg"! */
3: dwn image /*downloads Jpeg to PC - important not to append ".jpg"! */

After sending the command you will be prompted to activate the download function of your terminal program. With Terraterm you have to select LOG... from the File menue. Then start the download by hitting any key.

4: rename the download file (myjpegfile) into INPUT.MSF
5: call the function S2B as described in VC/RT. For this, move input.msf into c:tiutil and run "s2b" from this directory. (Input is INPUT.MSF - the file OUT.DAT is gernerated by S2B)
6: rename OUT.DAT in myjpegfile.jpg
7: now you can open it with a graphic programm


Upload a JPEG greyscale image from PC to the camera 
(The image width and height needs to be multiples of 8.)

1: rename "myjepegfile.jpg" into "Binary.dat"
2: Move "Binary.dat" into directory c:tiutil
3: Run "JCONV image" from this directory. This converts the binary file into "ADSP.OUT" - "image" sets the name of the Jpeg file on the camera memmory.
4: Run "SCVT" (without parameter) from the c:tiutil directory. This generates the S-record file "ADSP.MSF"
5: Upload "ADSP.MSF" into the camera using the "lo" shell command and File-Send file in Terraterm
6: Check with the shell command "DIR" if the image was correctly loaded into the memory. The directory entry should look like: "image 003 000022B6". The filetype "0003" denotes a Jpeg image.


Display the image on screen (video output camera)

1: vd -d 0 /*displayes the memory content of video frame buffer number 0*/
2: jl fd:image.jpg /*loads the jpeg file "image" into frame buffer 0 and displays it - important to append ".jpg"!*/

Download: jpeg.zip (2 KB)

Private system variables Private system variables

What are private system variables?

Private system variables (there are 50 of them) can be used by the programmer at will, for example to pass data between programs running in parallel.
Please also see our "Programming Tutorial Basics", and the tutorial program "sysvar.c", available in the Download Center of our website.

TCP Client for VC Cameras TCP Client for VC Cameras

TCP client demo program

This demo program is a TCP client. It is designed to get and display pictures from another camera, and it can be used together with the img2 demo program.
Connect timeout of 100 seconds added.

TCP_client.zip (4 KB)

Software reboot for VC20xx, VC4xxx and VCSBC4xxx Smart Cameras Software reboot for VC20xx, VC4xxx and VCSBC4xxx Smart Cameras

Is there a possibility to reset VC Smart Cameras (TI series) via software?

This is dependant from the version of the operating system.

With VCRT < 5.23:
The only way to software-reset VC20xx and VC4xxx cameras is to try to execute a file that doesn't exist or a non-executable file. Just use
exec("anything");
in your program, an error occurs and the camera reboots.

With VCRT > 5.23:
Since VCRT 5.23, a reset function is included in the operating system. Simply use 
reset();
and your camera will do a software-reboot.

Code Composer Studio updates recommended Code Composer Studio updates recommended

I'm working with the Code Composer Studio Version 2.10.0. Which update do you recommend and which not?

Please only update to version 3.1 or 3.3. Do not use versions between 2.2 and 3.0 included, as issues may occur.
Please note that some debugging information have to be removed from the executable code, by inserting "strip6x new.out" as first line of the final build steps under build options.
To get an update of your registered copy of Code Composer Studio, please write to texasinstruments(AT)worldmarkinc.com.

Sending binary data via Telnet on Ethernet VC Smart Cameras Sending binary data via Telnet on Ethernet VC Smart Cameras

How do I send binary data via Telnet?

Sending binary data via Telnet is done in the same way as via RS232. The camera functions are identical for RS232 serial or Telnet transfer.

The CR -> CR + LF conversion may have to be turned off as shown in the following snipplet.

Setting the serial port options with io_ioctl() 
with Option IO_IOCTL_SERIAL_SET_FLAGS (see VCRT.H)

with param =

#define IO_SERIAL_RAW_IO (0)
#define IO_SERIAL_XON_XOFF (1) /* Perform xon/xoff processing */
#define IO_SERIAL_TRANSLATION (2) /* Perform translation : outgoing n to CRLF
*/
/* incoming backspace erases previous character */
#define IO_SERIAL_ECHO (4) /* echo incoming characters */
#define IO_SERIAL_HW_FLOW_CONTROL (8) /* RTS/CTS hardware handshaking */

Example:

int flags, oldflags;
FILE *fp;

fp=(FILE *)io_get_handle(IO_STDOUT);

flags = IO_SERIAL_RAW_IO;

io_ioctl(fp, IO_IOCTL_SERIAL_GET_FLAGS, &oldflags); /* get communication status */

io_ioctl(fp, IO_IOCTL_SERIAL_SET_FLAGS, &flags); /* no CR/LF translation */

/* now you can send serial data to the serial port. no change */

io_ioctl(fp, IO_IOCTL_SERIAL_SET_FLAGS, &oldflags); /* restore communication */

/* now every LF becomes CR+LF. better for print */

Creating and downloading color bitmaps from VC Color Smart Cameras for VC2065 EC, VC4018/C, VC4016/C, VCSBC4018/C and VC4016/C Creating and downloading color bitmaps from VC Color Smart Cameras for VC2065 EC, VC4018/C, VC4016/C, VCSBC4018/C and VC4016/C

The linked programs (see link below) allow the creation and download of color images from VC Color Smart cameras.
VC Color Cameras include a Bayer pattern filter on each CCD. In order to display color images on the PC the Bayer image has to be converted to an RGB image. This is stored at 3 image pages in SDRAM. The program color4.c does the Bayer to RGB conversion and stores the resulting color image as bitmap file on flash or SD card. Download the bmp file via FTP for displaying the cmaera image with any drawing program.
Since VCSBCxx and VC4016 and VC4018 cameras do not feature a SD card, the ímage needs to be stored on the flash Eprom - see color4_nodisp.c Since the 4 MB flash fills up quickly when storing bmp files, delete the image and use "pk" between image creation. When storing on Flash, rename the file extension from *.231 to *.bmp.
The program "color.4" can be used to store images on SD card with any other VC Color Smart Camera with video output interface.

color4.zip

VCRT 5 exec, exec1 and exec2 functions VCRT 5 exec, exec1 and exec2 functions

What are the differences between exec, exec1 and exec2?

When exec() is used, the calling process is terminated (meaning, if the program was called from the shell, the shell is overwritten). With exec1() and exec2(), the launched process is run in parallel (like when a program is called with "&" in the shell). This means that the calling program no longer has to be loaded again when the called program terminates.
exec1() was the first function created for this "parallel mode", but only accepted 1 argument. exec2() now replaces it, and can accept two arguments.
All functions return the process ID.
See VCRT documentation for further explanations.

Executing shell commands with the exec() function Executing shell commands with the exec() function

I am trying to execute shell commands with the exec function, but the camera hangs.

When executing a shell command with exec(), like for example: 
exec("fd:/shell.exe",2,"bd 19200"); (do not forget to type the absolute path)
the shell overwrites itself, that's why when the program finishes, the camera hangs. To prevent this, recall the shell at the end of the program:
exec("fd:/shell.exe",0,"");

Function io_fopen() in VCRT Function io_fopen() in VCRT

The statement io_fopen(fn, "wb"); (or fopen(fn, "wb");) does not seem to work in my program.

On VC Smart Cameras, to write to a file only the "w" option can be used. The "wb" option will not work (files are always opened in binary mode).

How to get Code Composer Studio Updates How to get Code Composer Studio Updates

How do I get an update for TI Code Composer Studio version 2.xx?

Please write an e-mail (in english) to texasinstruments(AT)worldmarkinc.com, indicating your licence number. Your product has to be registered on the website of TI.

Automatic CPU switch-off on VC Smart Cameras Automatic CPU switch-off on VC Smart Cameras

Do VC cameras switch off automatically if the CPU temperature gets too high?

TI-based cameras have an automatic reset if the temperature of the camera housing exceeds 80°C. The DSP then stays switched off till it gets cooler again. There is also an interrupt that can be used to reset the camera if the temperature exceeds 64°C.

Writing to MMC/SD from a background process Writing to MMC/SD from a background process

I am running a background process, and I am trying to write to the MMC/SD card from this process, but it doesn't work. What's the matter?

The events system is used to access the Multimedia Card. When the program is launched from the shell, the shell is already "linked" with the events system, and handles events. That is not the case if a program is run in the background (for example launched with exec() or exec2()) and you have to activate it, in the following way: just add event_connect_to_task(); at the beginning of the called program(s) and event_disconnect(); at the end.
This will be automatic in a future version of VCRT.

Changes from VCLib 2.0 to VCLib 3.0 Changes from VCLib 2.0 to VCLib 3.0

I want to update my program from VCLib 2.0 to VCLib 3.0. What do I have to do?

All functions have been completely revised. They have been rewritten to account for the structure and possibilities of the TI C62xx and C64xx architecture. This allows for future improvements in speed and functionality. VCLib 3.0 is not backward compatible to the (older) ADSP architecture.
Changes necessary to use VCLib 3.0 for existing programs:

Functions for image variablesNo changes.
Functions for RLCChange all RLC pointers from long to U16 *.
 Change all numerical values from half addresses to real addresses.
 Change the maximum size for call of rlcmk() from integer to byte (factor 4).
 blrdb() and blwrb() functions are no longer used.
Functions for Contour CodeChange CC pointers from long to U32 *.
 Change all numerical values from half addresses to real addresses.
 Change the maximum size for contour8() from integer to byte (factor 4).
Basic functionsContact VC.
Pixellist functionsIt is recommended, but not necessary to change to the new functions with different names.
Functions returning longChange definition for result or use cast.

For further information, please consult the documentation of the image processing library VCLib 3.0.

Function chprint1() Function chprint1()

How does the function chprint1() differ from chprint()?

The additional argument "val" in void chprint1(char *str, image *a, I32 cx, I32 cy, I32 val); is the brightness of the written text, between 0 und 255

Smart Camera hangs after a failed attempt to connect to a remote server Smart Camera hangs after a failed attempt to connect to a remote server

Problem:
The camera "hangs" 100 seconds after a failed attempt to connect to a remote server.

Cause:
According to the RFC TCP/IP standard it is not possible to reduce the OPT_CONNECT_TIMEOUT below 100s.

Solution:

  1. Use VCRT_ping() to establish if the remote server is active.
  2. Call connect() to connect to the remote socket if VCRT_ping() is successful.

Case 1:
The remote server is active, but not the corresponding port/socket.

  • VCRT_ping() is successful
  • calling connect comes back directly with error code "0x636 (connection reset by peer)"

Case 2:
IP not there and no corresponding port.

  • VCRT_ping() not successful
  • don't execute connect()

Case 3:
IP exists and server with corresponding port is active.

  • VCRT_ping() is successful
  • calling connect() is successful

From VCRT 5.26 camera OS please refer to attached demo program. (Please log in first to be able to download the attached demo program.)

Update from VCRT 5.28: 
TCP/IP: TCP SEND and CONNECT TIMEOUT can now be lowered via set of socket options to 1000 (send) and 1800 (connect) milliseconds.

TCPclient_ping-1.c (6 KB)

Compiling error - identifier FL_xxx undefined Compiling error - identifier FL_xxx undefined

I get the following error when compiling my project under Code Composer Studio:
identifier "FL_SetBin_U8P_U8P" is undefined
What's the matter?

Some functions use functions from VC Fast Vector Library (FastLib). If an identifier beginning with FL_ is not recognised by the compiler, this is the case. Simply include FastLib in your c-files : #include <flib.h>

Reading data from VCSKB keypad Reading data from VCSKB keypad

How do I read data from VCSKB keypad?

To read data from keypad, you can use kbdrcv() and kbready() functions. See VCRT 5 documentation for a description. The following program reads data from keypad or from keyboard.

/*****************************************************************************************************************/

#define TimeOut 10 /* ms */

int ReadKeyboard (int wait)
{
int i, ch1, ch2, ch3, ch4, src;


// initialize Data Matrix Reader for CAMERA_WITH_NO_VIDEO_OUTPUT
#ifdef CAMERA_WITH_NO_VIDEO_OUTPUT

if(wait || rbready()) 
{

src=0;

#else

if(wait || kbready() || rbready()) 
{

while(1)
{
if (kbready()) {src=1; break;}
if (rbready()) {src=0; break;}
}

#endif

if(src) ch1 = kbdrcv();
else ch1 = rs232rcv();

if (ch1 != 0x1b)
if(ch1 == 0x0d || ch1 == 0x0a)
return(KEY_ENTER);
else
return(ch1);

ch1 = KEY_ESC;

for (i=0; i {
time_delay(1);
if(src) {if (kbready()) break;}
else {if ( kbhit() ) break;}
}
if (i==TimeOut) return(ch1); /* we've been waiting for too long */

if(src) ch2 = kbdrcv();
else ch2 = rs232rcv();

for (i=0; i {
time_delay(1);
if(src) {if (kbready()) break;}
else {if ( kbhit() ) break;}
}
if (i==TimeOut) return(ch1); /* we've been waiting for too long */

if(src) ch3 = kbdrcv();
else ch3 = rs232rcv();


if (ch2 == 0x4f) /* 2/3 of a F1 or F2 received? */
{

if ((ch3 == 0x71) || (ch3 == 0x50)) /* F1 received? */
return(KEY_F1);

if ((ch3 == 0x72) || (ch3 == 0x51)) /* F2 received? */
return(KEY_F2);

return(KEY_INVALID);
}

if (ch2 == 0x5B) /* 2/3 of a Cursor received? */
{
if (ch3 == 0x31) 
{
for (i=0; i {
time_delay(1);
if(src) {if (kbready()) break;}
else {if ( kbhit() ) break;}
}
if (i==TimeOut) return(ch1); /* we've been waiting for too long */

if(src) ch4 = kbdrcv();
else ch4 = rs232rcv();

if (ch4 == 0x31) /* F1 received? */
return(KEY_F1);

if (ch4 == 0x32) /* F2 received? */
return(KEY_F2);
}
else
{
switch (ch3)
{
case 0x41 :
case 0x42 :
case 0x43 :
case 0x44 : return(ch3 - 61);
default : return(KEY_INVALID);

}
}
return(KEY_INVALID);
}
else
{
return(KEY_INVALID);
}
}

/**************************************************************************************************************/


You can use it in the following way, for example :

response = ReadKeyboard(1);

switch(response)
{
case KEY_DOWN : .... break;
case KEY_RIGHT: break;
case KEY_UP : break;
case KEY_LEFT : break;

case KEY_F1 : break;
case KEY_F2 : break;

case KEY_ESC : break;
case KEY_ENTER : break;

case 'a' : break;

}

For each case, just put your own instructions.

Code Composer Studio Free Trial Version Code Composer Studio Free Trial Version

Where do I download the free trial version of Code Composer Studio?

To get the time-limited version of Code Composer Studio 3.3, please follow this link to the TI website.

Fast Fourier Transform with VC20xx and VC40xx Smart Cameras Fast Fourier Transform with VC20xx and VC40xx Smart Cameras

FFT using TI's library functions on VC Smart Cameras with TI DSP

Fast Fourier Transformation functions (FFT) are not yet integrated into VCLib for Smart Cameras with TI DSP.
However, this article shows how to implement TI's FFT library functions on these cameras.

How to implement TI's FFT library functions on these Smart Cameras:

  1. Calculate the "twiddle factors" for the length: dx=2^n (zB. 64, 128, 256, etc.
  2. Use the Ti FFT functions:

Wdx = (I16 *)sysmalloc( (( dx) * sizeof(I16))/sizeof(I32) + 1, MDATA);
IndexDx = (I16 *)sysmalloc( (( dx) * sizeof(I16))/sizeof(I32) + 1, MDATA);
// Generate the twiddle-factor array
scale = 32767.5;
gen_twiddle(Wdx, dx, scale);
// This routine performs a complex bit reversal index table
bitrev_index(IndexDx, dx);
using the functions:
/***************************************************************************************************************************/
void bitrev_index(I16 *index, I32 n)
{
I32 i, j, k, radix = 2;
I16 nbits, nbot, ntop, ndiff, n2, raddiv2;
nbits = 0;
i = n;
while (i > 1)
{
i = i >> 1;
nbits++;
}
raddiv2 = radix >> 1;
nbot = nbits >> raddiv2;
nbot = nbot << raddiv2 - 1;
ndiff = nbits & raddiv2;
ntop = nbot + ndiff;
n2 = 1 << ntop;
index[0] = 0;
for ( i = 1, j = n2/radix + 1; i < n2 - 1; i++)
{
index[i] = j - 1;
for (k = n2/radix; k*(radix-1) < j; k /= radix)
j -= k*(radix-1);
j += k;
}
index[n2 - 1] = n2 - 1;
}
/************************************************************************************************************************/
I32 gen_twiddle(I16 *w, I32 n, double scale)
{
double angle, step;
I32 i;
step = (2.0 * PI) / (double)n;
for (i = 0, angle = 0.0; i < n; i += 2, angle += step)
{
w[i + 0] = d2s(scale * -cos(angle));
w[i + 1] = d2s(scale * -sin(angle));
}
return n;
}
/************************************************************************************************************************/
static I16 d2s(double d)
{
if (d >= 32767.0) return 32767;
if (d <= -32768.0) return -32768;
return (I16)d;
}
/************************************************************************************************************************/
After this, the FFT can be calculated:
DSP_radix2(dx, SrcCplx, w);DSP_bitrev_cplx((I32 *)SrcCplx, index, dx).
Also refer to the FFT description of the TI Documentation or the Code Composer Help menu.
In order to obtain the 2 dimensional FFT, turn the complex image (real and imaginary part) by 90 degrees and execute the TI FFT functions again.

ATXClient does not display images correctly ATXClient does not display images correctly

The ATXClient does not display images anymore, or the image is shifted. What to do?

Delete the following folder from the Windows Registry:
HKEY_CURRENT_USER -> Software -> atto-Systems -> atxCClient

Then register the ATXClient again with: regsvr32.exe atxcontrol.ocx

Changing the size of the ROI on the VCSBC4012 Smart Camera Changing the size of the ROI on the VCSBC4012 Smart Camera

How can I change the size of the ROI of the CMOS sensor of the VCSBC4012 Smart Camera?

Please use the function set_image_format() in the attached file mf.c.
The first two arguments are the origin of the picture, the two other arguments are the desired size (width, height).

Linker error too many sections Linker error too many sections

How can I solve the "too many sections" error?

Please replace your link file (ccr.cmd) with the link file you can download here.