; CC5X Version 3.1I, Copyright (c) B Knudsen Data ; C compiler for the PICmicro family ; ************ 27. Oct 2003 18:10 ************* processor 16F676 radix DEC PORTA EQU 0x05 TRISA EQU 0x85 Carry EQU 0 Zero_ EQU 2 RP0 EQU 5 PORTC EQU 0x07 TRISC EQU 0x87 x EQU 0x20 y EQU 0x22 z EQU 0x23 GOTO main ; FILE D:\Pics\code\16F676\Blink\Blink.c ;/* ; ; 6/24/03 ; Copyright Spark Fun Electronics 2003© ; ; Classic Blinking Test Routine for the 14 Pin PIC16F676 ; ; Flashes all pins on PIC - 20MHz operations ; ;*/ ; ;#include "d:\Pics\c\16F676.h" // device dependent definitions ; ;//#pragma config |= 0x3184 //Internal RC ;#pragma config |= 0x3182 //HS ; ;void delay_ms(uns16); ; ;void main() ;{ main ; ; PORTA = 0b.0000.0000; BCF 0x03,RP0 CLRF PORTA ; TRISA = 0b.0000.0000; //0 = Output, 1 = Input BSF 0x03,RP0 CLRF TRISA ; ; PORTC = 0b.0000.0000; BCF 0x03,RP0 CLRF PORTC ; TRISC = 0b.0000.0000; //0 = Output, 1 = Input BSF 0x03,RP0 CLRF TRISC ; ; while(1) ; { ; PORTA = 0xFF; BCF 0x03,RP0 m001 MOVLW .255 MOVWF PORTA ; PORTC = 0xFF; MOVWF PORTC ; delay_ms(1000); MOVLW .232 MOVWF x MOVLW .3 MOVWF x+1 CALL delay_ms ; ; PORTA = 0x00; CLRF PORTA ; 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 3182H END ; *** KEY INFO *** ; 0x001A 24 word(s) 1 % : delay_ms ; 0x0001 25 word(s) 1 % : main ; RAM usage: 4 bytes (4 local), 60 bytes free ; Maximum call level: 1 ; Total of 50 code words (4 %)