; CC5X Version 3.1I, Copyright (c) B Knudsen Data ; C compiler for the PICmicro family ; ************ 27. Oct 2003 18:10 ************* processor 16F873 radix DEC PORTA EQU 0x05 TRISA EQU 0x85 PORTB EQU 0x06 TRISB EQU 0x86 Carry EQU 0 Zero_ EQU 2 RP0 EQU 5 RP1 EQU 6 PORTC EQU 0x07 TRISC EQU 0x87 ADCON1 EQU 0x9F x EQU 0x20 y EQU 0x22 z EQU 0x23 GOTO main ; FILE D:\Pics\code\16F873\Blink\Blink.c ;/* ; ; 6/24/03 ; Copyright Spark Fun Electronics 2003© ; ; Classic Blinking Test Routine for the 28 Pin PIC16F873A ; ; Flashes all pins on PIC - 20MHz operations ; ;*/ ; ;//#define ICD_DEBUG ; ;#include "d:\Pics\c\16F873.h" // device dependent definitions ; ;#pragma config |= 0x3F32 //HS Oscillator ;//#pragma config|= 0x3732 //HS Oscillator Debugging Mode ; ;void delay_ms(uns16); ; ;void main() ;{ main ; PORTA = 0b.0000.0000; BCF 0x03,RP0 BCF 0x03,RP1 CLRF PORTA ; TRISA = 0b.0000.0000; //0 = Output, 1 = Input BSF 0x03,RP0 CLRF TRISA ; ; PORTB = 0b.0000.0000; BCF 0x03,RP0 CLRF PORTB ; TRISB = 0b.0000.0000; //0 = Output, 1 = Input BSF 0x03,RP0 CLRF TRISB ; ; PORTC = 0b.0000.0000; BCF 0x03,RP0 CLRF PORTC ; TRISC = 0b.0000.0000; //0 = Output, 1 = Input BSF 0x03,RP0 CLRF TRISC ; ; //Turn Port A to Digital Outputs ; ADCON1 = 0b.0000.0111; MOVLW .7 MOVWF ADCON1 ; ; while(1) ; { ; ; PORTA = 0xFF; BCF 0x03,RP0 m001 MOVLW .255 MOVWF PORTA ; PORTB = 0xFF; MOVWF PORTB ; PORTC = 0xFF; MOVWF PORTC ; delay_ms(1000); MOVLW .232 MOVWF x MOVLW .3 MOVWF x+1 CALL delay_ms ; ; PORTA = 0x00; CLRF PORTA ; PORTB = 0x00; CLRF PORTB ; PORTC = 0x00; CLRF PORTC ; delay_ms(1000); MOVLW .232 MOVWF x MOVLW .3 MOVWF x+1 CALL delay_ms ; } GOTO m001 ; ;} ; ;//General short delay ;void delay_ms(uns16 x) ;{ delay_ms ; uns8 y, z; ; for ( ; x > 0 ; x--) m002 MOVF x,W IORWF x+1,W BTFSC 0x03,Zero_ GOTO m007 ; for ( y = 0 ; y < 4 ; y++) CLRF y m003 MOVLW .4 SUBWF y,W BTFSC 0x03,Carry GOTO m006 ; for ( z = 0 ; z < 176 ; z++); CLRF z m004 MOVLW .176 SUBWF z,W BTFSC 0x03,Carry GOTO m005 INCF z,1 GOTO m004 m005 INCF y,1 GOTO m003 m006 DECF x,1 INCF x,W BTFSC 0x03,Zero_ DECF x+1,1 GOTO m002 m007 RETURN ORG 0x2007 DATA 3F32H END ; *** KEY INFO *** ; 0x0023 P0 24 word(s) 1 % : delay_ms ; 0x0001 P0 34 word(s) 1 % : main ; RAM usage: 4 bytes (4 local), 188 bytes free ; Maximum call level: 1 ; Codepage 0 has 59 word(s) : 2 % ; Codepage 1 has 0 word(s) : 0 % ; Total of 59 code words (1 %)