LCDInfo.com

http://www.lcdinfo.com
It is currently Thu Nov 21, 2024 23:47

All times are UTC + 2 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Jul 04, 2008 12:45 
Offline

Joined: Fri Jul 04, 2008 11:58
Posts: 2
Location: India
hi,

I am trying to control S1D13305 (SED1335-Epson Controller) based Graphic LCD with using AVR ATmega32 microcontroller.

I have written the demo code in assembly language for it in AVRStudio4. The problem is i am not getting any output on LCD. I have read the datasheet of SED1335 many times but i can not understand in details how to initialize LCD, about delay of LCD, contrast port values etc.

Please help me with this.

Regards,
Sachin Rathod,
India.


My code looks like this:

.include "m32def.inc"

.equ RD = 0
.equ WR = 1
.equ A0 = 2
.equ CS = 3
.equ RST = 4
.equ FS1 = 5

.equ DataPort = PORTC
.equ CtrlPort = PORTD
.equ DataDDR = DDRC
.equ CtrlDDR = DDRD

.equ SystemSet = 0x40
.equ SleepIn = 0x53
.equ DispOff = 0x58
.equ DispOn = 0x59
.equ Scroll = 0x44
.equ CurForm = 0x5D
.equ CGRAMAddr = 0x5C
.equ CurRight = 0x4C
.equ CurLeft = 0x4D
.equ CurUp = 0x4E
.equ CurDown = 0x4F
.equ HdotScr = 0x5A
.equ Overlay = 0x5B
.equ SetCurAddr = 0x46
.equ ReadCurAddr = 0x47
.equ MemWrite = 0x42
.equ MemRead = 0x43

.def Temp = r16
.def Dly1 = r17
.def Dly2 = r18
.def LcdCommand = r19
.def LcdData = r20


Reset:
LDI Temp, 0x5F
OUT SPL, Temp
LDI Temp, 0x08
OUT SPH, Temp

RCALL IOInit
RCALL Dly50ms
RCALL Dly50ms
RCALL LcdInit
RCALL Dly50ms
RCALL Dly50ms
RCALL ZPtrInit
RCALL InstructionSet
LDI LcdCommand, SetCurAddr
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdCommand, CurRight
RCALL SendLcdCommand
LDI LcdCommand, MemWrite
RCALL SendLcdCommand
RCALL DisplayData

Forever:
RJMP Forever

IOInit:
LDI Temp, 0xFF
OUT DataDDR, Temp
LDI Temp, 0x3F
OUT CtrlDDR, Temp
RET

LcdInit:
SBI CtrlPort, RD
SBI CtrlPort, WR
CBI CtrlPort, CS
CBI CtrlPort, FS1
CBI CtrlPort, RST
RCALL Dly200us
RCALL Dly200us
SBI CtrlPort, RST
RET

SendLcdCommand:
SBI CtrlPort, A0
OUT DataPort, LcdCommand
CBI CtrlPort, WR
NOP
NOP
NOP
SBI CtrlPort, WR
RET

SendLcdData:
CBI CtrlPort, A0
OUT DataPort, LcdData
CBI CtrlPort, WR
NOP
NOP
NOP
SBI CtrlPort, WR
RET

Dly1ms:
PUSH Temp
PUSH Dly1
PUSH Dly2
LDI Temp, 0x08
Dly1msL1:
LDI Dly1, 0xA6
LDI Dly2, 0xA6
Dly1msL2:
DEC Dly1
BRNE Dly1msL2
Dly1msL3:
DEC Dly2
BRNE Dly1msL3
DEC Temp
BRNE Dly1msL1
POP Dly2
POP Dly1
POP Temp
RET

Dly200us:
PUSH Temp
PUSH Dly1
PUSH Dly2
LDI Temp, 0x02
Dly200usL1:
LDI Dly1, 0x83
LDI Dly2, 0x83
Dly200usL2:
DEC Dly1
BRNE Dly200usL2
Dly200usL3:
DEC Dly2
BRNE Dly200usL3
DEC Temp
BRNE Dly200usL1
POP Dly2
POP Dly1
POP Temp
RET

Dly50ms:
LDI Temp, 50
Dly50msL1:
RCALL Dly1ms
DEC Temp
BRNE Dly50msL1
RET

ClearText:
LDI LcdCommand, SetCurAddr
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdCommand, CurRight
RCALL SendLcdCommand
LDI LcdCommand, MemWrite
RCALL SendLcdCommand
RCALL SendSpace
RET

ClearGraphics:
LDI LcdCommand, SetCurAddr
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x10
RCALL SendLcdData
LDI LcdCommand, CurRight
RCALL SendLcdCommand
LDI LcdCommand, MemWrite
RCALL SendLcdCommand
RCALL SendBlank
RET

WrSpace:
LDI LcdData, 0x20
RCALL SendLcdData
RET

WrBlank:
LDI LcdData, 0x00
RCALL SendLcdData
RET

SendSpace:
LDI Dly1, 30
SendSpaceL1:
LDI Dly2, 40
SendSpaceL2:
RCALL WrSpace
DEC Dly2
BRNE SendSpaceL2
DEC Dly1
BRNE SendSpaceL1
RET

SendBlank:
LDI Dly1, 240
SendBlankL1:
LDI Dly2, 40
SendBlankL2:
RCALL WrBlank
DEC Dly2
BRNE SendBlankL2
DEC Dly1
BRNE SendBlankL1
RET

InstructionSet:
LDI LcdCommand, SystemSet
RCALL SendLcdCommand
LDI LcdData, 0x32
RCALL SendLcdData
LDI LcdData, 0x87
RCALL SendLcdData
LDI LcdData, 0x07
RCALL SendLcdData
LDI LcdData, 0x27
RCALL SendLcdData
LDI LcdData, 0x2B
RCALL SendLcdData
LDI LcdData, 0xEF
RCALL SendLcdData
LDI LcdData, 0x28
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdCommand, Scroll
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0xEF
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x10
RCALL SendLcdData
LDI LcdData, 0xEF
RCALL SendLcdData
LDI LcdCommand, Overlay
RCALL SendLcdCommand
LDI LcdData, 0x01
RCALL SendLcdData
LDI LcdCommand, DispOff
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
RCALL ClearText
RCALL ClearGraphics
LDI LcdCommand, DispOn
RCALL SendLcdCommand
LDI LcdData, 0x14
RCALL SendLcdData
LDI LcdCommand, SetCurAddr
RCALL SendLcdCommand
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdData, 0x00
RCALL SendLcdData
LDI LcdCommand, CurForm
RCALL SendLcdCommand
LDI LcdData, 0x04
RCALL SendLcdData
LDI LcdData, 0x86
RCALL SendLcdData
RET

ZPtrInit:
LDI ZL, Low (Message<<1)
LDI ZH, High(Message<<1)
RET

LoadProgMem:
LPM LcdData, Z+
RCALL SendLcdData
RET

DisplayData:
LDI Temp, 40
DisplayDataL1:
RCALL LoadProgMem
DEC Temp
BRNE DisplayDataL1
RET

Message:
.DB [".. LCM-3202401 GRAPHIC LCD .."]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group