⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p18demo.lst

📁 详细讲解了PIC18单片机的各个功能模块的使用方法和运用技巧
💻 LST
📖 第 1 页 / 共 5 页
字号:
                      00368         
000288 EC?? F???      00369         call    LCDLine_1
00028C 0EB0           00370         movlw   .176                    ;send "Prd.=128 DC=128" to LCD
00028E 6E??           00371         movwf   ptr_pos
000290 EC?? F???      00372         call    stan_char_1
000294 EC?? F???      00373         call    LCDLine_2
000298 0E80           00374         movlw   .128                    ;send "RA4= -> RB0 = ++" to LCD
00029A 6E??           00375         movwf   ptr_pos
00029C EC?? F???      00376         call    stan_char_2
                      00377                 
0002A0 0E0F           00378         movlw   0x0F                    ;turn buzzer on 
0002A2 6EBD           00379         movwf   CCP1CON 
                      00380                 
0002A4                00381 pr2_again                       
0002A4 B081           00382         btfsc   select                  ;increment PR2 ???
0002A6 D???           00383         bra     pr2_out                 ;NO
0002A8 EC?? F???      00384         call    delay_100ms             ;YES
0002AC EC?? F???      00385         call    delay_100ms             
0002B0 2ACB           00386         incf    PR2,F                   ;increment PR2
0002B2                00387 pr2_out
MPASM  5.20                       P18DEMO.ASM   5-28-2008  15:51:06         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0002B2 0E85           00388         movlw   0x85                    ;move cursor into position
0002B4 6E??           00389         movwf   temp_wr
0002B6 EC?? F???      00390         call    i_write
                      00391 
0002BA                00392 pol1
0002BA A880           00393         btfss   scroll                  ;goto increment CCPR1L
0002BC D???           00394         bra     inc_dc
0002BE B081           00395         btfsc   select                  ;wait for RB0 press
0002C0 D???           00396         bra     pol1
                      00397 
0002C2 50CB           00398         movf    PR2,W                   ;send PR2 register to conversion
0002C4 EC?? F???      00399         call    bin_bcd
                      00400 
0002C8 50??           00401         movf    MSD,W                   ;send high digit
0002CA 6E??           00402         movwf   temp_wr
0002CC EC?? F???      00403         call    d_write
0002D0 50??           00404         movf    MsD,W                   ;send middle digit
0002D2 6E??           00405         movwf   temp_wr
0002D4 EC?? F???      00406         call    d_write
0002D8 50??           00407         movf    LSD,W                   ;send low digit
0002DA 6E??           00408         movwf   temp_wr
0002DC EC?? F???      00409         call    d_write
                      00410 
0002E0 D???           00411         bra     pr2_again               
                      00412 
                      00413 ;------------------------
                      00414                 ;adjust Duty Cycle
0002E2                00415 inc_dc
0002E2 A880           00416         btfss   scroll                  ;wait for button release
0002E4 D???           00417         bra     $-2
                      00418 
0002E6                00419 inc_ccpr1l      
0002E6 B081           00420         btfsc   select                  ;increment CCPR1L ???
0002E8 EF?? F???      00421         goto    ccpr1l_out              ;NO
0002EC EC?? F???      00422         call    delay_100ms             ;YES
0002F0 EC?? F???      00423         call    delay_100ms
0002F4 2ABE           00424         incf    CCPR1L,F                ;increment CCPR1L
0002F6                00425 ccpr1l_out
0002F6 0E8C           00426         movlw   0x8C                    ;move cursor into position
0002F8 6E??           00427         movwf   temp_wr
0002FA EC?? F???      00428         call    i_write
                      00429 
0002FE                00430 col1
0002FE A880           00431         btfss   scroll                  ;exit?
000300 D???           00432         bra     pwm_out
000302 B081           00433         btfsc   select                  ;wait for RB0 press
000304 D???           00434         bra     col1
                      00435         
000306 50BE           00436         movf    CCPR1L,W                ;send PR2 register to conversion
000308 EC?? F???      00437         call    bin_bcd
                      00438         
00030C 50??           00439         movf    MSD,W                   ;send high digit
00030E 6E??           00440         movwf   temp_wr
MPASM  5.20                       P18DEMO.ASM   5-28-2008  15:51:06         PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

000310 EC?? F???      00441         call    d_write
000314 50??           00442         movf    MsD,W                   ;send middle digit
000316 6E??           00443         movwf   temp_wr
000318 EC?? F???      00444         call    d_write
00031C 50??           00445         movf    LSD,W                   ;send low digit
00031E 6E??           00446         movwf   temp_wr
000320 EC?? F???      00447         call    d_write                 
000324 D???           00448         bra     inc_ccpr1l
                      00449 
000326                00450 pwm_out
000326 0E00           00451         movlw   0
000328 6EBD           00452         movwf   CCP1CON                 ;turn buzzer off
00032A D???           00453         bra     menu_temp
                      00454 
                      00455 ;---------------------- Temperature -------------------------------- 
00032C                00456 temp
                      00457 ;       This code if for the TC74A5-5.0VAT temperature sensor
                      00458 ;               1st. Check if temperature is ready to be read in config reg.
                      00459 ;               2nd. If ready, retireve temperatute in hex.
                      00460 ;                    If not ready, check config register again.
                      00461 
00032C 8694           00462         bsf     TRISC,3                 ;initialize MSSP module
00032E 8894           00463         bsf     TRISC,4
000330 0E28           00464         movlw   B'00101000'
000332 6EC6           00465         movwf   SSPCON1
000334 8EC7           00466         bsf     SSPSTAT,SMP
000336 0E05           00467         movlw   .5
000338 6EC8           00468         movwf   SSPADD
                      00469 
00033A 909E           00470         bcf     PIR1,TMR1IF
00033C 6ACF           00471         clrf    TMR1H                   ;load Timer1 for 2 sec overflow
00033E 6ACE           00472         clrf    TMR1L
                      00473 
000340                00474 get_temp
000340 0E01           00475         movlw   0x01                    ;config register command byte
000342 6E??           00476         movwf   cmd_byte
000344                00477 temp_now
000344 8CC7           00478         bsf     SSPSTAT,6               ;SMBUS spec for TC74
                      00479 
000346 80C5           00480         bsf     SSPCON2,SEN             ;write to TC74
000348 B0C5           00481         btfsc   SSPCON2,SEN
00034A D???           00482         bra     $-2     
00034C 0E9A           00483         movlw   B'10011010'             ;send TC74 ADDRESS (write)
00034E 6EC9           00484         movwf   SSPBUF
                      00485         ssprw
000350 0E00               M         movlw   0x00
000352 14C5               M         andwf   SSPCON2,W
000354 0800               M         sublw   0x00
000356 A4D8               M         btfss   STATUS,Z
000358 D???               M         bra     $-8
                          M 
00035A B4C7               M         btfsc   SSPSTAT,R_W
00035C D???               M         bra     $-2
MPASM  5.20                       P18DEMO.ASM   5-28-2008  15:51:06         PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

00035E BCC5           00486         btfsc   SSPCON2,ACKSTAT         ;ack?
000360 D???           00487         bra     $-2
                      00488 
000362 50??           00489         movf    cmd_byte,W              ;send COMMAND byte (config)
000364 6EC9           00490         movwf   SSPBUF
                      00491         ssprw
000366 0E00               M         movlw   0x00
000368 14C5               M         andwf   SSPCON2,W
00036A 0800               M         sublw   0x00
00036C A4D8               M         btfss   STATUS,Z
00036E D???               M         bra     $-8
                          M 
000370 B4C7               M         btfsc   SSPSTAT,R_W
000372 D???               M         bra     $-2
000374 BCC5           00492         btfsc   SSPCON2,ACKSTAT         ;ack?
000376 D???           00493         bra     $-2
                      00494 
000378 82C5           00495         bsf     SSPCON2,RSEN            ;send repeated start
00037A B2C5           00496         btfsc   SSPCON2,RSEN
00037C D???           00497         bra     $-2
00037E 0E9B           00498         movlw   B'10011011'             ;send TC74 ADDRESS (read)
000380 6EC9           00499         movwf   SSPBUF
                      00500         ssprw                           ;module idle?
000382 0E00               M         movlw   0x00
000384 14C5               M         andwf   SSPCON2,W
000386 0800               M         sublw   0x00
000388 A4D8               M         btfss   STATUS,Z
00038A D???               M         bra     $-8
                          M 
00038C B4C7               M         btfsc   SSPSTAT,R_W
00038E D???               M         bra     $-2
000390 BCC5           00501         btfsc   SSPCON2,ACKSTAT         ;ack?
000392 D???           00502         bra     $-2
                      00503 
000394 86C5           00504         bsf     SSPCON2,RCEN            ;enable receive mode
000396 B6C5           00505         btfsc   SSPCON2,RCEN
000398 D???           00506         bra     $-2
                      00507 
00039A 50C9           00508         movf    SSPBUF,W                ;retrieve config reg or temp reg
                      00509         
00039C 8AC5           00510         bsf     SSPCON2,ACKDT           ;send NOT-ACK
00039E 88C5           00511         bsf     SSPCON2,ACKEN
0003A0 B8C5           00512         btfsc   SSPCON2,ACKEN
0003A2 D???           00513         bra     $-2
                      00514                         
0003A4 84C5           00515         bsf     SSPCON2,PEN             ;stop
0003A6 B4C5           00516         btfsc   SSPCON2,PEN
0003A8 D???           00517         bra     $-2
                      00518         
0003AA A0??           00519         btfss   cmd_byte,0              ;config command OR temp command
0003AC D???           00520         bra     convert_temp            ;get temperature ready for display
                      00521 
0003AE 0B40           00522         andlw   0x40                    ;is temp ready ??
MPASM  5.20                       P18DEMO.ASM   5-28-2008  15:51:06         PAGE 12


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0003B0 0840           00523         sublw   0x40
0003B2 A4D8           00524         btfss   STATUS,Z
0003B4 D???           00525         bra     get_temp
0003B6 0E00           00526         movlw   0x00                    ;temp is ready for reading
0003B8 6E??           00527         movwf   cmd_byte                ;send temp register command
0003BA D???           00528         bra     temp_now
                      00529 
0003BC                00530 convert_temp
0003BC 6E??           00531         movwf   temperature
0003BE EC?? F???      00532         call    bin_bcd                 ;get temp ready for LCD
0003C2 EC?? F???      00533         call    LCDLine_1
                      00534         
0003C6 0E54           00535         movlw   A'T'                    ;send "Temp=" to LCD
0003C8 6E??           00536         movwf   temp_wr 
0003CA EC?? F???      00537         call    d_write
0003CE 0E65           00538         movlw   A'e'
0003D0 6E??           00539         movwf   temp_wr 
0003D2 EC?? F???      00540         call    d_write
0003D6 0E6D           00541         movlw   A'm'
0003D8 6E??           00542         movwf   temp_wr 
0003DA EC?? F???      00543         call    d_write
0003DE 0E70           00544         movlw   A'p'
0003E0 6E??           00545         movwf   temp_wr 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -