; CC8E Version 1.0I, Copyright (c) B Knudsen Data ; C compiler for the PIC18 microcontrollers ; ************ 27. Oct 2003 16:45 ************* processor PIC18F252 radix DEC ADCON1 EQU 0xFC1 TRISC EQU 0xF94 TRISB EQU 0xF93 TRISA EQU 0xF92 PORTC EQU 0xF82 PORTB EQU 0xF81 PORTA EQU 0xF80 x EQU 0x00 y EQU 0x02 z EQU 0x03 GOTO main ; FILE D:\Pics\code\18F252\Blink\Blink.c ;/* ; ; 10-14-03 ; Copyright Spark Fun Electronics 2003© ; ; Classic Blinking Test Routine for the 28 Pin PIC18F252 ; ; Flashes all pins on PIC - 20MHz operations ; ;*/ ; ;#include "d:\Pics\c\cc8e\18F252.h" // Device dependent definitions ; ;#pragma config[1] = 0b.0010.0010 //HS Oscillator ;#pragma config[2] = 0b.0000.0000 //Brown out off, PWRT On ;#pragma config[3] = 0b.0000.0000 //WDT Off ;#pragma config[6] = 0b.1000.0000 //ICD Off, LVP Off, Stack Overflow Reset off ; ;void delay_ms(uns16); ; ;void main() ;{ main ; PORTA = 0b.0000.0000; CLRF PORTA,0 ; TRISA = 0b.0000.0000; //0 = Output, 1 = Input CLRF TRISA,0 ; ; PORTB = 0b.0000.0000; CLRF PORTB,0 ; TRISB = 0b.0000.0000; //0 = Output, 1 = Input CLRF TRISB,0 ; ; PORTC = 0b.0000.0000; CLRF PORTC,0 ; TRISC = 0b.0000.0000; //0 = Output, 1 = Input CLRF TRISC,0 ; ; //Turn Port A to Digital Outputs ; ADCON1 = 0b.0000.0111; MOVLW 7 MOVWF ADCON1,0 ; ; while(1) ; { ; ; PORTA = 0xFF; m001 SETF PORTA,0 ; PORTB = 0xFF; SETF PORTB,0 ; PORTC = 0xFF; SETF PORTC,0 ; delay_ms(1000); MOVLW 232 MOVWF x,0 MOVLW 3 MOVWF x+1,0 RCALL delay_ms ; ; PORTA = 0x00; CLRF PORTA,0 ; PORTB = 0x00; CLRF PORTB,0 ; PORTC = 0x00; CLRF PORTC,0 ; delay_ms(1000); MOVLW 232 MOVWF x,0 MOVLW 3 MOVWF x+1,0 RCALL delay_ms ; } BRA m001 ; ;} ; ;//General short delay ;void delay_ms(uns16 x) ;{ delay_ms ; uns8 y, z; ; for ( ; x > 0 ; x--) m002 MOVF x,W,0 IORWF x+1,W,0 BZ m007 ; for ( y = 0 ; y < 4 ; y++) CLRF y,0 m003 MOVLW 4 CPFSLT y,0 BRA m006 ; for ( z = 0 ; z < 176 ; z++); CLRF z,0 m004 MOVLW 176 CPFSLT z,0 BRA m005 INCF z,1,0 BRA m004 m005 INCF y,1,0 BRA m003 m006 DECF x,1,0 MOVLW 0 SUBWFB x+1,1,0 BRA m002 ;} m007 RETURN ORG 0x300000 DATA 0x22FF DATA 0x0000 ORG 0x300006 DATA 0xFF80 END ; *** KEY INFO *** ; 0x00001B 20 word(s) 0 % : delay_ms ; 0x000002 25 word(s) 0 % : main ; RAM usage: 4 bytes (4 local), 1532 bytes free ; Maximum call level: 1 ; Total of 47 code words (0 %)