; CC8E Version 1.0I, Copyright (c) B Knudsen Data ; C compiler for the PIC18 microcontrollers ; ************ 27. Oct 2003 16:46 ************* processor PIC18F452 radix DEC TRISB EQU 0xF93 TRISA EQU 0xF92 PORTB EQU 0xF81 PORTA EQU 0xF80 x EQU 0x00 y EQU 0x02 z EQU 0x03 GOTO main ; FILE D:\Pics\code\18F1320\Blink\Blink.c ;/* ; ; 10-15-03 ; Copyright Spark Fun Electronics 2003© ; ; Classic Blinking Test Routine for the 18 Pin PIC18F1320 ; ; Flashes all pins on PIC - 20MHz operations ; ;*/ ; ;#include "d:\Pics\c\cc8e\18F452.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 ; ; while(1) ; { ; PORTA = 0x00; m001 CLRF PORTA,0 ; PORTB = 0xFF; SETF PORTB,0 ; delay_ms(1000); MOVLW 232 MOVWF x,0 MOVLW 3 MOVWF x+1,0 RCALL delay_ms ; ; PORTA = 0xFF; SETF PORTA,0 ; PORTB = 0x00; CLRF PORTB,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 *** ; 0x000015 20 word(s) 0 % : delay_ms ; 0x000002 19 word(s) 0 % : main ; RAM usage: 4 bytes (4 local), 1532 bytes free ; Maximum call level: 1 ; Total of 41 code words (0 %)