Hi, after my last project was completed(thanks!) Another one comes up.
This is easy for me to implement in assembly, but I have no clue at all on how to do this in C.
Note* my past 10 projects in this class has been in assembly.. And I have never taken a programming class other then java, but C looks fairly similar.
My question is how I can implement a Seiko L1642 LCD screen. I used to be able to do this in ASM easily. Note I am using the built in SPI system in my microcontroller, HCS12(68HC12) 32PIN.
Previously been driving my LCD with a 74HC595N and the SPI subsystem.
I'm not too sure on how to convert the BSETs and BCLRs and BRCLR.
This was all I needed to initialize my LCD screen.
This is easy for me to implement in assembly, but I have no clue at all on how to do this in C.
Note* my past 10 projects in this class has been in assembly.. And I have never taken a programming class other then java, but C looks fairly similar.
My question is how I can implement a Seiko L1642 LCD screen. I used to be able to do this in ASM easily. Note I am using the built in SPI system in my microcontroller, HCS12(68HC12) 32PIN.
Previously been driving my LCD with a 74HC595N and the SPI subsystem.
I'm not too sure on how to convert the BSETs and BCLRs and BRCLR.
This was all I needed to initialize my LCD screen.
Rich (BB code):
; SPI Setup
;
LDAA #$22
STAA SPIB ; SPI clocks a 1/24 of E-Clock
MOVB #$3B, DDRM ; Setup PortM data direction
;
; Setup for Master, enable, and high speed SPI
;
LDAA #$50
STAA SPCR1
LDAA #$00
STAA SPCR2 ; No need for this since SPRC2 = $00 at RESET
;
; Done with SPI Setup
;
;
; Better Setup Control Lines too
;
;
BSET PortM, RCK ; Set RCK to Idle HIGH
BCLR PortM, ENABLE ; ENABLE to Idle LOW
;
;
; Done with Control Lines
Command
spi_a: BRCLR SPSR,$20,spi_a ; Wait for register empty flag (SPIEF)
STAA SPDR ; Output command via SPI to SIPO
CKFLG1 BRCLR SPSR,$80, CKFLG1 ; Wait for SPI Flag
LDAA SPDR
NOP ; Wait
BCLR PortM, RCK ; Pulse RCK
NOP
NOP
BSET PortM, RCK ; Command now available for LCD
BCLR PortM, RS ; RS = 0 for commands
NOP
NOP ; Probably do not need to wait
NOP ; but we will, just in case ...
BSET PortM, ENABLE ; Fire ENABLE
NOP ; Maybe we will wait here too ...
NOP
BCLR PortM, ENABLE ; ENABLE off
JSR delay
RTS
Print
spi_b: BRCLR SPSR,$20,spi_b
STAA SPDR ; Output data via SPI to SIPO
CKFLG2 BRCLR SPSR, $80, CKFLG2 ; Wait for SPI Flag
LDAA SPDR
NOP ; Wait
BCLR PortM, RCK ; Pulse RCK
NOP
NOP
BSET PortM, RCK ; Data now available for LCD
BSET PortM, RS ; RS = 1 for data
NOP
NOP
BSET PortM, ENABLE
NOP
NOP
BCLR PortM, ENABLE
JSR delay
RTS