Skip to content

ViSi-Genie Magic: Analog Read

Introduction

This example shows how to read analog inputs of DIABLO-16 displays like uLCD-35DT, uLCD-43DT and uLCD-70DT using ViSi-Genie Magic. The uLCD-43DT was used for this sample. Three Magic Code objects were used in this sample.

MagicCode0 - The 'InsertPoint' of this Magic Code is set to 'Constant/Global/Data' since it contains the variable to store readings from PA0 and the variable to store converted readings. Also this contains a function 'map' that is used to map the analog readings to voltage equivalent.

MagicCode1 - The 'InsertPoint' of this Magic Code is set to 'PreActivateForm' since it sets pin PA0 of the display to analogue mode.

MagicCode2 - The 'InsertPoint' of this Magic Code is set to 'MainLoop' since this is where is start to read from analog then convert the value to voltage equivalent and then write the value to Led Digits and Angular Meter object.

Note

Workshop4 Pro is needed for this code example.

Prerequisites

This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi-Genie environment. Beginners are advised to read the following aplication notes.

Instructions

Hardware Setup

circuit-diagram


Programming the Display

Compile the attached ViSi-Genie Magic project and upload the program to a uLCD-32PTU (or to your target display). Copy the supporting files to a uSD card mounted to the PC. Properly unmount the uSD card from the PC and mount it to the uLCD-32PTU.

Attachment

Project File