📄 tempdemo.lst
字号:
MPASM 03.80 Released TEMPDEMO.ASM 11-20-2005 18:21:10 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 list p=16F628A
00002 include P16F628A.inc
00001 LIST
00002 ; P16F628A.INC Standard Header File, Version 1.10 Microchip Technology, Inc.
00265 LIST
00003 include tempdemo.inc
00001 ;****************************************************************************
00002 ;* *
00003 ;* Dallas 1 Wire Bus Temperature demo *
00004 ;* *
00005 ;****************************************************************************
00006
003D0900 00007 Clock_Freq equ d'4000000' ;4MHz - for wait macro calculations
00008
00009 udata_ovr 0x20 ;0x0C 16F84
0020 00010 DScommbuff res 1
0021 00011 DSCRC res 1
00012
0022 00013 tempone res 1
0023 00014 temptwo res 1
0024 00015 count res 1
0025 00016 count2 res 1 ; 2nd loop counter for nested loops
0026 00017 bits_byte res 1
00018
0027 00019 CHARBUF res 1
0028 00020 temp_hi res 1
0029 00021 temp_lo res 1
002A 00022 acc_lo res 1
002B 00023 acc_hi res 1
00024
002C 00025 vvshift res 1
00026
00027 #define PRESENCE_bit bits_byte, 0
00028 #define round00_bit bits_byte, 1
00029 #define DSNext_bit bits_byte, 2
00030 #define neg_temp_bit bits_byte, 3
00031 #define DALLAS_BUS PORTA, 4
00032
002D 00033 ROM_no res 8
0035 00034 id_bit_number res 1
0036 00035 last_zero res 1
0037 00036 LastDiscrepancy res 1
0038 00037 LastFamilyDiscr res 1
0039 00038 id_bits_byte res 1
003A 00039 rom_mask res 1
00040
00041 #define id_bit id_bits_byte, 0 ; first bit read in a search ID sequence
00042 #define cmp_id_bit id_bits_byte, 1 ; complement of id_bit
00043 #define test_bit id_bits_byte, 2 ; test id_bit & cmp_id_bit
00044
00045 #define last_device id_bits_byte, 6
00046 #define Direction id_bits_byte, 7
00004 include dal_bus.inc
MPASM 03.80 Released TEMPDEMO.ASM 11-20-2005 18:21:10 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00032 list
00005 include wait.inc
00001
00002 #define Nanosec * D'1'
00003 #define Microsec * D'1000'
00004 #define Millisec * D'1000000'
00005 #define Seconds * D'1000000000'
00006
00007
00008 ;**************************************************************
00009 ;* The WAIT macro *
00010 ;* * VERSION 1.01 * *
00011 ;* called by Wait <time>, lesscycles *
00012 ;**************************************************************
00013 ;History
00014 ;1.00 - Original
00015 ;1.01 - Fixed bug with small even numbers giving an error message
00016
00017
00018 Wait macro time_ns, lesscycles ;time_ns gives the wait time required, in ns
00019 radix dec
00020 variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
00021 local cycles
00022 variable cycles = ((time_ns) / instruct_time_ns) ;required delay in
00023 ;100ths of instructions
00024
00025 if (cycles < (lesscycles) )
00026 messg NOTE - negative delay time with lesscycles cycles (no code)
00027
00028 exitm
00029 else
00030 variable cycles = (cycles - (lesscycles))
00031 endif
00032
00033 if (cycles == 0)
00034 messg "WARNING - delay time less than 1 instructions"
00035
00036 nop
00037 exitm
00038 endif
00039
00040 if (cycles > (255*(256*3 + 6) + 2 + 3))
00041 messg "ERROR : Too long a wait for the WAIT macro at present!!"
00042 exitm
00043 endif
00044
00045 ; messg Info - calculated number of cycles = #v(cycles)
00046
00047
00048 if (cycles > ((255*3)+5))
00049
00050 movlw ((cycles-5)/(256*3+6))
00051 call longdelay
MPASM 03.80 Released TEMPDEMO.ASM 11-20-2005 18:21:10 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00052
00053 ifndef INCLONGDELAY
00054 #define INCLONGDELAY
00055 endif
00056
00057 exitm
00058 endif
00059
00060 if ((cycles > 8 ) && (cycles < (255*3 + 5)))
00061
00062 movlw ((cycles-5)/3)
00063 call shortdelay
00064
00065 ifndef INCSHORTDELAY
00066 #define INCSHORTDELAY
00067 endif
00068
00069 exitm
00070 endif
00071
00072 if (cycles < 8)
00073 while ( cycles > 1 )
00074
00075 goto $+1 ;two cycle nop
00076
00077 cycles -=2
00078 endw
00079 endif
00080
00081 if (cycles > 0)
00082 nop
00083
00084 endif
00085 exitm
00086
00087 messg "ERROR - got to end of WAIT.MAC"
00088
00089 radix hex
00090 endm
00006 include lm032l.inc
00048 list
00007
00008 ;------defines for conditional assembly------
00009 ;#define round00
00010 ;#define test
00011 ;#define EEdsrom
00012 ;#define dog
00013
00014 errorlevel -302 ;Eliminate bank warning
00015 ;CONFIG CODE
00016 #ifdef dog
00017 __config _BODEN_OFF & _CP_OFF& _DATA_CP_OFF & _PWRTE_ON & _WDT_ON & _LVP_OFF & _MCLRE_ON & _XT_OSC
00018 messg "W A T C H__________D O G"
MPASM 03.80 Released TEMPDEMO.ASM 11-20-2005 18:21:10 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00019 #else
2007 3F21 00020 __config _BODEN_OFF & _CP_OFF& _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC
00021 #endif ; dog
00022
00023 ; noexpand
00024 ;****************************************************************************
00025 ;* *
00026 ;* Dallas 1 Wire Bus Temperature demo *
00027 ;* *
00028 ;* This file and the resulting compiled code copyright1993-97 Steve Lawther *
00029 ;* Use of any of this code requires Steve Lawther to have a credit *
00030 ;* within the source code. Commercial use of any of this code *
00031 ;* requires permission of the author, Steve Lawther *
00032 ;* For more details read 'README.TXT' or email 100255.157@compuserve.com *
00033 ;****************************************************************************
00034 ;* This outline requires IBM line draw chrs *
00035 ;* 谀哪腬/哪哪
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -