;************************************************************** ; RAMP.ASM 13MAR04 ;************************************************************** ; ; This PIC16F84 program tests the R-2R D/A converter of the ; two-tone generator. It produces a ramp that will show defects ; ;************************************************************** LIST P=16F84, F=INHX8M #include __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC ;************************************************************** ; f_osc = 1.5 MHz yields cycle time of 2.7 µs ;************************************************************** ; Equates RESET_V EQU 0x00 ; Address of RESET Vector OSC_FREQ EQU D'1500000' ; Oscillator Frequency is 1.5 MHz ; Registers DA_DATA EQU 0x0F ;************************************************************** ; Begin Program ;************************************************************** ORG RESET_V ; RESET vector location RESET GOTO START ORG 4 ; INT vector ;************************************************************** ; Initialization Routine ; ;************************************************************** START ; POWER_ON Reset (Beginning of program) CLRF STATUS ; Do initialization, Select bank 0 CLRF INTCON ; Clear int-flags, Disable interrupts CLRF PCLATH ; Keep in lower 2KByte CLRF PORTA ; ALL PORT output should output Low. CLRF PORTB BSF STATUS, RP0 ; Select bank 1 MOVLW 0xff CLRF TRISB ; RB7-0 Outputs MOVWF TRISA ; RA4-0 Inputs BCF STATUS, RP0 ; Select bank 0 ;************************************************************** ; Avanti! ;************************************************************** CLRF DA_DATA LOOP INCF DA_DATA, 1 MOVF DA_DATA, 0 MOVWF PORTB GOTO LOOP END