1204 User Guide: Difference between revisions

From Phidgets Support
No edit summary
Line 1: Line 1:
[[Category:UserGuide]]
[[Category:UserGuide]]
{{UserguideTOC|1204.jpg|1204}}
==Getting Started==


===Checking the Contents===
===Required Hardware===
{{UGbox|
 
'''You should have received:'''
* A 1204 TextLCD Adapter
* A PhidgetTextLCD Adapter
* A USB Cable
* A mini-USB cable
* A computer
* Mounting hardware kit
* A compatible LCD screen and cable
|
'''In order to test your new Phidget you will also need:'''
* An LCD
* An LCD cable
||}}


===Connecting the Pieces===
===Connecting the Pieces===
{{UGbox|
[[Image:1204_0_Connecting_the_Hardware.jpg|300px|right|link=]]
#Connect your LCD to the Adapter using your LCD cable. The connector can be difficult to push in on both ends- If it isn't going in, try pushing a little bit harder.
# Connect the LCD screen to the adapter using the LCD cable.
#Connect the PhidgetTextLCD Adapter to your computer using the Mini-USB cable.
# Connect the TextLCD adapter to the computer using a USB cable.
|
[[image:1204 0 Connecting the Hardware.jpg|400px|link=]]
||}}


===Testing Using Windows 2000 / XP / Vista / 7===
<br clear="all">


{{UGwin}}
==Testing Using Windows==


===Running Phidgets Sample Program===
{{UGcontrolpanel|1204}}


{{UGwin2|'''TextLCD-full'''}}
{{ugTextLCD}}


{{UGbox6|
{{UGotheros}}
Double Click on the [[File:Ph.jpg|link=]] icon to activate the Phidget Control Panel and make sure that the '''PhidgetTextLCD Adapter''' is properly attached  to your PC. 
|[[File:1204_0_Control_Panel_Screen.jpg|400px|link=]]
|
'''LCD Display Tab'''
#Double Click on '''PhidgetTextLCD Adapter''' in the Phidget Control Panel to bring up TextLCD-full and check that the box labelled Attached contains the word True.
#Choose the screen.
#Select the screen size.
#Click on Initialize to set-up and clear the display.
#Click on the Backlight box. The screen will light up.
#Click on the Cursor box. A “dash” cursor will appear on the screen.
#Click on the Cursor Blink box. A square blinking cursor will appear on the screen.
#You can increase or decrease the LCD contrast by moving the pointer in the Contrast slider box.
#You can increase or decrease the LED Brightness by moving the pointer in the Brightness slider box.
#You can type your message to be displayed on the LCD screen.
#To make your own characters, click on the Custom Characters Tab.
|
[[File:1204 0 TextLCD Screen.jpg|link=|300px]]
|'''Custom Characters Tab'''
#Draw your custom character.
#Select the memory location (you can store up to 8 characters in location 0 to 7).
#Select the screen.
#Store the custom character in the memory location.
#The stored values are shown in the boxes.  The algorithm is described in the Technical Section of the manual. You can see your custom character by typing \0 (in the case of Memory Location 0) in one of the text boxes on the “LCD Display” tab.
|
[[image:1204 0 TextLCD Custom Characters Screen.jpg|link=|300px]]
}}
 
===Testing Using Mac OS X===
 
{{UGmac| | }}
 
===Using Linux===
 
{{UGlinux}}
 
===Using Windows Mobile / CE 5.0 / CE 6.0===
 
{{UGce}}


==Technical Details==
==Technical Details==
Line 139: Line 91:
<br clear="all>
<br clear="all>


==API==
{{UGnext|}}
{{UGapih}}
 
