📄 abc-001.asm
字号:
; PicBasic Pro Compiler 2.42, (c) 1998, 2002 microEngineering Labs, Inc. All Rights Reserved.
PM_USED EQU 1
INCLUDE "16F877.INC"
; Define statements.
#define CODE_SIZE 8
#define LCD_DREG PORTD
#define LCD_DBIT 4
#define LCD_RSREG PORTE
#define LCD_RSBIT 0
#define LCD_EREG PORTE
#define LCD_EBIT 1
RAM_START EQU 00020h
RAM_END EQU 001EFh
RAM_BANKS EQU 00004h
BANK0_START EQU 00020h
BANK0_END EQU 0007Fh
BANK1_START EQU 000A0h
BANK1_END EQU 000EFh
BANK2_START EQU 00110h
BANK2_END EQU 0016Fh
BANK3_START EQU 00190h
BANK3_END EQU 001EFh
EEPROM_START EQU 02100h
EEPROM_END EQU 021FFh
R0 EQU RAM_START + 000h
R1 EQU RAM_START + 002h
R2 EQU RAM_START + 004h
R3 EQU RAM_START + 006h
R4 EQU RAM_START + 008h
R5 EQU RAM_START + 00Ah
R6 EQU RAM_START + 00Ch
R7 EQU RAM_START + 00Eh
R8 EQU RAM_START + 010h
FLAGS EQU RAM_START + 012h
GOP EQU RAM_START + 013h
RM1 EQU RAM_START + 014h
RM2 EQU RAM_START + 015h
RR1 EQU RAM_START + 016h
RR2 EQU RAM_START + 017h
_chrm EQU RAM_START + 018h
_counts EQU RAM_START + 01Ah
_incounts EQU RAM_START + 01Ch
_j EQU RAM_START + 01Eh
_l EQU RAM_START + 020h
_ofhrm EQU RAM_START + 022h
_onhrm EQU RAM_START + 024h
_qqq EQU RAM_START + 026h
_almp EQU RAM_START + 028h
_bcdh EQU RAM_START + 029h
_bcdl EQU RAM_START + 02Ah
_cbcd EQU RAM_START + 02Bh
_cdate EQU RAM_START + 02Ch
_cday EQU RAM_START + 02Dh
_chr EQU RAM_START + 02Eh
_cmin EQU RAM_START + 02Fh
_cmonth EQU RAM_START + 030h
_countcnt EQU RAM_START + 031h
_cyear EQU RAM_START + 032h
_forwardtimes EQU RAM_START + 033h
_i EQU RAM_START + 034h
_incountcnt EQU RAM_START + 035h
_k EQU RAM_START + 036h
_m EQU RAM_START + 037h
_modecnt EQU RAM_START + 038h
_n EQU RAM_START + 039h
_ofhr EQU RAM_START + 03Ah
_ofm EQU RAM_START + 03Bh
_onhr EQU RAM_START + 03Ch
_onm EQU RAM_START + 03Dh
_operationtime EQU RAM_START + 03Eh
_powercnt EQU RAM_START + 03Fh
_returntimes EQU RAM_START + 040h
_rtccontrol EQU RAM_START + 041h
_rtcdate EQU RAM_START + 042h
_rtcday EQU RAM_START + 043h
_rtchr EQU RAM_START + 044h
_rtcmin EQU RAM_START + 045h
_rtcmonth EQU RAM_START + 046h
_rtcsec EQU RAM_START + 047h
_rtcyear EQU RAM_START + 048h
_runblower EQU RAM_START + 049h
_runcnt EQU RAM_START + 04Ah
_runlamp EQU RAM_START + 04Bh
_runmotor EQU RAM_START + 04Ch
_runpump EQU RAM_START + 04Dh
_runsec EQU RAM_START + 04Eh
_runspray EQU RAM_START + 04Fh
_runstopa EQU RAM_START + 050h
_runstopb EQU RAM_START + 051h
_runstopc EQU RAM_START + 052h
_runstopd EQU RAM_START + 053h
_runtimes EQU RAM_START + 054h
_runtraxx EQU RAM_START + 055h
_setcnt EQU RAM_START + 056h
_PORTL EQU PORTB
_PORTH EQU PORTC
_TRISL EQU TRISB
_TRISH EQU TRISC
#define _RST _PORTA_2
#define _IO _PORTC_1
#define _SCLK _PORTC_3
#define _SDA _PORTC_4
#define _PORTA_2 PORTA, 002h
#define _PORTC_1 PORTC, 001h
#define _PORTC_3 PORTC, 003h
#define _PORTC_4 PORTC, 004h
#define _OPTION_REG_7 OPTION_REG, 007h
#define _PORTE_2 PORTE, 002h
#define _PORTA_4 PORTA, 004h
#define _PORTA_5 PORTA, 005h
#define _PORTC_0 PORTC, 000h
#define _PORTB_4 PORTB, 004h
#define _PORTD_1 PORTD, 001h
#define _PORTD_2 PORTD, 002h
#define _PORTD_0 PORTD, 000h
#define _PORTB_5 PORTB, 005h
#define _PORTC_2 PORTC, 002h
#define _PORTB_6 PORTB, 006h
#define _PORTC_5 PORTC, 005h
#define _PORTB_7 PORTB, 007h
#define _PORTC_6 PORTC, 006h
#define _PORTC_7 PORTC, 007h
#define _PORTD_3 PORTD, 003h
#define _PORTB_0 PORTB, 000h
#define _PORTB_1 PORTB, 001h
#define _PORTB_2 PORTB, 002h
#define _PORTB_3 PORTB, 003h
; Constants.
_T2400 EQU 00000h
_T1200 EQU 00001h
_T9600 EQU 00002h
_T300 EQU 00003h
_N2400 EQU 00004h
_N1200 EQU 00005h
_N9600 EQU 00006h
_N300 EQU 00007h
_OT2400 EQU 00008h
_OT1200 EQU 00009h
_OT9600 EQU 0000Ah
_OT300 EQU 0000Bh
_ON2400 EQU 0000Ch
_ON1200 EQU 0000Dh
_ON9600 EQU 0000Eh
_ON300 EQU 0000Fh
_MSBPRE EQU 00000h
_LSBPRE EQU 00001h
_MSBPOST EQU 00002h
_LSBPOST EQU 00003h
_LSBFIRST EQU 00000h
_MSBFIRST EQU 00001h
_CLS EQU 00000h
_HOME EQU 00001h
_BELL EQU 00007h
_BKSP EQU 00008h
_TAB EQU 00009h
_CR EQU 0000Dh
_UnitOn EQU 00012h
_UnitOff EQU 0001Ah
_UnitsOff EQU 0001Ch
_LightsOn EQU 00014h
_LightsOff EQU 00010h
_Dim EQU 0001Eh
_Bright EQU 00016h
INCLUDE "ABC-001.MAC"
INCLUDE "PBPPIC14.LIB"
MOVE?CT 000h, _OPTION_REG_7
MOVE?CB 004h, ADCON1
LOW?T _PORTE_2
PAUSE?C 064h
MOVE?CB 000h, PORTA
MOVE?CB 033h, TRISA
MOVE?CB 000h, _almp
LOW?T _RST
LOW?T _SCLK
MOVE?CB 000h, _modecnt
MOVE?CB 000h, _setcnt
MOVE?CB 000h, _powercnt
MOVE?CB 000h, _runcnt
MOVE?CB 000h, _countcnt
MOVE?CB 000h, _incountcnt
MOVE?CB 001h, _runtimes
MOVE?CB 001h, _runsec
MOVE?CW 000h, _counts
MOVE?CW 000h, _incounts
MOVE?CB 000h, _cyear
MOVE?CB 000h, _cday
MOVE?CB 000h, _cmonth
MOVE?CB 000h, _chr
MOVE?CB 000h, _cmin
MOVE?CW 000h, _j
LABEL?L L00001
CMPGT?WCL _j, 006h, L00002
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREAD?B _onhr
I2CREAD?B _onm
I2CREAD?B _ofhr
I2CREADS?B _ofm
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00001
LABEL?L L00002
MOVE?CW 00Ah, _j
LABEL?L L00003
CMPGT?WCL _j, 00Eh, L00004
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREAD?W _onhrm
I2CREADS?W _ofhrm
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00003
LABEL?L L00004
MOVE?CW 014h, _j
LABEL?L L00005
CMPGT?WCL _j, 016h, L00006
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREAD?B _runtimes
I2CREADS?B _runsec
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00005
LABEL?L L00006
MOVE?CW 01Eh, _j
LABEL?L L00007
CMPGT?WCL _j, 020h, L00008
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREADS?W _counts
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00007
LABEL?L L00008
MOVE?CW 028h, _j
LABEL?L L00009
CMPGT?WCL _j, 02Ah, L00010
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREADS?W _incounts
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00009
LABEL?L L00010
MOVE?CW 050h, _j
LABEL?L L00011
CMPGT?WCL _j, 051h, L00012
I2CDATA?T _SDA
I2CCLOCK?T _SCLK
I2CWRITE?C 0A0h
I2CWRITE?W _j
I2CREADS?B _almp
PAUSE?C 00Ah
NEXT?WCL _j, 002h, L00011
LABEL?L L00012
MOVE?CB 001h, PORTB
MOVE?CB 0FFh, TRISB
MOVE?CT 001h, _PORTA_4
MOVE?CT 001h, _PORTA_5
MOVE?CT 001h, _PORTC_0
MOVE?CB 001h, TRISC
LABEL?L _main
GOSUB?L _init
GOSUB?L _mode
GOSUB?L _gettime
GOSUB?L _tohex
GOSUB?L _waitinglcd
CMPEQ?BCL _almp, 001h, _traxxforwarderror
CMPEQ?BCL _almp, 002h, _traxxreturnerror
CMPNE?TCL _PORTB_4, 000h, L00013
PAUSE?C 003E8h
CMPEQ?TCL _PORTB_4, 000h, _cleaning
LABEL?L L00013
GOTO?L _main
LABEL?L _cleaning
HIGH?T _PORTD_1
PAUSE?C 01388h
HIGH?T _PORTD_2
PAUSE?C 01388h
MOVE?CB 001h, _n
LABEL?L L00015
CMPGT?BBL _n, _runtimes, L00016
LCDOUT?C 0FEh
LCDOUT?C 001h
LCDOUT?C 020h
LCDOUT?C 020h
LCDOUT?C 057h
LCDOUT?C 04Fh
LCDOUT?C 052h
LCDOUT?C 04Bh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 020h
LCDOUT?C 04Dh
LCDOUT?C 04Fh
LCDOUT?C 044h
LCDOUT?C 045h
LCDOUT?C 0FEh
LCDOUT?C 0C0h
LCDOUT?C 043h
LCDOUT?C 04Ch
LCDOUT?C 045h
LCDOUT?C 041h
LCDOUT?C 04Eh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
PAUSE?C 0012Ch
HIGH?T _PORTD_0
PAUSE?C 007D0h
MOVE?CB 000h, _forwardtimes
MOVE?CB 000h, _returntimes
LABEL?L _forwardcleaning
LCDOUT?C 0FEh
LCDOUT?C 001h
LCDOUT?C 046h
LCDOUT?C 04Fh
LCDOUT?C 052h
LCDOUT?C 057h
LCDOUT?C 041h
LCDOUT?C 052h
LCDOUT?C 044h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 0FEh
LCDOUT?C 0C0h
LCDOUT?C 043h
LCDOUT?C 04Ch
LCDOUT?C 045h
LCDOUT?C 041h
LCDOUT?C 04Eh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUTCOUNT?C 001h
LCDOUTNUM?B _n
LCDOUTDEC?
PAUSE?C 0012Ch
CMPLE?BCL _forwardtimes, 038h, L00017
GOTO?L _traxxforwarderror
LABEL?L L00017
ADD?BCB _forwardtimes, 001h, _forwardtimes
CMPNE?TCL _PORTB_5, 000h, L00019
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00021
GOTO?L _cleaningstop
LABEL?L L00021
LABEL?L L00019
LABEL?L _rightturn
CMPNE?TCL _PORTB_5, 000h, L00023
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00025
GOTO?L _cleaningstop
LABEL?L L00025
LABEL?L L00023
HIGH?T _PORTC_2
CMPNE?TCL _PORTB_6, 000h, L00027
LOW?T _PORTC_2
PAUSE?C 003E8h
LABEL?L _leftturn
CMPNE?TCL _PORTB_5, 000h, L00029
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00031
GOTO?L _cleaningstop
LABEL?L L00031
LABEL?L L00029
HIGH?T _PORTC_5
CMPNE?TCL _PORTB_7, 000h, L00033
LOW?T _PORTC_5
HIGH?T _PORTC_6
MOVE?CB 001h, _i
LABEL?L L00035
CMPGT?BCL _i, 00Ah, L00036
CMPEQ?TCL _PORTA_4, 000h, _returncleaning
PAUSE?C 064h
NEXT?BCL _i, 001h, L00035
LABEL?L L00036
LOW?T _PORTC_6
PAUSE?C 003E8h
GOTO?L L00034
LABEL?L L00033
GOTO?L _leftturn
LABEL?L L00034
GOTO?L L00028
LABEL?L L00027
GOTO?L _rightturn
LABEL?L L00028
GOTO?L _forwardcleaning
LABEL?L _returncleaning
LOW?T _PORTC_6
LCDOUT?C 0FEh
LCDOUT?C 001h
LCDOUT?C 052h
LCDOUT?C 045h
LCDOUT?C 054h
LCDOUT?C 055h
LCDOUT?C 052h
LCDOUT?C 04Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 0FEh
LCDOUT?C 0C0h
LCDOUT?C 043h
LCDOUT?C 04Ch
LCDOUT?C 045h
LCDOUT?C 041h
LCDOUT?C 04Eh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUTCOUNT?C 001h
LCDOUTNUM?B _n
LCDOUTDEC?
PAUSE?C 0012Ch
CMPLE?BCL _returntimes, 038h, L00037
GOTO?L _traxxreturnerror
LABEL?L L00037
ADD?BCB _returntimes, 001h, _returntimes
CMPNE?TCL _PORTB_5, 000h, L00039
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00041
GOTO?L _cleaningstop
LABEL?L L00041
LABEL?L L00039
LABEL?L _turnright
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00043
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00045
GOTO?L _cleaningstop
LABEL?L L00045
LABEL?L L00043
HIGH?T _PORTC_2
CMPNE?TCL _PORTB_6, 000h, L00047
LOW?T _PORTC_2
PAUSE?C 003E8h
LABEL?L _turnleft
CMPNE?TCL _PORTB_5, 000h, L00049
PAUSE?C 003E8h
CMPNE?TCL _PORTB_5, 000h, L00051
GOTO?L _cleaningstop
LABEL?L L00051
LABEL?L L00049
HIGH?T _PORTC_5
CMPNE?TCL _PORTB_7, 000h, L00053
LOW?T _PORTC_5
HIGH?T _PORTC_7
MOVE?CB 001h, _i
LABEL?L L00055
CMPGT?BCL _i, 00Ah, L00056
CMPEQ?TCL _PORTA_5, 000h, _cleaningtimes
PAUSE?C 064h
NEXT?BCL _i, 001h, L00055
LABEL?L L00056
LOW?T _PORTC_7
PAUSE?C 003E8h
GOTO?L L00054
LABEL?L L00053
GOTO?L _turnleft
LABEL?L L00054
GOTO?L L00048
LABEL?L L00047
GOTO?L _turnright
LABEL?L L00048
GOTO?L _returncleaning
LABEL?L _cleaningtimes
LOW?T _PORTC_7
PAUSE?C 003E8h
NEXT?BCL _n, 001h, L00015
LABEL?L L00016
LCDOUT?C 0FEh
LCDOUT?C 001h
LCDOUT?C 020h
LCDOUT?C 020h
LCDOUT?C 057h
LCDOUT?C 04Fh
LCDOUT?C 052h
LCDOUT?C 04Bh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 020h
LCDOUT?C 04Dh
LCDOUT?C 04Fh
LCDOUT?C 044h
LCDOUT?C 045h
LCDOUT?C 0FEh
LCDOUT?C 0C0h
LCDOUT?C 053h
LCDOUT?C 054h
LCDOUT?C 04Fh
LCDOUT?C 050h
LCDOUT?C 050h
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
PAUSE?C 0012Ch
HIGH?T _PORTC_5
CMPNE?TCL _PORTB_7, 000h, L00057
LOW?T _PORTC_5
LABEL?L L00057
LOW?T _PORTD_0
MOVE?CB 001h, _i
LABEL?L L00059
CMPGT?BCL _i, 024h, L00060
PAUSE?C 01388h
NEXT?BCL _i, 001h, L00059
LABEL?L L00060
LOW?T _PORTD_1
PAUSE?C 003E8h
LOW?T _PORTD_2
PAUSE?C 003E8h
CMPLE?BCL _runsec, 001h, L00061
LCDOUT?C 0FEh
LCDOUT?C 001h
LCDOUT?C 020h
LCDOUT?C 020h
LCDOUT?C 057h
LCDOUT?C 04Fh
LCDOUT?C 052h
LCDOUT?C 04Bh
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 020h
LCDOUT?C 04Dh
LCDOUT?C 04Fh
LCDOUT?C 044h
LCDOUT?C 045h
LCDOUT?C 0FEh
LCDOUT?C 0C0h
LCDOUT?C 053h
LCDOUT?C 050h
LCDOUT?C 052h
LCDOUT?C 041h
LCDOUT?C 059h
LCDOUT?C 049h
LCDOUT?C 04Eh
LCDOUT?C 047h
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
LCDOUT?C 02Eh
PAUSE?C 0012Ch
HIGH?T _PORTD_3
MOVE?CB 001h, _k
LABEL?L L00063
CMPGT?BBL _k, _runsec, L00064
PAUSE?C 003E8h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -