Facebook Pixel

AN-00114 ViSi uCAM-II Demo for Picaso and Diablo16

Description This application note shows how to interface a 4D Systems intelligent display to the uCAM-II micro serial camera module. The attached project demonstrates navigation between forms, coding of touch detection routines for widgets, and serial communications.
Supported Processor PICASO, DIABLO16
Supported Environment ViSi
Difficulty Difficult

 

 

File Downloads
Files

Description

This application note shows how to interface a 4D Systems intelligent display to the uCAM-II micro serial camera module. The attached project demonstrates navigation between forms, coding of touch detection routines for widgets, and serial communications. Below is a photo of the final output. Here the camera is focused on a stylus.

 

Before getting started, the following are required:

and other superseded modules which support the ViSi Genie environment

Visit www.4dsystems.com.au/products to see the latest display module products that use the Diablo16 processor.

When downloading an application note, a list of recommended application notes is shown. It is assumed that the user has read or has a working knowledge of the topics presented in these recommended application notes.

 

Application Overview

The uCAM-II (microCAM-II) is a highly integrated serial camera module which can be attached to any host system that requires a video camera or a JPEG compressed still camera for embedded imaging applications. The module uses a CMOS VGA colour sensor along with a JPEG compression chip that provides a low cost and low powered camera system. The module has an on-board serial interface (TTL) that is suitable for a direct connection to any host micro-controller UART or a PC system COM port. The uCAM-II is capable of outputting both RAW format and JPEG format images.

 

The application described in this document makes use of a uLCD-32PTU (Picaso display) to display images (RAW format only) captured by the uCAM-II. The images are transmitted serially from the uCAM-II to the uLCD-32PTU. The application has an interface for the user to be able to configure the image format, resolution, baud rate, and mode. Below is a simple diagram for the application. The display can also be a uLCD-35DT or a uLCD-70DT (Diablo16 display).

 

To learn how to test the uCAM-II using a utility in Workshop, refer to the application note Designer or ViSi uCAM-II Demo for Goldelox Displays.

 

Setup Procedure

For instructions on how to launch Workshop 4, how to open a ViSi project, and how to change the target display, kindly refer to the section “Setup Procedure” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

 

Attached are zip files containing the ViSi demo projects. Choose accordingly.

 

Create a New Project

For instructions on how to create a new ViSi project, please refer to the section “Create a New Project” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

 

Design the Project

Code Overview

The program has two tasks – to handle graphics and to manage communication with the uCAM-II camera module. The task of handling graphics involves the process of displaying objects and defining their behaviour during touch detection. This part is discussed in the section “Writing the Code for a Form”. The task of communicating with the uCAM-II requires the addition of an include file at the start of the code. In this include file all the high level commands for talking to and listening from the uCAM-II are defined. These high level commands or functions are called when the appropriate button or object is touched. The following paragraphs provide further discussions.

 

The Include File

The demo has an include file which contains the subroutines for communicating with the uCAM-II. This include file may be updated anytime. Check the application notes page section for the latest version.

 

To view the contents, put the cursor on the include file name text, then click on the right mouse button. Choose the first option, “Open file at Cursor”.

 

The file opens in another tab.

 

The code has been heavily commented to help the user. It can be easily edited for further improvement.

 

Writing the Code for a Form

The general instructions below can be followed when writing the 4DGL code for a form that handles graphics and touch detection. The objective is to be able to display objects and control their behaviour when touched.

  • Enable touch detection for objects that are meant to respond to touch
  • Disable touch detection for objects that are not meant to respond to touch
  • Set initial frames of objects then show the objects.
  • Start touch detection routine.
  • Define behaviour of objects when pressed.
  • Define behaviour of objects when touch is released.
  • Define behaviour of objects when touch is moving.
  • Create an exit button to get out of the loop.
  • Loop back to start of touch detection routine.
  • Disable touch detection for all objects in the form before returning to main.

 

In Form1 of the project, Winbutton1 will display frame 1 (“down” state) when it is pressed. When a touch release is detected on Winbutton1, frame 0 will be displayed (“up” state). Also, the function sync_with_uCAM() is executed. This routine, which is defined in the include file “uCAM-IIserialCommsx.inc”, will perform synchronization with the uCAM-II. If the touch status is moving and if the touch point is not on Winbutton1, then frame 0 of Winbutton1 will be displayed. As more buttons are added to the form, the user will just have to define the behaviour for each button. The behaviour can also include calling a function or navigating to another form.

 

Flow Charts

Attached is a PDF file that contains four flow charts. These flow charts illustrate the general flow of the program. These are intended as a learning guide only and are meant to be read along with the datasheet of the uCAM-II. Analysis of the details of how the flow charts are implemented in 4DGL is left as an exercise to the user.

 

Run the Program

For instructions on how to save a ViSi project, how to connect the target display to the PC, how to select the program destination, and how to compile and download a program, please refer to the section “Run the Program” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

 

The uLCD-32PTU and uLCD-35DT display modules are commonly used as examples, but the procedure is the same for other displays.

 

Connect the uCAM-II

Connection Diagram

For non-gen4 Display Modules

 

For gen4 Display Modules

 

For gen4 display modules, a break out board (gen4-PA/4D UPA) is needed to communicate with the uCAM module.

 

In PICASO, COM1 (RX and TX) is mapped to GPIO14 and GPIO15 of the gen4-PA board.

 

Power Supply

For non-gen4 Display Modules

A uUSB-PA5 or a 4D USB programming cable can be used to power the display and the uCAM-II module. If using COM0 to talk to the uCAM-II, hook up the uUSB-PA5 to the programming header H2 of the display with the TX and RX pins disconnected.

 

If using COM1 to talk to the uCAM-II, connect the uUSB-PA5 to the programming header H2 of the display in the normal way. In this setup, the display can be programmed while it is connected to the uCAM-II module.

 

For gen4 Display Modules

A breakout board (gen4-PA / 4D UPA) can be used to power the display and the uCAM-II module.

 

In the 4DGL code of the project, the constant uCAM_PORT determines the port to be used for talking to the uCAM-II.

 

When connecting to a Diablo16 display, note that the RX and TX pins for COM1 need to be mapped or assigned.

 

In the code above, the COM1 RX and TX pins are assigned to PA0 and PA1, respectively. Therefore, if the display is using COM1 to talk to the uCAM-II, the RX and TX pins of the uCAM-II need to be connected to PA1 and PA0. If using a uLCD-70DT for instance, the datasheet shows the pin configuration.

 

The uLCD-70DT and the uCAM-II can be powered using any of the two methods described in the previous section “Power Supply”. Note however that the USB ports of a laptop PC may not be able to provide enough current for the uLCD-70DT alone. Use a power hub instead.

 

Photos of the Project

 

 

Share: