The microcontroller source program is as follows:
;******************************************************************************
; *
; Filename: FB_ZHU_JI_PIC16LF1947.ASM *
; Date: 2012.01.6 *
; File Version: 1.0 *
; *
; Author: *
; *
; *
;******************************************************************************
; *
; Files Required: P16F1947.INC *
; *
;******************************************************************************
; *
; Notes: *
; *
;******************************************************************************
; *
; Revision History: *
; *
;******************************************************************************
list p=16f1947 ; list directive to define processor
#include #include #include #include ERRORLEVEL 0,-305,-306,-302 ; Messages, Warnings and Errors Printed ; Ignore [305] => Using default dest of ; 1 file ; Ignore [306] => Crossing Page Boundary ;****************************************************************************** ; ; CONFIGURATION WORD SETUP ; ; The 'CONFIG' directive is used to embed the configuration word within the ; .asm file. The lables following the directive are located in the respective ; .inc file. See the data sheet for additional information on configuration ; word settings. ; ;****************************************************************************** ; __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_ON & _IESO_OFF & _FCMEN_OFF ; __CONFIG _CONFIG2, _WRT_OFF & _VCAPEN_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF ;****************************************************************************** ; RESET VECTOR ;****************************************************************************** ORG 0x0000 ; processor reset vector PAGESEL START GOTO START ; When using debug header, first inst. ; may be passed over by ICD2. ORG 0x0004 ;****************************************************************************** ; INTERRUPT SERVICE ROUTINE ;****************************************************************************** #include ;****************************************************************************** ; USER INTERRUPT SERVICE ROUTINE GOES HERE ;****************************************************************************** ; Note the 16F1936 family automatically handles context restoration for ; W, STATUS, BSR, FSR, and PCLATH where previous templates for 16F families ; required manual restoration ;****************************************************************************** ; MAIN PROGRAM ;****************************************************************************** START PAGESEL Init_System_Clock CALL Init_System_Clock PAGESEL $ PAGESEL Init_Watch_Dog CALL Init_Watch_Dog PAGESEL $ ; BANKSEL Zhuan_Su_H_1 ; MOVLW 0XFF ; MOVWF Zhuan_Su_H_1 ; MOVLW 0X01 ; MOVWF Zhuan_Su_L_1 ; MOVLW 0X00 ; MOVWF Zhuan_Su_H_2 ; MOVLW 0XFF ; MOVWF Zhuan_Su_L_2 ; MOVLW 0XEE ; MOVWF Zhuan_Su_H_3 ; MOVLW 0X03 ; MOVWF Zhuan_Su_L_3 ; ; MOVLW LOW Zhuan_Su_H_1 ; MOVWF FSR0L ; MOVLW HIGH Zhuan_Su_H_1 ; MOVWF FSR0H ; PAGESEL D_Pai_Xu_3Byte ; CALL D_Pai_Xu_3Byte ; PAGESEL $ ; BANKSEL Biao_Wen_1 ; MOVLW 0X01 ; MOVWF Biao_Wen_1 ; MOVLW 0X00 ; MOVWF Biao_Wen_2 ; MOVLW 0X00 ; MOVWF Biao_Wen_3 ; ; MOVLW LOW Biao_Wen_1 ; MOVWF FSR0L ; MOVLW HIGH Biao_Wen_1 ; MOVWF FSR0H ; PAGESEL Pai_Xu_3Byte ; CALL Pai_Xu_3Byte ; PAGESEL $ PAGESEL Init_IO CALL Init_IO PAGESEL $ PAGESEL Clear_All_GPRAM CALL Clear_All_GPRAM PAGESEL $ ; PAGESEL Wa_Si_ChaZhi ; CALL Wa_Si_ChaZhi ; PAGESEL $ MOVLW 0X03 BANKSEL B_W_LB_Count ; Use median filtering to set N=3 MOVWF B_W_LB_Count ; MOVLW 0X01 ; BANKSEL Alarm_Of_H ; MOVWF Alarm_Wa_Si_H ; MOVLW 0X90 ; MOVWF Alarm_Search_To_L PAGESEL Init_SSP CALL Init_SSP PAGESEL $ PAGESEL Init_Mcp2515 CALL Init_Mcp2515 PAGESEL $ PAGESEL Init_Timer0_1S CALL Init_Timer0_1S PAGESEL $ PAGESEL Init_Timer2_10MS CALL Init_Timer2_10MS PAGESEL $ PAGESEL Init_Timer4_100MS CALL Init_Timer4_100MS PAGESEL $ PAGESEL Read_Mile_From_EEPROM CALL Read_Mile_From_EEPROM PAGESEL $ PAGESEL Read_Data_From_EEPROM CALL Read_Data_From_EEPROM PAGESEL $ PAGESEL Read_W_L_From_EEPROM CALL Read_W_L_From_EEPROM PAGESEL $ PAGESEL Read_BD_From_EEPROM CALL Read_BD_From_EEPROM PAGESEL $ PAGESEL Alarm_Data_Handle CALL Alarm_Data_Handle PAGESEL $ BANKSEL Speed_Count CLRF Speed_Count BANKSEL ZhuanSu_Count CLRF ZhuanSu_Count BANKSEL Wa_Si_Count CLRF Wa_Si_Count BANK SALE TMR1L CLRF TMR1L CLRF TMR1H MOVLW B'00110100' MOVWF T1CON BANK SALE Flag CLRF Flag BANKSEL CCP1CON CLRF CCP1CON CLRF CCP2CON CLRF CCPR1L CLRF CCPR1H CLRF CCPR2L CLRF CCPR2H MOVLW B'00000101' MOVWF CCP1CON MOVLW B'00000101' MOVWF CCP2CON BANKSEL CCP3CON CLRF CCP3CON MOVLW B'00000111' MOVWF CCP3CON CLRF CCPR3L CLRF CCPR3H BANKSEL PIR1 BCF PIR1,TMR2IF BCF PIR3,TMR4IF BCF PIR1,CCP1IF BCF PIR2,CCP2IF BANKSEL PIR3 BCF PIR3,CCP3IF BANKSEL PIE1 BSF PIE1,TMR2IE BSF PIE3,TMR4IE BSF PIE1,CCP1IE BSF PIE2,CCP2IE BANKSEL PIE3 BSF PIE3,CCP3IE BANKSEL T4CON BSF T4CON,TMR4ON BANKSEL T1CON BSF T1CON,TMR1ON BSF T2CON,TMR2ON BCF INTCON,TMR0IF ;BSF INTCON,TMR0IE BSF INTCON,THIS BSF INTCON,GIE MAIN ; PAGESEL CAN_BUS_TRANSMIT ; CALL CAN_BUS_TRANSMIT ; PAGESEL $ PAGESEL AD_Sample CALL AD_Sample PAGESEL $ PAGESEL Voltage_Calculate CALL Voltage_Calculate PAGESEL $ ;************************************** ; ;Gas treatment ; MOVLW 0X00 ;BANKING AN0_RESH ; SUBWF AN0_RESH,W ; BTFSS STATUS,C ; GOTO Wa_Si_Next_1 ; GOTO Wa_Si_Next_2 ;Wa_Si_Next_1 ; BANKSEL Wa_Si_N_D ;<80 ; MOVLW 0X55 ; disconnect ; MOVWF Wa_Si_N_D ; GOTO Wa_Si_Clear ;Wa_Si_Next_2 ; BTFSS STATUS,Z ; GOTO Wa_Si_Next_3 ; GOTO Wa_Si_Next_4 ;Wa_Si_Next_3 ; ;>=80 Calculate concentration based on voltage ;BANKING AN0_RESH ; MOVF AN0_RESH,W ; BANKSEL SOUH ; MOVWF SOUH ; BANKSEL AN0_RESL ;MOVF AN0_RESL,W ; BANK CELL SOU ; MOVWF ON ; MOVLW 0X00 ; RLTH BANKSEL ; MOVWF RLTH ; MOVLW 0X50 ; MOVWF RLT ; ; PAGESEL DUSUB ; CALL DUSUB ; PAGESEL $ ; ; MOVLW 0X00 ; RLTH BANKSEL ; MOVWF RLTH ; MOVLW 0X08 ; MOVWF RLT ; ; PAGESEL DUDIV ; CALL DUDIV ; PAGESEL $
Previous article:Combination of TM1640 and PIC12F629 microcontroller
Next article:PIC16F877 peripheral function module routine
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Learning methods and experience of embedded systems
- I would like to know the functions of these two components, about switching power supply.
- Molex's compact Type-C connector saves valuable space in your design! Download and get a gift! Event starts now
- Knowledge about power amplifiers in RF chips
- Playing with Zynq Part 7 - Ubuntu and Windos file transfer tool WinSCP
- Altium Designer 3D View Problem
- [National Technology N32G457 Review] RT_Thread Studio failed to mount spi1 after configuring SPI
- RT-Thread operating system μC/OS-III compatibility layer
- LSM6DSL power consumption problem
- [Rawpixel RVB2601 development board trial experience] TCP_SEVER communication