4D Systems Display Tutorial
Posted: Sat Aug 16, 2014 11:02 am
4D Systems Intelligent (Visi) Display Tutorial
1.0 Introduction:
4D Systems produce a range of “Intelligent” Touch Screen Displays.
This tutorial will focus on the uLCD-32PTU model which uses the Picasso Processor.
4D Systems produce a range of documentation and application notes for the hardware, and the Workshop Programming Software.
While these documents are very comprehensive and useful they do not cover using the display with Flowcode, so I will attempt to go over using some of the more common aspects of the display with Flowcode 6.
More help is also available in the Flowcode help pages.
Note- The display component macros are available with the professional version of Flowcode.
2.0 Overview:
The workshop software allows various gauges, switches buttons etc to be programmed on to the display. These can interact with the microcontroller in the same way physical switches can.
Examples of a range of these will be looked at and Flowcode programs along with the 4D Workshop source code given.
The software will all be provided as one zip file.
Several of these can be added to one display and can be configured to interact with each other.
The images are held on a uSD memory card plugged into the display.
The card is programmed with the image at the same time as the display is programmed, but must connected to the PC card reader.
2.1 Required Hardware:
Matrix Hardware.
The following matrix hardware is required to run all the example flowcharts in this tutorial.
EB006 Programmer
12 V Power Supply
EB004 LED Board
EB005 LCD Display Board
16F877A Microcontroller
EB-002 Screw Terminal Adaptor (Or Generic 9Pin D-Adaptor)
Dual Potential Divider Board (For ADC Inputs)
Various Cables
4D Systems Hardware.
uLCD=32PTU Display
2GB uSD Memory Card (A Card reader is also needed to program it.)
4D Programming Cable or uUSB-PA5 Programming Adaptor.
Optional
4DEVBoard
Connections:
The display has a 2x5 DIL Header. With this to the bottom of the display, the RHS is used for both programming with the uUSB-PA5 cable, once programmed the display is connected to the microcontroller using the TX & RX pins
Display RES - Reset Line – Not Used
Display GND – 0V
Display RX – Port C6
Display TX – Port C7
Display 5V – 5V supply
If connected to the Development Board
Power is connected to the pins just above the protoblocks.
Rx & TX are taken from the 30 pin DIL Header
RX0 = Pin 26 – Port C6
TX0 = Pin 28 – Port C&
3.0 Programming Using The 4D Workshop Environment:
DO NOT Connect the display to the PC at this time.
Start 4D Workshop
Select the relevant display (LCD-32PTU in this case)
Choose portrait or landscape format.
Select Visi Genie - This now opens the main screen.
Select the Gauges Tab
Left click the first icon
Move the cursor over the image of the screen
Left Click again. – This will place the gauge on the screen.
This can then be moved and resized.
Left click on the gauge
Select Events Tab
Select Report Message on the On Activate Setting
Ensure the display is not connected to the microcontroller or another power source.
Connect the programming cable firstly to the display and once confirmed it is correctly connected, then plug it into the USB Port.
Note Incorrect connection may damage both gauge and the computer USB Port.
Insert a uSD card into the PC card reader
Select Comms from the Menu bar on the 4D Software main window.
It may be necessary to select a COMM Port. Once connected the Icon will turn blue.
Click the Home Tab
Click the Build Copy/Load Icon
This will start the programming
Give the file a name and click ok
Select the drive containing the uSD card and click ok.
This will complete the programming. Display should now show “Drive Not Mounted”
Move the uSD card to the Display card slot.
The display will now show the gauge programmed above.
Disconnect the USB lead from the display.
Any errors should be referred to the 4D documentation
4.0 Example Programs:
A selection of the different type of component will be detailed below and a description of the Flowcode program.
Refer to the comments in the Flowcode programs for more details.
Most of the components are read as 2 separate 8 bit values MSB & LSB.
These then need to be combined back to a single value. Some components will need this as a INT or UINT.
Refer to the display documentation for this.
The values can be combined using 1 of the following methods
Data = (MSB << 8 ) | LSB
Data = LSB + (MSB<<8)
Data = LSB + (MSB *256)
The basic flow of using the display is
1) Initialise the display – 2 second delay will be needed.
2) Wait for the display to signal ready
3) Read Object ID
4) Read MSB
5) Read LSB
6) Combine MSB & LSB
Most of the example flowcharts are very similar apart from using different components.
When testing for the component type its is advisable to use its name rather that the ID number as the documentation mentions that the ID number is subject to change in later versions of the software.
The rotary switch for example has the ID Number 3, but it is preferable to refer to it by its name
Visi4D1 :: VISI_ID_Rotaryswitch
Components can be selected by a dropdown box in the Flowcode Macro.
4.1 Rotary Knob:
A simple rotary knob.
Outputs a value shown in binary on in the LED E-block.
Also shows on the 7 segment LED on the display
The max and min values can be customised.
Photo1 Rotary Knob.
4.2 Rotary Switch:
This example is a 7 position switch (0 to 6). Number of positions is customisable.
Each position sets the value in binary on the LED E-Block (Port B) and shows the numeric value on the LCD (Port A).
It is also shown on the display as a simulated 7 segment display.
Photo 2 Rotary Switch.
4.3 Slider / Trackbar:
This is a simple touch sensitive slider.
Moving from bottom to top it outputs a value of 0 to 255. This is shown on the LED E-Block (Port B) as a binary value.
It is also shown on the display as a simulated 7 segment display
The slider sends the data to the microcontroller as “On Changed” and the 7 segment display as “On Changing”.
i.e. While the trackbar is moving the 7Segment display moves in sympathy and once the touch is released the position is then sent to the microcontroller.
The max and min values can be customised.
The On Change and On Changing events are fully documented in the user guide.
Photo 3 Slider.
4.4 Simple Gauge:
A range of analogue gauges are provided. These can all have their Min and Max values configured, along with the colours and fonts of the displays.
This is a simple circular analogue “Speedometer” type gauge. It also has a simple digital readout of the setting in the bottom of the gauge.
Gauges are simpler to use than switches etc as they only need the input data.
Object ID = Visi4D1::VISI_ID_Meter
Object Index = 0
Value = count ( The data from the ADC)
Photo 4 Simple Gauge.
4.5 Dual Analogue Meters:
This example uses 2 Analogue meters to read the outputs of 2 analogue sensors.
Each display must have a separate ObjectIndex, in this case they use 0 and 1.
Again these meters can be customised to suit.
Photo 5 Dual Analogue Meters.
4.6 Dual Digital Meters:
This is the same program as the dual analogue except it uses the 7 segment LEDs
This also uses Static Text Labels.
Photo 6 Dual Digital Meters.
4.7 Dual Button Latch:
This uses the left button to turn on the LED on Port B BIT 1 and the right button to turn it off.
Photo 7 Dual Button Latching
4.8 Dual Button Momentary:
This uses 2 buttons. One turns on BIT 0 and the other BIT 1. The LEDs stay on for a pre-set time before going off again.
Because this uses 2 buttons they have to be read as separate inputs.
This is done by using Index2 on the ReadByte From Message Macro.
The return variable is either 0 or 1 (would be 0 1 or 2 if 3 buttons were used for example)
A normal decision box is then used.
Photo 8 Dual Button Momentary
The example Flowcharts and 4D Source files are attached below.
Also I have included a screen shot of the 4D Display for each example.
1.0 Introduction:
4D Systems produce a range of “Intelligent” Touch Screen Displays.
This tutorial will focus on the uLCD-32PTU model which uses the Picasso Processor.
4D Systems produce a range of documentation and application notes for the hardware, and the Workshop Programming Software.
While these documents are very comprehensive and useful they do not cover using the display with Flowcode, so I will attempt to go over using some of the more common aspects of the display with Flowcode 6.
More help is also available in the Flowcode help pages.
Note- The display component macros are available with the professional version of Flowcode.
2.0 Overview:
The workshop software allows various gauges, switches buttons etc to be programmed on to the display. These can interact with the microcontroller in the same way physical switches can.
Examples of a range of these will be looked at and Flowcode programs along with the 4D Workshop source code given.
The software will all be provided as one zip file.
Several of these can be added to one display and can be configured to interact with each other.
The images are held on a uSD memory card plugged into the display.
The card is programmed with the image at the same time as the display is programmed, but must connected to the PC card reader.
2.1 Required Hardware:
Matrix Hardware.
The following matrix hardware is required to run all the example flowcharts in this tutorial.
EB006 Programmer
12 V Power Supply
EB004 LED Board
EB005 LCD Display Board
16F877A Microcontroller
EB-002 Screw Terminal Adaptor (Or Generic 9Pin D-Adaptor)
Dual Potential Divider Board (For ADC Inputs)
Various Cables
4D Systems Hardware.
uLCD=32PTU Display
2GB uSD Memory Card (A Card reader is also needed to program it.)
4D Programming Cable or uUSB-PA5 Programming Adaptor.
Optional
4DEVBoard
Connections:
The display has a 2x5 DIL Header. With this to the bottom of the display, the RHS is used for both programming with the uUSB-PA5 cable, once programmed the display is connected to the microcontroller using the TX & RX pins
Display RES - Reset Line – Not Used
Display GND – 0V
Display RX – Port C6
Display TX – Port C7
Display 5V – 5V supply
If connected to the Development Board
Power is connected to the pins just above the protoblocks.
Rx & TX are taken from the 30 pin DIL Header
RX0 = Pin 26 – Port C6
TX0 = Pin 28 – Port C&
3.0 Programming Using The 4D Workshop Environment:
DO NOT Connect the display to the PC at this time.
Start 4D Workshop
Select the relevant display (LCD-32PTU in this case)
Choose portrait or landscape format.
Select Visi Genie - This now opens the main screen.
Select the Gauges Tab
Left click the first icon
Move the cursor over the image of the screen
Left Click again. – This will place the gauge on the screen.
This can then be moved and resized.
Left click on the gauge
Select Events Tab
Select Report Message on the On Activate Setting
Ensure the display is not connected to the microcontroller or another power source.
Connect the programming cable firstly to the display and once confirmed it is correctly connected, then plug it into the USB Port.
Note Incorrect connection may damage both gauge and the computer USB Port.
Insert a uSD card into the PC card reader
Select Comms from the Menu bar on the 4D Software main window.
It may be necessary to select a COMM Port. Once connected the Icon will turn blue.
Click the Home Tab
Click the Build Copy/Load Icon
This will start the programming
Give the file a name and click ok
Select the drive containing the uSD card and click ok.
This will complete the programming. Display should now show “Drive Not Mounted”
Move the uSD card to the Display card slot.
The display will now show the gauge programmed above.
Disconnect the USB lead from the display.
Any errors should be referred to the 4D documentation
4.0 Example Programs:
A selection of the different type of component will be detailed below and a description of the Flowcode program.
Refer to the comments in the Flowcode programs for more details.
Most of the components are read as 2 separate 8 bit values MSB & LSB.
These then need to be combined back to a single value. Some components will need this as a INT or UINT.
Refer to the display documentation for this.
The values can be combined using 1 of the following methods
Data = (MSB << 8 ) | LSB
Data = LSB + (MSB<<8)
Data = LSB + (MSB *256)
The basic flow of using the display is
1) Initialise the display – 2 second delay will be needed.
2) Wait for the display to signal ready
3) Read Object ID
4) Read MSB
5) Read LSB
6) Combine MSB & LSB
Most of the example flowcharts are very similar apart from using different components.
When testing for the component type its is advisable to use its name rather that the ID number as the documentation mentions that the ID number is subject to change in later versions of the software.
The rotary switch for example has the ID Number 3, but it is preferable to refer to it by its name
Visi4D1 :: VISI_ID_Rotaryswitch
Components can be selected by a dropdown box in the Flowcode Macro.
4.1 Rotary Knob:
A simple rotary knob.
Outputs a value shown in binary on in the LED E-block.
Also shows on the 7 segment LED on the display
The max and min values can be customised.
Photo1 Rotary Knob.
4.2 Rotary Switch:
This example is a 7 position switch (0 to 6). Number of positions is customisable.
Each position sets the value in binary on the LED E-Block (Port B) and shows the numeric value on the LCD (Port A).
It is also shown on the display as a simulated 7 segment display.
Photo 2 Rotary Switch.
4.3 Slider / Trackbar:
This is a simple touch sensitive slider.
Moving from bottom to top it outputs a value of 0 to 255. This is shown on the LED E-Block (Port B) as a binary value.
It is also shown on the display as a simulated 7 segment display
The slider sends the data to the microcontroller as “On Changed” and the 7 segment display as “On Changing”.
i.e. While the trackbar is moving the 7Segment display moves in sympathy and once the touch is released the position is then sent to the microcontroller.
The max and min values can be customised.
The On Change and On Changing events are fully documented in the user guide.
Photo 3 Slider.
4.4 Simple Gauge:
A range of analogue gauges are provided. These can all have their Min and Max values configured, along with the colours and fonts of the displays.
This is a simple circular analogue “Speedometer” type gauge. It also has a simple digital readout of the setting in the bottom of the gauge.
Gauges are simpler to use than switches etc as they only need the input data.
Object ID = Visi4D1::VISI_ID_Meter
Object Index = 0
Value = count ( The data from the ADC)
Photo 4 Simple Gauge.
4.5 Dual Analogue Meters:
This example uses 2 Analogue meters to read the outputs of 2 analogue sensors.
Each display must have a separate ObjectIndex, in this case they use 0 and 1.
Again these meters can be customised to suit.
Photo 5 Dual Analogue Meters.
4.6 Dual Digital Meters:
This is the same program as the dual analogue except it uses the 7 segment LEDs
This also uses Static Text Labels.
Photo 6 Dual Digital Meters.
4.7 Dual Button Latch:
This uses the left button to turn on the LED on Port B BIT 1 and the right button to turn it off.
Photo 7 Dual Button Latching
4.8 Dual Button Momentary:
This uses 2 buttons. One turns on BIT 0 and the other BIT 1. The LEDs stay on for a pre-set time before going off again.
Because this uses 2 buttons they have to be read as separate inputs.
This is done by using Index2 on the ReadByte From Message Macro.
The return variable is either 0 or 1 (would be 0 1 or 2 if 3 buttons were used for example)
A normal decision box is then used.
Photo 8 Dual Button Momentary
The example Flowcharts and 4D Source files are attached below.
Also I have included a screen shot of the 4D Display for each example.