===Enums===
enum {
:PHIDGET_TEXTLCD_SCREEN_NONE,
:PHIDGET_TEXTLCD_SCREEN_1x8,
:PHIDGET_TEXTLCD_SCREEN_2x8,
:PHIDGET_TEXTLCD_SCREEN_1x16,
:PHIDGET_TEXTLCD_SCREEN_2x16,
:PHIDGET_TEXTLCD_SCREEN_4x16,
:PHIDGET_TEXTLCD_SCREEN_2x20,
:PHIDGET_TEXTLCD_SCREEN_4x20,
:PHIDGET_TEXTLCD_SCREEN_2x24,
:PHIDGET_TEXTLCD_SCREEN_1x40,
:PHIDGET_TEXTLCD_SCREEN_2x40,
:PHIDGET_TEXTLCD_SCREEN_4x40,
}  ScreenSizes
This is a list of the supported screen sizes. The 4x40 screen is a special case because it requires both of the enable lines - so when it is attached, it must be setup on screen 0, and screen 1 cannot be used.
===Properties===
{{UGapi|int Screen [get,set]|Gets / sets the active screen. All other API calls depend on this being called first to select the screen that subsequent calls affect. When making calls from multiple threads, selecting the screen should be synchronized with setting screen properties in order to avoid having messages go to the wrong display.}}
{{UGapi|int RowCount [get]|Returns the number of rows of text supported by the active TextLCD display. This will depend on the set screen size, and defaults to 0.}}
{{UGapi|int ColumnCount [get]|Returns the number of columns of text per row supported by the active TextLCD display. This will depend on the set screen size, and defaults to 0.}}
{{UGapi|int ScreenCount [get] : Constant <nowiki>=</nowiki> 2|Returns the number of screens supported by the TextLCD.}}
{{UGapi|ScreenSizes ScreenSize [get,set]|Gets / sets the screen size for the active TextLCD display. The TextLCD Adapter supports a pre-defined set ofscreen sizes to choose from. By default, both screens are set to PHIDGET_TEXTLCD_SCREEN_NONE, and this function must always be called before trying to write text to a display.}}
{{UGapi|bool Backlight [get,set]|Gets / sets the state of the active TextLCD display backlight. The backlight is disabled by default when the TextLCD is first plugged in.}}
{{UGapi|int Brightness [get,set]|Gets / sets the brightness of the active TextLCD backlight. The default brightness is 255 (100%). The valid brightness range is 0-255 (0%-100%).}}
{{UGapi|int Contrast [get,set]|Gets / sets the contrast of the active TextLCD display. The required contrast will vary greatly between different LCDs, so this will have to be set specifically for whatever LCDs are selected.}}
{{UGapi|bool CursorOn [get,set]|Gets / sets the state of the cursor on the active TextLCD display. When enabled, a cursor (displayed as an underline) will be displayed on the last row written to, at the end of the written text. By default, this is disabled.}}
{{UGapi|bool CursorBlink [get,set]|Gets / sets the state of the cursor blink on the active TextLCD display. When enabled, a flashing box appears on the last row written to, at the end of the written text. By default, this is disabled.}}
{{UGapi|string DisplayString(int rowIndex) [set]|Displays text on the selected row of the active TextLCD display. If the string is shorter then the ColumnCount, it is padded out with spaces - thus completely clearing any previously displayed text.}}
{{UGapi|char DisplayCharacter(int rowIndex, int columIndex) [set]|Displays a singled character on the specified row at the specified column index of the active TextLCD display. This will not affect any of the other characters already being displayed.}}
 
===Functions===
{{UGapi|void setCustomCharacter(int index, int value1, int value2)|Sets up a custom character at the selected index on the active TextLCD display. Valid index range is 0-7 for .Net and Python and 8-15 for all other languages; this allows for 8 custom characters. These custom characters can be displayed by passing their character code (0-7) or (8-15) as part of a DisplayString. For determining the value1 and value2, see the technical section.}}
{{UGapi|void initialize()|Initializes the active TextLCD display. This runs an initialization routine which sets up and clears the display. This can be used for activating a display that was plugged in after the TextLCD Adapter was attached, to clear the display after setting / changing the screen size, and to re-initialize a display if it has become corrupted (display won’t work anymore).}}


==Product History==
==Product History==

Revision as of 20:08, 29 August 2016


Required Hardware

  • A 1204 TextLCD Adapter
  • A USB Cable
  • A computer
  • A compatible LCD screen and cable

Connecting the Pieces

1204 0 Connecting the Hardware.jpg
  1. Connect the LCD screen to the adapter using the LCD cable.
  2. Connect the TextLCD adapter to the computer using a USB cable.


Testing Using Windows

Phidget Control Panel

In order to demonstrate the functionality of the 1204, the Phidget Control Panel running on a Windows machine will be used.


The Phidget Control Panel is available for use on both macOS and Windows machines.

Windows

To open the Phidget Control Panel on Windows, find the Ph.jpg icon in the taskbar. If it is not there, open up the start menu and search for Phidget Control Panel

Windows PhidgetTaskbar.PNG

macOS

To open the Phidget Control Panel on macOS, open Finder and navigate to the Phidget Control Panel in the Applications list. Double click on the Ph.jpg icon to bring up the Phidget Control Panel.


For more information, take a look at the getting started guide for your operating system:


Linux users can follow the getting started with Linux guide and continue reading here for more information about the 1204.

First Look

After plugging the 1204 into your computer and opening the Phidget Control Panel, you will see something like this:

1204 Panel.jpg


The Phidget Control Panel will list all connected Phidgets and associated objects, as well as the following information:

  • Serial number: allows you to differentiate between similar Phidgets.
  • Channel: allows you to differentiate between similar objects on a Phidget.
  • Version number: corresponds to the firmware version your Phidget is running. If your Phidget is listed in red, your firmware is out of date. Update the firmware by double-clicking the entry.


The Phidget Control Panel can also be used to test your device. Double-clicking on an object will open an example.

Text LCD

Double-click on the LCD object, labelled {{{2}}}, in order to run the example: [[Image:{{{1}}}_TextLCD_Example.jpg|center|link=]]


