📄 dacs.lst
字号:
MPASM 03.70.01 Released DACS.ASM 2-16-2006 20:21:29 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;***************************************************
00002 ; DACS.ASM MPB 11-2-06
00003 ;
00004 ; Test program for parallel
00005 ; and serial D/A Converters
00006 ; DAC0808 & MCP4921
00007 ;
00008 ; Proteus simulation DACS.DSN
00009 ;
00010 ;***************************************************
00011
00012 PROCESSOR 16F877A
00013 INCLUDE "P16F877A.INC"
00001 LIST
00002 ; P16F877A.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
00398 LIST
2007 3731 00014 __CONFIG 0X3731
00015
00000020 00016 Hibyte EQU 020 ; SPI data high byte
00000021 00017 Lobyte EQU 021 ; SPI data low byte
00018
0000 00019 ORG 0 ; Load at default range
0000 0000 00020 NOP ; for ICD operations
00021
00022 ; Initialise parallel and serial ports -------------
00023
0001 1683 1303 00024 BANKSEL TRISD
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0003 0188 00025 CLRF TRISD ; Parallel port
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0004 1287 00026 BCF TRISC,5 ; Serial data
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0005 1187 00027 BCF TRISC,3 ; Serial clock
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0006 1007 00028 BCF TRISC,0 ; Chip select
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0007 0194 00029 CLRF SSPSTAT ; default SPI mode
00030
0008 1283 1303 00031 BANKSEL PORTD
000A 0188 00032 CLRF PORTD ; zero PDAC
000B 0194 00033 CLRF SSPCON ; default SPI mode
00034
000C 3039 00035 MOVLW B'00111001' ; Initial SDAC data
000D 00A0 00036 MOVWF Hibyte ; and store
000E 30FF 00037 MOVLW B'11111111'
000F 00A1 00038 MOVWF Lobyte
00039
00040 ; Check buttons ------------------------------------
00041
0010 1886 00042 up BTFSC PORTB,1 ; Test UP button
0011 2816 00043 GOTO down ; and jump if off
Message[305]: Using default destination of 1 (file).
0012 0A88 00044 INCF PORTD ; Increment PDAC
MPASM 03.70.01 Released DACS.ASM 2-16-2006 20:21:29 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
Message[305]: Using default destination of 1 (file).
0013 0AA0 00045 INCF Hibyte ; Increment SDAC
0014 1C86 00046 waitup BTFSS PORTB,1 ; Wait for..
0015 2814 00047 GOTO waitup ; button release
00048
0016 1906 00049 down BTFSC PORTB,2 ; Test DOWN button
0017 281C 00050 GOTO spi ; and jump if off
Message[305]: Using default destination of 1 (file).
0018 0388 00051 DECF PORTD ; Decrement PDAC
Message[305]: Using default destination of 1 (file).
0019 03A0 00052 DECF Hibyte ; Decrement SDAC
001A 1D06 00053 waitdo BTFSS PORTB,2 ; Wait for..
001B 281A 00054 GOTO waitdo ; button release
00055
00056 ; Send 16-bit data to SDAC via SPI port ------------
00057
001C 1694 00058 spi BSF SSPCON,SSPEN ; Enable SPI port
00059
001D 1007 00060 BCF PORTC,0 ; Enable SDAC chip
001E 0820 00061 MOVF Hibyte,W ; Get high data
001F 0093 00062 MOVWF SSPBUF ; and send it
0020 1D8C 00063 waithi BTFSS PIR1,SSPIF ; Wait for..
0021 2820 00064 GOTO waithi ; SPI interrupt
0022 118C 00065 BCF PIR1,SSPIF ; Reset interrupt
00066
0023 0821 00067 MOVF Lobyte,W ; Get low data
0024 0093 00068 MOVWF SSPBUF ; and send it
0025 1D8C 00069 waitlo BTFSS PIR1,SSPIF ; Wait for..
0026 2825 00070 GOTO waitlo ; SPI interrupt
0027 118C 00071 BCF PIR1,SSPIF ; Reset interrupt
00072
0028 1407 00073 BSF PORTC,0 ; Disable SDAC chip
00074
00075 ; Run output loop until reset ---------------------
00076
0029 1806 00077 BTFSC PORTB,0 ; Test run button
002A 2810 00078 GOTO up ; and repeat loop
00079
Message[305]: Using default destination of 1 (file).
002B 0A88 00080 run INCF PORTD ; Increment PDAC
002C 282B 00081 GOTO run
00082
00083 END ;---------------------------------------
MPASM 03.70.01 Released DACS.ASM 2-16-2006 20:21:29 PAGE 3
SYMBOL TABLE
LABEL VALUE
ACKDT 00000005
ACKEN 00000004
ACKSTAT 00000006
ADCON0 0000001F
ADCON1 0000009F
ADCS0 00000006
ADCS1 00000007
ADDEN 00000003
ADFM 00000007
ADIE 00000006
ADIF 00000006
ADON 00000000
ADRESH 0000001E
ADRESL 0000009E
BCLIE 00000003
BCLIF 00000003
BF 00000000
BRGH 00000002
C 00000000
C1INV 00000004
C1OUT 00000006
C2INV 00000005
C2OUT 00000007
CCP1CON 00000017
CCP1IE 00000002
CCP1IF 00000002
CCP1M0 00000000
CCP1M1 00000001
CCP1M2 00000002
CCP1M3 00000003
CCP1X 00000005
CCP1Y 00000004
CCP2CON 0000001D
CCP2IE 00000000
CCP2IF 00000000
CCP2M0 00000000
CCP2M1 00000001
CCP2M2 00000002
CCP2M3 00000003
CCP2X 00000005
CCP2Y 00000004
CCPR1H 00000016
CCPR1L 00000015
CCPR2H 0000001C
CCPR2L 0000001B
CHS0 00000003
CHS1 00000004
CHS2 00000005
CIS 00000003
CKE 00000006
CKP 00000004
CM0 00000000
CM1 00000001
MPASM 03.70.01 Released DACS.ASM 2-16-2006 20:21:29 PAGE 4
SYMBOL TABLE
LABEL VALUE
CM2 00000002
CMCON 0000009C
CMIE 00000006
CMIF 00000006
CREN 00000004
CSRC 00000007
CVR0 00000000
CVR1 00000001
CVR2 00000002
CVR3 00000003
CVRCON 0000009D
CVREN 00000007
CVROE 00000006
CVRR 00000005
D 00000005
DATA_ADDRESS 00000005
DC 00000001
D_A 00000005
EEADR 0000010D
EEADRH 0000010F
EECON1 0000018C
EECON2 0000018D
EEDATA 0000010C
EEDATH 0000010E
EEIE 00000004
EEIF 00000004
EEPGD 00000007
F 00000001
FERR 00000002
FSR 00000004
GCEN 00000007
GIE 00000007
GO 00000002
GO_DONE 00000002
Hibyte 00000020
I2C_DATA 00000005
I2C_READ 00000002
I2C_START 00000003
I2C_STOP 00000004
IBF 00000007
IBOV 00000005
INDF 00000000
INTCON 0000000B
INTE 00000004
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -