📄 tx900-ok.lst
字号:
MPASM 02.70 Released TX900-OK.ASM 3-10-2003 14:57:32 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;***********************************************************************************
00002 ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00003 ; project: RF 900 MHz radio communication module
00004 ; filename: Tx900-OK.asm
00005 ; mcu: pic16c505
00006 ; pin define:
00007 ; ________
00008 ; VCC--| o |--VSS
00009 ; LV--| |--SEL0
00010 ; NC--| |--SEL1
00011 ; SEL2--| |--NC
00012 ; DATA--| |--NC
00013 ; PLL EN--| |--NC
00014 ; TX EN--| |--NC
00015 ; --------
00016 ; key encode value: SEL0--aah
00017 ; SEL1--55h
00018 ; SEL2--0fh
00019 ;***********************************************************************************
00020 ;***********************************************************************************
00021 ; The STATUS register
00022
00023 ;bit 7: GPWUF: GPIO reset bit
00024 ; 1 = Reset due to wake-up from SLEEP on pin change
00025 ; 0 = After power up or other reset
00026 ;bit 6: Unimplemented
00027 ;bit 5: PA0: Program page preselect bits
00028 ; 1 = Page 1 (200h - 3FFh) - PIC12C509, PIC12C509A, PIC12CR509A and PIC12CE519
00029 ; 0 = Page 0 (000h - 1FFh) - PIC12C5XX
00030 ; Each page is 512 bytes.
00031 ; Using the PA0 bit as a general purpose read/write bit in devices which do not
00032 ; use it for program
00033 ; page preselect is not recommended since this may affect upward compatibility
00034 ; with future products.
00035 ;bit 4: TO: Time-out bit
00036 ; 1 = After power-up, CLRWDT instruction, or SLEEP instruction
00037 ; 0 = A WDT time-out occurred
00038 ;bit 3: PD: Power-down bit
00039 ; 1 = After power-up or by the CLRWDT instruction
00040 ; 0 = By execution of the SLEEP instruction
00041 ;bit 2: Z: Zero bit
00042 ; 1 = The result of an arithmetic or logic operation is zero
00043 ; 0 = The result of an arithmetic or logic operation is not zero
00044 ;bit 1: DC: Digit carry/borrow bit (for ADDWF and SUBWF instructions)
00045 ; ADDWF
00046 ; 1 = A carry from the 4th low order bit of the result occurred
00047 ; 0 = A carry from the 4th low order bit of the result did not occur
00048 ; SUBWF
00049 ; 1 = A borrow from the 4th low order bit of the result did not occur
00050 ; 0 = A borrow from the 4th low order bit of the result occurred
00051 ;bit 0: C: Carry/borrow bit (for ADDWF, SUBWF and RRF, RLF instructions)
00052 ;***********************************************************************************
00053 ;The code init. OPTION set.
MPASM 02.70 Released TX900-OK.ASM 3-10-2003 14:57:32 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00054
00055 ;bit 7: GPWU: Enable wake-up on pin change (GP0, GP1, GP3)
00056 ; 1 = Disabled
00057 ; 0 = Enabled
00058 ;bit 6: GPPU: Enable weak pull-ups (GP0, GP1, GP3)
00059 ; 1 = Disabled
00060 ; 0 = Enabled
00061 ;bit 5: T0CS: Timer0 clock source select bit
00062 ; 1 = Transition on T0CKI pin
00063 ; 0 = Transition on internal instruction cycle clock, Fosc/4
00064 ;bit 4: T0SE: Timer0 source edge select bit
00065 ; 1 = Increment on high to low transition on the T0CKI pin
00066 ; 0 = Increment on low to high transition on the T0CKI pin
00067 ;bit 3: PSA: Prescaler assignment bit
00068 ; 1 = Prescaler assigned to the WDT
00069 ; 0 = Prescaler assigned to Timer0
00070 ;bit 2-0: PS2:PS0: Prescaler rate select bits
00071 ; Bit Value Timer0 Rate WDT Rate
00072 ; 000 1 : 2 1 : 1
00073 ; 001 1 : 4 1 : 2
00074 ; 010 1 : 8 1 : 4
00075 ; 011 1 : 16 1 : 8
00076 ; 100 1 : 32 1 : 16
00077 ; 101 1 : 64 1 : 32
00078 ; 110 1 : 128 1 : 64
00079 ; 111 1 : 256 1 : 128
00080 ;***********************************************************************************
00081 ;------------------------
00082 ;special register define
00083 ;------------------------
00000000 00084 INDF EQU 0H
00000001 00085 TMR0 EQU 1H
00000002 00086 PCL EQU 2H
00000003 00087 STATUS EQU 3H
00000005 00088 PA0 EQU .5
00000004 00089 FSR EQU 4H
00000005 00090 OSCCAL EQU 5H
00000006 00091 PB EQU 6H
00000007 00092 PC EQU 7H
00093 ;-------------------
00094 ;special bit define
00095 ;-------------------
00000000 00096 C EQU 0
00000001 00097 DC EQU 1
00000002 00098 Z EQU 2
00000003 00099 PD EQU 3
00000004 00100 TO EQU 4
00000005 00101 PA0 EQU 5
00102 ;
00000007 00103 GPWUF EQU 7
00104 ;------------------------
00105 ;General register define
00106 ;------------------------
MPASM 02.70 Released TX900-OK.ASM 3-10-2003 14:57:32 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00000008 00107 COMPARE_BUF EQU 08H
00000009 00108 COUNTER_BUF EQU 09H
0000000A 00109 FLG_AGO EQU 0AH
0000000B 00110 FLG_NOW EQU 0BH
0000000C 00111 TEMP_BUF EQU 0CH
00000012 00112 PUL_BREADTH EQU 12H
00000013 00113 BIT_CONT EQU 13H
00000014 00114 DATA_BUF EQU 14H
00000015 00115 DATA_TMP EQU 15H
00000016 00116 BAG_CNT EQU 16H
00000017 00117 R0 EQU 17H
00000018 00118 R1 EQU 18H
00000019 00119 R2 EQU 19H
0000001A 00120 ID_CONT EQU 1AH
0000001B 00121 ID_CODE EQU 1BH
0000001C 00122 COUNT EQU 1CH
0000001D 00123 FLG_QC EQU 1DH
0000001E 00124 FLG_POWUP EQU 1EH
00125 ;---------------------
00126 ;port define
00127 ;---------------------
00000000 00128 S1 EQU 0
00000001 00129 S2 EQU 1
00000003 00130 S3 EQU 3
00000005 00131 LV EQU 5
00132 ;
00000003 00133 TXEN EQU 3
00000004 00134 PLLEN EQU 4
00000005 00135 DAT EQU 5
00136 ;
00137 ;=====================
00138 ; pulse breadth value
00139 ;=====================
00000001 00140 SYN_BREADTH SET D'1' ;sync-code 5 * 60 = 300US
00000004 00141 ONE_BREADTH SET D'4' ;BIT "1" 10 * 30 = 300US
00000007 00142 ZER_BREADTH SET D'7' ;BIT "0" 15 * 20 = 300US
0000000F 00143 STA_BREADTH SET D'15' ;BIT "STA" 30 * 10 = 300US
00144 ;
0000000A 00145 V_KEY1 SET 0AH
00000009 00146 V_KEY2 SET 09H
00000003 00147 V_KEY3 SET 03H
00000000 00148 V_KEYQC SET 00H
00000002 00149 V_KEYTS SET 02H
00150 ;
000000AA 00151 COM_BZ SET 0AAH
00000055 00152 COM_SO SET 055H
0000000F 00153 COM_SOL SET 00FH
00154 ;
000000F0 00155 V_QCMO SET 0F0H
0000000F 00156 V_TSMO SET 00FH
00157 ;=====================
00158 #DEFINE BLOCK1 BCF STATUS,PA0
00159 #DEFINE BLOCK2 BSF STATUS,PA0
MPASM 02.70 Released TX900-OK.ASM 3-10-2003 14:57:32 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00160 ;=====================
00161 DELX_US MACRO
00162 MOVWF COUNT
00163 NOP
00164 NOP
00165 DECFSZ COUNT,F
00166 GOTO $-3
00167 ENDM
00168 ;*********************************************************************
00169 ;*********************************************************************
0000 00170 ORG 000H
0000 0025 00171 MOVWF OSCCAL
0001 0A10 00172 GOTO MAIN
00173 ;*********************************************************************
00174 ;**** the NOP is uniform to address 010H of ROM
0002 0000 00175 NOP
0003 0000 00176 NOP
0004 0000 00177 NOP
0005 0000 00178 NOP
0006 00179 GET_ID
0006 021A 00180 MOVFW ID_CONT ; ID number to W
0007 01E2 00181 ADDWF PCL ; Add W to PC
0008 0812 00182 RETLW 012H ; the ID number can alter at program MCU
0009 08AA 00183 RETLW 0AAH
000A 08AA 00184 RETLW 0AAH
00185 ;========================================================================
0010 00186 ORG 010H
0010 00187 MAIN
0010 05A3 00188 BLOCK2
0011 0A10 00189 GOTO _MAIN
00190 ;****************************************************
00191 ; entrance parameter:
00192 ; PUL_BREADTH--pulse breadth
00193 ;****************************************************
00194 ;****************************************************
0012 00195 SEND_BIT
0012 05A7 00196 BSF PC,DAT
0013 0C0A 00197 MOVLW D'10' ; 10 * 5 = 50us
00198 DELX_US
0014 003C M MOVWF COUNT
0015 0000 M NOP
0016 0000 M NOP
0017 02FC M DECFSZ COUNT,F
0018 0A15 M GOTO $-3
00199 ;
0019 04A7 00200 BCF PC,DAT
001A 0C05 00201 MOVLW D'5' ; 5 * 5 = 25us
00202 DELX_US
001B 003C M MOVWF COUNT
001C 0000 M NOP
001D 0000 M NOP
001E 02FC M DECFSZ COUNT,F
001F 0A1C M GOTO $-3
MPASM 02.70 Released TX900-OK.ASM 3-10-2003 14:57:32 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00203 ;
0020 05A7 00204 BSF PC,DAT
0021 0C0A 00205 MOVLW D'10' ; 10 * 5 = 50us
00206 DELX_US
0022 003C M MOVWF COUNT
0023 0000 M NOP
0024 0000 M NOP
0025 02FC M DECFSZ COUNT,F
0026 0A23 M GOTO $-3
00207 ;
0027 04A7 00208 BCF PC,DAT
0028 0C05 00209 MOVLW D'5' ; 5 * 5 = 25us
00210 DELX_US
0029 003C M MOVWF COUNT
002A 0000 M NOP
002B 0000 M NOP
002C 02FC M DECFSZ COUNT,F
002D 0A2A M GOTO $-3
00211 ;-------------------------
002E 00212 _ZERO
002E 0C07 00213 MOVLW D'7'
002F 0092 00214 SUBWF PUL_BREADTH,W
0030 0743 00215 SKPZ
0031 0A35 00216 GOTO _ONE
0032 0C14 00217 MOVLW D'20'
0033 0037 00218 MOVWF R0
0034 0A49 00219 GOTO BIT00
0035 00220 _ONE
0035 0C04 00221 MOVLW D'4'
0036 0092 00222 SUBWF PUL_BREADTH,W
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -