12F675 temperature display program

EL-C1600N100013-B
>;title"DS1620-12F675 temperature LCD display
;ShiftData:
;Bit1-AlwaysHigh(Gatefor"E")
;Bit2-RSBit
;Bit3-LCDD4
;Bit4-LCDD5
;Bit5-LCDD6
;Bit6-LCDD7
;
;
;12F6754MHz
;GPIO.0istheLCDDataBit
;GPIO.1istheLCDCLOCkBit
;GPIO.2istheDS1620DataBit
;GPIO.3isMCLR
;GPIO.4istheDS1620ClockBit
;GPIO.5istheDS1620ResetBit
;
;
LISTP=12F675, R=DEC
INCLUDE"p12f675.inc"

#DEFINEDataGPIO,0
#DEFINEClockGPIO,1
#DEFINEDSDQGPIO, 2
;MCLRusesGPIO,3
#DEFINEDSCLKGPIO, 4
#DEFINEDSRSTGPIO,5

Org0

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISIO
MOVlwb'11011100'
MOVwfOPTION_REG
clrfANSEL
bcfSTATUS, RP0

clrfSTATUS
clrfINTCON
clrfGPIO

MOVlw0x07
MOVwfCMCON
callInitLCD
callSndMsg
callInitDS

MAINMOVlw0xc0;line2onLCD
callSendINS

callGetTemp; read temperature
callSendDEC; LCD display

gotoMAIN
;------------------------------------------------- --------------
;DS1620 subroutine
StartCMACRO
bsfDSRST
ENDM

StopCMACRO
bcfDSRST
ENDM

InitDSStartC
MOVlw0x0c
callSndByte
MOVlwb'00001010'
callSndByte
StopC

Nop

StartC
MOVlw0xEE
callSndByte
StopC
Return

GetTempMOVlw0xAA
StartC
callSndByte
Nop
callRdByte
StopC
Return

SndByteMOVwfNOTemp
MOVlw8
MOVwfNOTmp1
DSLoop1
bcfDSCLK
rrfNOTemp,f
btfssSTATUS, C
gotoDSCLR
bsfDSDQ
gotoDSLp1
DSCLRbcfDSDQ
Nop
DSLp1bsfDSCLK
decfszNOTmp1,f
gotoDSLoop1
Return

RdByteclrfNOTemp
MOVlw8
MOVwfNOTmp1
bsfSTATUS, RP0
bsfTRISIO, 2
bcfSTATUS, RP0
DSLoop2
bcfDSCLK
Nop
rrfNOTemp,f
btfssDSDQ
gotoDSCLR2
bsfNOTemp, 7
gotoDSLp2
DSCLR2bcfNOTemp, 7
Nop
DSLp2bsfDSCLK
decfszNOTmp1,f
gotoDSLoop2
bsfSTATUS, RP0
bcfTRISIO, 2
bcfSTATUS, RP0
MOVfwNOTemp
Return

;--------------------------------------------
;LCDSubroutines
Message
addwfPCL,f
Dt"HelloDS1620",0

SndMsgclrfFSR
OutLoop
MOVfFSR,w
incfFSR,f
callMessage
Iorlw0
btfscSTATUS,Z
gotoRtnSnd
callSendCHAR
gotoOutLoop
RtnSndreturn

InitLCD
callDlay5
callDlay5
callDlay5
callDlay5

bcfSTATUS, C
MOVlw0x03
callNybbleOut

callDlay5
EStrobe
callDlay160
EStrobe
callDlay160

bcfSTATUS, C
MOVlw0x02
callNybbleOut
callDlay160

MOVlw0x028
callSendINS

MOVlw0x008
callSendINS

MOVlw0x001
callSendINS
callDlay5

MOVlw0x006
callSendINS

MOVlw0x00F
callSendINS

Return

