Demand Peripherals     Robotics and Automation Made Easy

TIF: Text Interface

The Text Interface has the most common user interface elements including a keypad interface, a text LCD interface, a rotary encoder with center button, LEDs, and a simple tone generator.



The Text Interface Card has a rotary encoder with center button, a piezo speaker, two user controlled LEDs, a 4x5 keypad interface, and an interface to a text LCD display. More information about the TIF cards is available here cards/tif.html.



keypad : the state of the keypad.
The keypad resource works with dpget and dpcat. No key down is reported as 00. A non-zero value gives the column and row of the closure. The column is the high nibble and is in the range of 1 to 4. The row is the low nibble and is in the range of 1 to 5. Looking at the card with keypad connector at the top, the pins are arranged as:

         _COLUMN_ || ___ROW___
         1 2 3 4  || 1 2 3 4 5

encoder : rotary encoder and center button status.
The count is positive for clockwise rotation and negative for counter-clockwise rotation. The count is incremental and report just the change sine the last report. To get a position from the rotary encoder you will need to sum the counts as they come in. There are 96 counts per full rotation. This resource works with dpget and dpcat.

Note that the encoder is mechanical and turning the knob too quickly might not allow the contacts to close. This will appear as missing counts.

Pressing the center button on the encoder give a button value of 1. A zero indicates that it is open.

tonegen : tone to play on the speaker.
The tone to play is a space separated triple of duration in milliseconds, the frequency as digit, and 1 bit volumn setting. Duration must be positive and is limited to a maximum of 310 milliseconds. Frequency is a digit in the range of 1 to 4 with the following meaning:

        1: 1454 Hz
        2: 726 Hz
        3: 363 Hz
        4: 181 Hz
The piezo responds best at the higher frequencies and the low frequencies will not sound as loud. A typical invocation might appear as:
            dpset tif tone 300 1 1
Tonegen is a write-only resource that works with dpset.

leds : the state of the LEDs.
The state of the LEDs is a hex value between 0 and 7. Bit 0 controls the LCD backlight. Bit 1 controls User LED #1, and Bit 2 controls User LED #2. A set bit turns the LED on.

text : characters to display on text LCD.
Text is a write-only resource that displays printable ASCII characters to on the attached text LCD. Text LCD displays do not scroll automatically. To work around this the driver moves the cursor to the other line every 16 characters. (20 character display? Change WIDTH in the tif driver.) A typical invocation would write out all 16 character of the line at once. For example:, a shell command to print one 16 character line to the LCD might be:

        dpset tif text 'Hello, World!   '

commands : commands sent to the text LCD.
Commands are sent as a string of two digit hex characters. Commands let you initialize the display, set the cursor position, and control whether the cursor is visible or not. Commands are specific to the LCD controller in the display module but common commands include:

        38 : 8 bit interface, 2 line display, 5x7 font
        0f : Display on, cursor on, blink cursor
        01 : Clear display, move cursor to home position
        80 : Move cursor to start of first line
        8x : Move cursor to position x on first line
        c0 : Move cursor to start of second line
        cx : Move cursor to position x on second line
Some displays are much slower than others and you may find that you need to repeat a command in order to give it a little extra time to execute. (You usually do not need a delay when sending text to the display.) As an example, a reasonable LCD initialization command might be:
         dpset tif commands 38 38 38 0c 0c 0c 01 01 01



Reinitialize the text LCD and display "Robot Ready! " using the command line tools. That is, the following are entered in a shell script or at the Bash promot.

    dpset tif commands 38 0f 01
    dpset tif text "Robot Ready!    "

Turn on the LCD backlight, sound a beep, and then start monitoring the keypad.

    dpset tif leds 1
    dpset tif tonegen 200 2 1
    dpcat tif keypad


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Quad Serial Output
Octal Serial Output
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator

Interface Cards
Control Cards
User Interface
Stereo Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
Octal SRF04
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
Octal Input/Output
32 Channel Input
32 Channel Output
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card