General information about the selected object will be displayed at the top of the window. You can also experiment with the following functionality:

  • Write in the Display text text boxes, your input will be mirrored on the LCD screen.
  • Drag the Contrast and Brightness sliders to a level where you can clearly see the text on the screen.
  • Toggle the Cursor and Cursor Blink checkbox to view the current cursor position on the LCD screen.
  • Toggle Custom Characters to show an example of the {{{1}}} using bitmaps.
  • Use the Clear button to clear the screen.


Testing Using Mac OS X

  1. Go to the Quick Downloads section on the Mac OS X page.
  2. Download and run the Phidget OS X Installer
  3. Click on System Preferences >> Phidgets (under Other) to activate the Preference Pane
  4. Make sure your device is properly attached
  5. Double click on your device's objects in the listing to open them. The Preference Pane and examples will function very similarly to the ones described above in the Windows section.

Testing Using Linux

For a general step-by-step guide on getting Phidgets running on Linux, see the Linux page.

Using a Remote OS

We recommend testing your Phidget on a desktop OS before moving on to remote OS. Once you've tested your Phidget, you can go to the PhidgetSBC, or iOS pages to learn how to proceed.

Technical Details

Introduction

Liquid Crystal Displays are display devices used to convey information through arrangements of pixels. Graphic and Text LCDs are the most common types available for electronic products. The 1204 supports the following screen sizes (lines x characters): 1x8, 2x8, 1x16, 2x16, 4x16, 2x20, 4x20, 2x24, 1x40, 2x40, 4x40. Please note that your program has no way of automatically detecting the size of the attached screen, so you need to set the screen size with call from the API in order to have text strings display properly.

Connector

Below is a pinout diagram for the connector on the 1204, with descriptions of each pin. Remember to use the end of the cable with the larger connector with the 1204 if you want the wire colors to be consistent with the diagram.

1204-pinout.jpg

  • A: LED Anode (+)
  • K: LED Cathode (-)
  • VSS: Board Ground
  • VDD: Supply Voltage (5V)
  • VO: LCD Operating Voltage
  • RS: Register Selector
  • R/W: Read/Write Signal
  • DB0-DB7: Data Bus Lines

Text LCDs

Lcd display.png


Text LCDs display full text strings set in software. Since text characters are defined from the ASCII standard library, other ASCII standard set characters and glyphs can also be sent to the text LCD. This can be done easily by using unicode characters within your text string. In C#, this may look something like this:

tLCD.rows[0].DisplayString = "Apple starts with \u0041";

In this example, the string \u indicates that a unicode character follows, and the unicode character 0041 (which references the hexadecimal character code 0x41) represents the capital letter A. After the LCD converts the unicode character, the above example would cause the LCD screen to read Apple starts with A. A chart of all ASCII standard set character codes is available here.

Custom Characters

Lcdpixelarrangment.png

Custom characters can also be generated for the PhidgetTextLCD. A custom character can be any arrangement of pixels within the space allotted for a single character. Single characters are made up of pixels arranged in a grid 5 pixels wide by 8 pixels high. Once generated, custom characters can be stored in any one of eight volatile memory locations on the PhidgetTextLCD, and can be recalled with a simple API command from software. When custom characters are designed, a formula is used to change the pixel design into a pair of numerical values. The first value relates to the design of the top 4 rows of the character, and the second value relates to the design of the bottom 4 rows of the character. Unlike the unicode characters used in the Special Characters section above, the calculated number is not in hexadecimal format but is an integer value up to six characters in length. The calculation for custom characters can be done by hand, or can be completed for you by using the form available at www.phidgets.com/documentation/customchar.html. Done by hand, each integer value represents the sum of two to the power of each individual on-pixel’s location within that integer-value’s half of the character. Pixels not turned on are valued at zero. For example, a custom character happy-face with pixels 6, 8, 11 and 13 in the upper half turned on, pixels 1, 3, 6, 8, 11, 12 and 13 in the lower half turned on, and all other pixels turned off, would result in the following integer values.

Lcdcustomcharmap.png

These two values are then stored in one of eight memory locations (CG-RAM 0 to 7) on the PhidgetTextLCD by using the Set Custom Character method in software. In C#, this may look something like this:

tLCD.customCharacters[0].setCustomCharacter(10560, 14666)

Once stored, characters can be recalled into a text string by either using the unicode value for the location as referenced in the ASCII Chart or by using the String Code method from the API. Examples in C# of both methods are shown below:

tLCD.rows[0].DisplayString = "I am happy \u0008";

tLCD.rows[0].DisplayString = "I am happy " + tLCD.customCharacters[0].StringCode;


What to do Next

  • Programming Languages - Find your preferred programming language here and learn how to write your own code with Phidgets!
  • Phidget Programming Basics - Once you have set up Phidgets to work with your programming environment, we recommend you read our page on to learn the fundamentals of programming with Phidgets.


Product History

Template:UGhist Template:UGrow Template:UGrow