A A A

Electronicfr.com

Home arrow Microcontrollers circuits arrow PICBASIC arrow How to drive a SPI LCD panel (chip KS0074) with a Picbasic 20.08.2008

Main Menu

Home
Robotic
Microcontrollers and Ethernet
Microcontrollers and USB
Embedded computing
Submit a circuit

Search

Google
Web
electronicfr


How to drive a SPI LCD panel (chip KS0074) with a Picbasic

Written by Administrator, on 20-11-2007 11:51
Views 1168    

How to drive a SPI LCD display panel (chip Samsung KS0074) with a Picbasic microcontroler

LCD panel based on Samsung KS0074 chip use unusual SPI connexion. Unfortunately the datasheet is prety not clear to understand...

Take a look at  KS0074 datasheet, 71 pages!.

The communication  protocol is basically:

  •  CS set low
  • initialization sequence starting by 5 bit up  (datagramme page 46) and setting of RS (register selection)
  • send of one data bites splited in two times 4 bits.First 4 low significants bits, 4 bits low, for most significant bits and again 4 bits low ( page 45).
  • waiting a short time
  • send data by 2*4bits since RS do not change, if you want to change RS, send the sequence with  5 bits up
Here is an example of programme for picbasic

CONST DEVICE=3B
const data=0 'port 0 - donnée
const CS=1 'port 1 - Chip select
const clock=2 'port 2 - clock
const byte chaine=("Exemple")
dim taille as byte
dim char as byte
dim number as byte
dim temp as byte
gosub init
char="B"
gosub prt_char
number=254
gosub prt_number
taille=7
gosub prt_chaine
goto fin
init:
delay 20
OUT CS,1
OUT clock,1
OUT data,0
delay 10
OUT CS,0
shiftout clock,data,1,&b11111000
shiftout clock,data,1,&b10000000
shiftout clock,data,1,&b00000000
delay 5
shiftout clock,data,1,&b11110000
shiftout clock,data,1,&b00000000
delay 100
return
'imprime le charactere char
prt_char:
dim dataL as byte
dim dataH as byte
dataH=char AND &HF0
dataH=dataH >> 4
dataL=char AND &H0F
shiftout clock,data,1,&b11111010
shiftout clock,data,0,dataL
shiftout clock,data,0,dataH
return
'imprime la valeur numerique (byte) number 
prt_number:
dim cent as byte
dim diz as byte
dim unit as byte
cent=number/100
diz=number mod 100
diz=diz/10
unit=number mod 10
shiftout clock,data,0,cent,8
shiftout clock,data,0,&b00000011,8
shiftout clock,data,0,diz,8
shiftout clock,data,0,&b00000011,8
shiftout clock,data,0,unit,8
shiftout clock,data,0,&b00000011,8
return
prt_chaine:
dim compt_taille as byte
temp=taille-1
for compt_taille=0 to temp
char=chaine(compt_taille)
gosub prt_char
next compt_taille
fin:

Quote this article in website Print Related articles Save this to del.icio.us

Users' Comments (0) RSS feed comment
Comment language: English (0), French (1)

No comment posted

Add your comment



mXcomment 1.0.5 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
 
 
TOP