How to drive a SPI LCD panel (chip KS0074) with a Picbasic |
How to drive a SPI LCD display panel (chip Samsung KS0074) with a Picbasic microcontrolerLCD 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:
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:
|
No comment posted
mXcomment 1.0.5 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved






