GOTO MAIN
ORG 0
;----------------------
;----------------------------
DELAY22
MOVLW D'200' ; DELAY 2*250=500mS
MOVWF COUNT1
DE32 MOVLW D'250' ; 8*250=2mS
MOVWF COUNT2
DE42 NOP ; 1+2+1=5uS
DECFSZ COUNT2,1
GOTO DE42
DECFSZ COUNT1,1
GOTO DE32
RETLW 0
;--------------------------------
; 子程序!!!
;********************************
MAIN
MOVLW 0FFH
TRIS RA
LOOP
CALL CONVERT
CALL DELAY22
CALL DELAY22
CALL GET_TEMP
GOTO LOOP
;------------------------
GET_TEMP
CALL INI
MOVLW 0CCH
MOVWF COMD
CALL WR1820
MOVLW 0BEH
MOVWF COMD
CALL WR1820
CALL RE1820
MOVF TEM_DATE,W
MOVWF TEM_DATEL
CALL RE1820
MOVF TEM_DATE,W
MOVWF TEM_DATEH
RETLW 0
;------------------------
CONVERT
CALL INI
MOVLW 0CCH
MOVWF COMD
CALL WR1820
MOVLW 44H
MOVWF COMD
CALL WR1820
RETLW 0
;---------DS1820---------
INI
;MOVLW B'00100000'
MOVLW 0
TRIS RA
BSF RA,3
NOP
BCF RA,3
MOVLW D'200'
MOVWF COUNT1
L0
DECFSZ COUNT1,1
GOTO L0
;MOVLW B'01100000'
MOVLW 0FH
TRIS RA
MOVLW D'30'
MOVWF COUNT1
L1
DECFSZ COUNT1,1
GOTO L1
BTFSC RA,3
GOTO INI
L2
MOVLW D'80'
MOVWF COUNT1
L3
DECFSZ COUNT1,1
GOTO L3
BTFSS RA,3
GOTO L0
RETLW 0
;-------------------------
WR1820
MOVLW 8
MOVWF COUNT2
WR0
;MOVLW B'00100000'
MOVLW 0
TRIS RA
BCF RA,3
NOP
NOP
MOVLW 2
MOVWF COUNT1
WR1
DECFSZ COUNT1,1
GOTO WR1
;MOVLW B'01111111'
MOVLW 0FH
BTFSC COMD,0
BSF RA,3
BTFSC COMD,0
TRIS RA
BCF STATUS,C
RRF COMD,1
MOVLW D'20'
MOVWF COUNT1
WR2
DECFSZ COUNT1,1
GOTO WR2
BSF RA,3
;MOVLW B'01100000'
MOVLW 0FH
TRIS RA
DECFSZ COUNT2,1
GOTO WR0
RETLW 0
;--------------------------
RE1820
MOVLW 8
MOVWF COUNT2
RE0
;MOVLW B'00100000'
MOVLW 0
TRIS RA
BCF RA,3
MOVLW 2
MOVWF COUNT1
RE1
DECFSZ COUNT1,1
GOTO RE1
;MOVLW B'01100000'
MOVLW 0FH
TRIS RA
NOP
BTFSS RA,3
BCF STATUS,C
BTFSC RA,3
BSF STATUS,C
RRF TEM_DATE,1
MOVLW D'20'
MOVWF COUNT1
RE2
DECFSZ COUNT1,1
GOTO RE2
DECFSZ COUNT2,1
GOTO RE0
BSF RA,3
RETLW 0
;-------------------------
;****************************
;**************************
END
Previous article:PIC microcontroller floating point number and its conversion to decimal number
Next article:Set all ports high and low at the same time, and keep flashing
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- "Domestic Chip Exchange" is launched! How to do it is up to you!
- [Erha Image Recognition Artificial Intelligence Vision Sensor] Evaluation of Four Face Algorithms
- [ESP32-Audio-Kit Audio Development Board] - 5: Run "esp-adf" flash on Ubuntu 20.04
- Are the design formulas for a push-pull transformer correct?
- Do you know the function of OPA?
- [RVB2601 Creative Application Development] Handheld Game Console (3) Flying Bird
- Should Dead Copper Be Removed in PCB Design?
- Cumulative error analysis and clock frequency optimization for UART communication in MSP430FR2311
- Automotive bus system
- On May 5th, celebrate the Dragon Boat Festival, row dragon boats and play drums