gnupic: __config directive w/16f628a
Subject:
Re: __config directive w/16f628a
From:
Craig Franklin ####@####.####
Date:
21 Mar 2004 02:18:48 +0000
Message-Id: <1079835491.2530.7.camel@r2d2>
On Sat, 2004-03-20 at 02:47, Pete wrote:
> Hello. Has anyone had trouble using the __config directive with the 16f628a
> and gpasm-0.12 ? I tried to compile the following and get this error:
> int_osc.asm:24:Error [103] parse error
> It does compile with mpasm. If I change the chip to plain 16f628 gpasm will
> compile it also. Have tried different config statements also. Appreciate any
> suggestions, Thanks Pete.
It is not a problem with config or the processor. There is an error in
the include parsing. As a work around, insert a blank line after the
include. I will fix this later tonight.
>
> ;; int_osc.asm - version 1
> ;; test 16f628A
> ;; cycle leds at portb for 1 second intervals
> ;; to test internal oscillator of 16F628A
>
> ;; configuration:
> ;; pic16F628A with internal 4mhz oscillator
> ;; watchdog timer off, power up timer and
> ;; brown out detection on
>
> ;; hardware:
> ;; Port A = bits 0, 1, 2, 3, 4, 6, 7 = outputs, low
> ;; bit 5 = input, high
> ;; Port B = bits 0 thru 7 = outputs, low
> ;____________________________________________________________________
>
> ; Configuration
> ;____________________________________________________________________
>
> list p=16f628a
> include "p16f628a.inc"
> __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BOREN_ON
> & _LVP_OFF & _CP_OFF & _DATA_CP_OFF
>
> ;____________________________________________________________________
>
> ; Registers
> ;____________________________________________________________________
>
> CBLOCK 0x020 ; register start value
> qua_sec ; delay registers
> mil_sec
> micro_sec
> ENDC
> ;____________________________________________________________________
>
> ; Start
> ;____________________________________________________________________
>
> ;; setup ports
> org 0 ; start address = 0
> bcf STATUS,RP0 ; select bank 0
> clrf PORTA ; port A data latch values
> movlw D'7' ; comparators off
> movwf CMCON ; enable port for I/O
> clrf PORTB ; port B data latch values
> bsf STATUS,RP0 ; select bank 1
> movlw B'00100000' ; 0 = output
> movwf TRISA ; set port A ddr
> movlw B'00000000' ; 0 = output
> movwf TRISB ; set port B ddr
> bcf STATUS,RP0 ; select bank 0
> ;; cycle leds
> bsf STATUS,C ; set the carry bit
> cycle_leds
> rrf PORTB,f ; set next bit
> call delay_onesec ; led on
> goto cycle_leds ; cycle leds on, bits 0 - 7
> ;___________________________________________________________________
>
> ; Subroutines
> ;__________________________________________________________________
>
> ; delay_onesec
>
> delay_onesec
> movlw D'4'
> movwf qua_sec
> delay_seconds
> clrf micro_sec
> onesec_qua
> movlw D'244'
> movwf mil_sec
> onesec_loop
> nop
> decfsz micro_sec,f
> goto onesec_loop
> decfsz mil_sec,f
> goto onesec_loop
> decfsz qua_sec,f
> goto onesec_qua
> return
> ;___________________________________________________________________
>
> ;delay_seconds
> ;test 1 - qua_sec = 4
> ;cycles = 1001398
> ;seconds = 1.001398
> ;__________________________________________________________________
>
> end
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>