Mathieu: Another LCD backpack

From DP

Jump to: navigation , search

Contents

Prototypes

Nokia-lcd-front-test.jpg

Nokia-lcd-front-dp.jpg

Overview

Usb-lcd-backpack-v1.png

Hardware

Cct-usb-lcd-backpack-v1.png

PCB

Partlist

Brd-usb-lcd-backpack-v1.png

Click for a full size placement image.

partlist
Parts Quantity Value Package
C1,C2 2 27pf C0805
C3 1 150pF (270pf @55kHz) C0805K
C4,C5,C6,C8 4 0.1uF C0805
C7 1 0.1uF C0805K
C9 1 0.1uF/50V C0805K
C10 1 1uF C0805
C11 1 10uF/14+v SANYO-OSCON_SMD_A5
C12,C13,C14 3 10uF SMC_A
D1 1 1N5819 SOD123
IC1 1 PIC18F24J50 SSOP28
IC2 1 MC34063AD SO08
J1 1 USBSMD USB-MINIB
JP1 1 1X05
L1 1 100mA+ L0805
L2 1 680uH/0.12A L4532P
LCD1 1 NOKIA6100_LCD NOKIA6100_LCD
Q1 1 16MHz HC49UP
R1 1 10K M0805
R2 1 18K M0805
R3 1 2R4 M0805
R4 1 180R M0805
R5 1 3.9K M0805
R6 1 1K M0805
T1 1 SOT23-BEC
VR1 1 V_REG_LDOSMD SOT23-5

Protocol

i initialize LCD

Reset and initialize the LCD.

v version string

Hardware/software version string.

  • HxxxxFxxxxBxxxx (null terminated)

c contrast

caption
0 123
command VOLCTR byte 1VOLCTR byte 2SETCON byte 1
c (0x63) contrast (EPSON)resistor ratio (EPSON?)contrast (PHILLIPS)
0x630x240x030x30

Requires 3 bytes. Byte one is the contrast, only setting that seems to have effect on current LCD

  • VOLCTR - contrast/brightness for EPSON
    • Byte 1 - VOLCTR 1 contrast setting (0x24 default)
    • Byte 2 - VOLCTR 2 internal resistor ratio (no effect) (0x03 default)
  • SETCON - contrast/brightness for PHILLIPS
    • Byte 3 - SETCON value (no effect) (0x30 default)

b set bounding box

Defines the area of the screen to draw.

caption
0 1234
command x starty startx endy end
b (0x62) 0x000x000x640x64

p/P send page of image data

caption
0 123...n
command pixel byte 1px byte 2px byte 3...px byte n
p (0x) rrrrggggbbbbrrrrggggbbbb...ggggbbbb
  • P Fill the entire display with the pixel data sent
  • p Fill the area defined by the last bounding box

Send command, then enough pixels to fill the screen or bounding box. Replies '1' at the end.

caption
0 12
pixel byte 1 pixel byte 2pixel byte 3
rrrrggggbbbbRRRRGGGGBBBB
  • 12bit color
  • two pixels packed per 3 bytes
  • must use three byte/two pixel segments! end on an even boundary

t/T test pattern

  • T Cycles colors on the entire display
  • t In the area defined by the last bounding box

Any byte exits at the end of the next refresh.

f/F fill with color

  • F Fill the entire display with the pixel data sent
  • f Fill the area defined by the last bounding box
caption
0 12
command color byte 1color byte 2
f (0x62) 0000rrrrggggbbbb

a LCD backlight voltage reading

Returns the raw 10bit ADC reading of the pin connected to the the MC34063A feedback resistors (R1=18K/R2=3.9K).

  • Raw reading: 0x182 (386)
  • Actual voltage: (386/1024)*3.3volts=1.24volts
  • Scale for resistor divider: Vin = (Vout*(R1+R2))/R2 = (1.24volts*(18K+3.9K))/3.9K = 7.01volts (ideal is 7volts)

Example solution.

d dim the LCD backlight

Send a 1 byte duty cycle setting, 0-255 (0-100%).

Software Utility

Description/Purpose

This utility simply sends a bmp image file to the Nokia LCD Backpack using the commands described above.

Version Information

Early development stage,


BMP image sender for Nokia LCD Backpack V.0.3
Wiki Docs: http://dangerousprototypes.com/docs/Mathieu:_Another_LCD_backpack
http://www.dangerousprototypes.com

Usage

Windows

Help Menu
Usage:              
  imageviewer  -p device -f bmpfile -s speed -b bytes -V 
  Example Usage:   imageviewer -d COM1 -s 921600 -f sample.bmp -V
                   imageviewer -d COM1 -s 921600 -v -a 
                   imageviewer -d COM1 -s 921600 -i -d 20
                   imageviewer -d COM1 -s 921600 -i sample.bmp -B 300
          
          Where: -p device is port e.g.  COM1 (windows) or /dev/ttyS0 (*nix) 
                 -s Speed is port Speed  default is 921600 
                 -f Filename of BMP file 
                 -B bytes, No. Of chunks of bytes to send to the  port. MAX 5460
                 -d percent, dim the backlight, Range (0-100)  
                 -a LCD Backligh voltage reading  
                 -v version information  
                 -i Initialized and Reset LCD  
                 -V verbose mode- show something on screen  
                 -T Test pattern (full Screen)  
                 -h help menu
         
         Note that the option -p is mandatory

*NIX

Help Menu
Usage:              
  imageviewer  -p device -f bmpfile -s speed -b bytes -V 
  Example Usage:   imageviewer -d /dev/ttyS0 -s 921600 -f sample.bmp -v
                   imageviewer -d /dev/ttyS0 -s 921600 -v -a 
                   imageviewer -d /dev/ttyS0 -s 921600 -i -d 20
          
          Where: -p device is port e.g.  COM1 (windows) or /dev/ttyS0 (*nix) 
                 -s Speed is port Speed  default is 921600 
                 -f Filename of BMP file 
                 -b bytes, bytes to send - must be multiple of 3's. default is 6 
                 -d percent, dim the backlight, Range (0-100)  
                 -a LCD Backligh voltage reading  
                 -v version information  
                 -i Initialized and Reset LCD  
                 -V verbose mode- show something on screen  
                 -T Test pattern (full Screen)  
                 -h help menu

Screen Shots

E:\>imageviewer -p com5 -f tulips.bmp -B 600
-----------------------------------------------------------------------------
 BMP image sender for Nokia LCD Backpack V.0.3
 http://www.dangerousprototypes.com
-----------------------------------------------------------------------------
 Header size is 40
 Image size is  132px x 132px
 Number of colour planes is 1
 Bits per pixel is 24
 Offset to image data is 54 bytes
 Setting image mode
 Opening Port on com5 at 921600bps, using image file tulips.bmp chunksize = 600 X 3

 Ready to convert 24 bit into 12 bit image data..
 Press any key when ready...
 sending image data..
 Total Bytes Sent: 26136
 Reply received: ☺
 Done! :-)

E:\>

Notes

This utility works on windows only and untested on other OS. This code was compiled using Code::Blocks 10.05 and used the built-in windows headers for bitmaps: BITMAPFILEHEADER and BITMAPINFO.

Program flow:

  1. checks for the validity of the bmp file
  2. display some info and get the image data offset from the header
  3. send 'P' to the LCD backpack, followed by the image data starting from the offset

Works on 24bit bmp only.

Download the Source

The source code compiles on both windows and debian without complain. The debian version still has some bugs (Wrong value in headersize and need to check the BMP structure).

Download the source from the svn here.

Resources