EA DOGM163X-A display SPI interface >> display special characters

Hi, i use the EA DOGM163X-A display with the st7036 controller. With this simple driver I can send strings (WriteString(s)),
it works well. I have played with the special character set to get other chars, but probably I miss some important information!.

With GetSpecialChar I get the character 'cross' out the table with address %00010001(hex11). BUT also some others characters on place 0,3(x,y) and one on place 0,4(x,y). by each new download of the software different ones.


Is there anyone who understands what i'm doing wrong, and has more knowledge of this DOGM163/st7036 controller?

Regards, Rob


*************************************************************
locate(0,0)
PUB GetSpecialChar | i
writeCommand(Ram_WRITE_cmd) '40 hex
repeat i from 0 to 7
writeByte($11) 'special character
*************************************************************

{{ DOGM163_SPI.spin }}
{
*************************************************
EA DOGM163X-A display SPI interface
Revision history:
November 2008
v1.0: initial
Rob van den Berg (bergvdrob@gmail.com)
*************************************************
}

CON
' data command to start reading X and Y value
' ch_X = %00010000 'command RDAX, read X-channel acceleration through SPI
' ch_Y = %00010001 'command RDAY, read Y-channel acceleration through SPI
FSetInTable_0 = %00111000 '0x38 FunctionSet instruction table 0
FSetInTable_1 = %00111001 '0x39 FunctionSet instruction table 1
FSetInTable_2 = %00111010 '0x3A FunctionSet instructiontable 2
DHeightPosSel_1 = %00011000 '0x18 DoubleHeightPositionSelect
DHeightPosSel_2 = %00010000 '0x10 DoubleHeightPositionSelect
FSetInTabNulDh = %00111100 '0x3C
BiasSet = %00010100 '0x14 BiasSet
ContrSet = %01111000 '0x78 ContrastSet
PowContr = %01011110 '0x5E PowerControl
FollowContr = %01101010 '0x6A FollowerControl
EntryModSet = %00000110 '0x06 EntryModeSet
ClearComm = %00000001 '0x01
HomeComm = %00000010 '0x02
Set_DDRAM_cmd = %10000000 '0x80 set DDRAM addres command
Ram_WRITE_cmd = %01000000 '0x40 Write to display
Disp_ON_cmd = %00001100 '0x0C Display on command
Disp_OFF_cmd = %00001000 '0x08 Display off Command

SET_DDRAM_CMD = 0x80; // Set DDRAM address command

VAR
byte csPin 'connects to lcd CSB pin
byte rsPin 'connects to lcd RS pin
byte siPin 'connects to lcd SI pin
byte clkPin 'connects to lcd CLK pin
byte DcbOnOff '0x0C display on, curcor off, blink off
byte LcdMode ' := %00000011 '0x03
long csrX,csrY

PUB Dogm163_spi(rs,cs,si,clk)
rsPin := rs
csPin := cs
siPin := si
clkPin := clk
'setup lines
dira[csPin]~~ 'set to output
outa[csPin]~~ 'sc normally high

dira[rsPin]~~ 'set to output
outa[rsPin]~ 'rs normally low

dira[siPin]~~ 'set to output
outa[siPin]~ 'si normally low

dira[clkPin]~~ 'set to output
outa[clkPin]~ 'clock normally low
init

PUB init
DcbOnOff := %00001100 '0x0C display on, curcor off, blink off
LcdMode := %00000011 '0x03
writeCommand(FSetInTable_1)
writeCommand(BiasSet)
writeCommand(ContrSet)
writeCommand(PowContr)
writeCommand(FollowContr)
writeCommand(FSetInTable_0)
writeCommand(DcbOnOff)
clear 'clear display
writeCommand(EntryModSet)

PUB clear
writeCommand(clearComm)
Home

PUB home
Locate(0,0)

PUB locate (x,y) : ddramAddr
ddramAddr := ((y//lcdMode)<<4) | (x//16) 'javelin is % spin > //?
writeCommand(%1000_0000 | ddramAddr)
csrX := x
csrY := y

PUB threeLineMode
lcdMode := 3
writeCommand(FSetInTable_0) '//FunctionSet instructiontable 0, normal font

PUB twoLineMode1
writeCommand(FSetInTable_2) 'FunctionSet instructiontable 2
writeCommand(DHeightPosSel_1) 'DoubleHeightPositionSelect
lcdMode := 2
writeCommand(FSetInTabNulDh) '//FunctionSet instructiontable 0, doubleheight

PUB twoLineMode2
writeCommand(FSetInTable_2) 'FunctionSet instructiontable 2
writeCommand(DHeightPosSel_2) 'DoubleHeightPositionSelect
lcdMode := 2
writeCommand(FSetInTabNulDh) '//FunctionSet instructiontable 0, doubleheight

PUB displayOn
DcbOnOff |= %00000100
writeCommand(DcbOnOff)

PUB displayOff
DcbOnOff &= %00001011
writeCommand(DcbOnOff)

PUB cursorOn
DcbOnOff |= %00000010
writeCommand(DcbOnOff)

PUB cursorOff
DcbOnOff &= %00001101
writeCommand(DcbOnOff)

PUB blinkOn
DcbOnOff |= %00000001
writeCommand(DcbOnOff)

PUB blinkOff
DcbOnOff &= %00001110
writeCommand(DcbOnOff)

PUB write(data)
repeat 8 ' SPI interface use 8-bit instruction (or command) register
outa[siPin] := data >>7 ' send MSB bit by shifting it into b0
outa[clkPin]~~ ' toggle clk pin High, Chip reads on rising edge.
outa[clkPin]~ ' toggle clk pin Low
data <<= 1 ' move next bit into MSB position

PUB writeCommand( cmd )
outa[csPin]~ ' set Chip Select Low
outa[rsPin]~
write (cmd)
outa[csPin]~~ ' set Chip Select High

PUB writeByte( data )
outa[csPin]~ ' set Chip Select Low
outa[rsPin]~~
write(data)
outa[csPin]~~

PUB writeString(s) | g
outa[csPin]~ ' set Chip Select Low
outa[rsPin]~~

REPEAT WHILE g := BYTE[s++]
writeByte(g)

outa[csPin]~~

'not working good
PUB GetSpecialChar | i
writeCommand(Ram_WRITE_cmd) '40 hex
repeat i from 0 to 7
writeByte($11) 'special character
Sign In or Register to comment.