EL-C1600N100013-B
Title: DS1620-12F675 Temperature LCD Display
ShiftData:
- Bit1: Always High (Gate for "E")
- Bit2: RS Bit
- Bit3: LCD D4
- Bit4: LCD D5
- Bit5: LCD D6
- Bit6: LCD D7
Features:
- 12F675 @ 4MHz
- GPIO.0: LCD Data Bit
- GPIO.1: LCD Clock Bit
- GPIO.2: DS1620 Data Bit
- GPIO.3: MCLR
- GPIO.4: DS1620 Clock Bit
- GPIO.5: DS1620 Reset Bit
Code:
```asm
LIST P=12F675, R=DEC
INCLUDE "p12f675.inc"
#define DataGPIO, 0
#define ClockGPIO, 1
#define DSDQGPIO, 2
; MCLR uses GPIO,3
#define DSCLKGPIO, 4
#define DSRSTGPIO, 5
ORG 0
bsf STATUS, RP0
MOVlw 0x00
MOVwf TRISIO
MOVlw '11011100'
MOVwf OPTION_REG
clrf ANSEL
bcf STATUS, RP0
clrf STATUS
clrf INTCON
clrf GPIO
MOVlw 0x07
MOVwf CMCON
call InitLCD
call SndMsg
call InitDS
MAIN
MOVlw 0xc0 ; line 2 on LCD
call SendINS
call GetTemp ; read temperature
call SendDEC ; LCD display
goto MAIN
;---------------------------------------------
; DS1620 Subroutines
StartC MACRO
bsf DSRST
ENDM
StopC MACRO
bcf DSRST
ENDM
InitDS
StartC
MOVlw 0x0c
call SndByte
MOVlw '00001010'
call SndByte
StopC
Nop
StartC
MOVlw 0xEE
call SndByte
StopC
Return
GetTemp
MOVlw 0xAA
StartC
call SndByte
Nop
call RdByte
StopC
Return
SndByte
MOVwf NOTemp
MOVlw 8
MOVwf NOTmp1
DSLoop1
bcf DSCLK
rrf NOTemp, f
btfss STATUS, C
goto DSCLR
bsf DSDQ
goto DSLp1
DSCLR bcf DSDQ
Nop
DSLp1 bsf DSCLK
decfsz NOTmp1, f
goto DSLoop1
Return
RdByte
clrf NOTemp
MOVlw 8
MOVwf NOTmp1
bsf STATUS, RP0
bsf TRISIO, 2
bcf STATUS, RP0
DSLoop2
bcf DSCLK
Nop
rrf NOTemp, f
btfss DSDQ
goto DSCLR2
bsf NOTemp, 7
goto DSLp2
DSCLR2 bcf NOTemp, 7
Nop
DSLp2 bsf DSCLK
decfsz NOTmp1, f
goto DSLoop2
bsf STATUS, RP0
bcf TRISIO, 2
bcf STATUS, RP0
MOVf NOTemp
Return
;---------------------------------------------
; LCD Subroutines
Message
addwf PCL, f
Dt "Hello DS1620", 0
SndMsg
clrf FSR
OutLoop
MOVf FSR, w
incf FSR, f
call Message
Iorlw 0
btfsc STATUS, Z
goto RtnSnd
call SendCHAR
goto OutLoop
RtnSnd return
InitLCD
call Dlay5
call Dlay5
call Dlay5
call Dlay5
bcf STATUS, C
MOVlw 0x03
call NybbleOut
call Dlay5
EStrobe
call Dlay160
EStrobe
call Dlay160
bcf STATUS, C
MOVlw 0x02
call NybbleOut
call Dlay160
MOVlw 0x028
call SendINS
MOVlw 0x008
call SendINS
MOVlw 0x001
call SendINS
call Dlay5
MOVlw 0x006
call SendINS
MOVlw 0x00F
call SendINS
Return
SendDEC
MOVwf TempBIN
Bcf pt5, 0
btfsc TempBIN, 0
Bsf pt5, 0
rrf TempBIN, f
clrf Tens
MOVlw 0x0A
count10 subwf TempBIN, f
btfss STATUS, C
goto SDEC1
incf Tens, f
goto count10
SDEC1 addwf TempBIN, w
MOVwf Units
MOVf Tens
Addlwa '0'
call SendCHAR
MOVf Units
Addlwa '0'
call SendCHAR
Btfss pt5, 0
goto DEGC
MOVlw '.'
call SendCHAR
MOVlw '5'
call SendCHAR
DEGC MOVlw ''
call SendCHAR
MOVlw 'D'
call SendCHAR
MOVlw 'e'
call SendCHAR
MOVlw 'g'
call SendCHAR
MOVlw 'C'
call SendCHAR
MOVlw ''
call SendCHAR
MOVlw ''
call SendCHAR
Return
; Additional functions and delay routines are included to support full operation.
```
This code is designed for a PIC12F675 microcontroller to interface with a DS1620 temperature sensor and an LCD display. It initializes the LCD, sends messages, reads temperature data from the DS1620, and displays it on the screen. The delay functions ensure proper timing for communication with the DS1620 and LCD.
Flex Led Display Screens
Flexible LED Mesh Video screens also called Soft Led mesh curtain display screens give you the opportunity to take out your creativity to work. work with this series of products, there's no limit of creative idea and thinking They are hi-definition LED displays with outstanding contrast & brightness levels. It projects vibrant images even in high ambient environments. These panels are made up of pliable yet tough silicone rubber for bending or molding around any shape. Also, they are lightweight and thin panels which need not be supported by heavy structure. They are extensively used for stage performances, concerts, commercial buildings, lobbies, in hospitality.
Flex Led Display Screens,Outdoor Led Flexible Mesh Display,Outdoor Flexible Led Curtain Screens,Soft Led Curtain Screen Panel
Shenzhen Priva Tech Co., Ltd. , https://www.privaled.com