SendDEC
MOVwfTempBIN
Bcfpt5,0
btfscTempBIN,0
Bsfpt5,0
rrfTempBIN,f
clrfTens
MOVlw0x0A
count10subwfTempBIN,f
btfssSTATUS, C
gotoSDEC1
incfTens,f
Gotocount10
SDEC1addwfTempBIN,w
MOVwfUnits
MOVfwTens
Addlwa'0'
callSendCHAR
MOVfwUnits
Addlwa'0'
callSendCHAR
Btfsspt5,0
gotoDEGC
MOVlwa'.'
callSendCHAR
MOVlwa'5'
callSendCHAR
DEGCMOVlwa''
callSendCHAR
MOVlwa'D'
callSendCHAR
MOVlwa'e'
callSendCHAR
MOVlwa'g'
callSendCHAR
MOVlwa'C'
callSendCHAR
MOVlwa''
callSendCHAR
MOVlwa''
callSendCHAR
Return

SendBIN
MOVwfTempBIN; storage temperature value

MOVlwa'1'
btfssTempBIN,7
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN,6
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN, 5
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN, 4
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN, 3
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN, 2
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN,1
MOVlwa'0'
callSendCHAR

MOVlwa'1'
btfssTempBIN,0
MOVlwa'0'
callSendCHAR

Return


SendCHAR
MOVwfTemp

swapfTemp,w
bsfSTATUS, C
callNybbleOut

MOVfTemp,w
bsfSTATUS, C
callNybbleOut
Return

SendINS
MOVwfTemp

swapfTemp,w
bcfSTATUS, C
callNybbleOut

MOVfTemp,w
bcfSTATUS, C
callNybbleOut

callDlay5
Return

NybbleOut
MOVwfNOTemp
swapfNOTemp,f
bsfNOTemp,0
btfssSTATUS, C
bcfNOTemp,0

MOVlw6
MOVwfNOTmp1

bcfData
NOLoop1
ClockStrobe
decfszNOTmp1,f
gotoNOLoop1

bsfData
ClockStrobe
bcfData
bsfSTATUS, C
btfssNOTemp,0
bcfSTATUS, C
rlfGPIO,f
ClockStrobe
MOVlw4
MOVwfNOTmp1
NOLoop2
rlfNOTemp,f
bcfData
rlfGPIO,f
ClockStrobe
decfszNOTmp1,f
gotoNOLoop2

EStrobe

Return


;--------------------------------------------
;Delay
Dlay160
MOVlw256-(160/4)
Addlw1
btfssSTATUS, C
Goto$-2
Return

Dlay100callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
callDlay5
Return

Dlay5
MOVlw4
MOVwfDlyTmp
MOVlw256-0x0E8
Addlw1
btfscSTATUS,Z
decfszDlyTmp,f
Goto$-3
Return

Org0x3ff
Fill0x34a4,1
End

3.5 Inch to 23.8 Inch TFT-LCD

Thin film transistor liquid crystal display, commonly referred to as the TFT-LCD, is a type of liquid crystal display that USES thin-film transistor technology to improve the image quality. Although TFT-LCD is collectively known as LCD, it is an active matrix LCD used in televisions, flat screens and projectors.


Simply put, the TFT-LCD Panel can be seen as a layer of liquid crystal sandwiched between two glass substrates, the upper glass substrates being color filters, and the lower glass having transistors embedded in it. When the current passes through the transistor, the electric field changes and the liquid crystal molecules deflect, so as to change the polarization of the light, and then the polarizer is used to determine the light and dark state of the pixel. In addition, the upper glass is fitted to the color filter, so that each pixel contains three colors of red, blue and green, which make up the video image on the panel.

The Thin film Liquid Crystal Display is a type of most liquid crystal display that USES thin-film transistor technology to improve the image quality. Although TFT-LCD is generally referred to as LCD, it is an active matrix LCD. It is used in TV, flat panel display and projector.

I2C Tft Display,4.3 Inch Display,Lcd 4.3 Inch,Arduino 3.5 Tft Lcd

Tonya Display Limited , https://www.tydisplay.com

Posted on