gnupic: gpasm quirks


Previous by date: 20 Jun 2002 11:22:23 -0000 Re: gpasm quirks, Linas Vepstas
Next by date: 20 Jun 2002 11:22:23 -0000 Is this thing on?, Tim ODriscoll
Previous in thread: 20 Jun 2002 11:22:23 -0000 Re: gpasm quirks, Linas Vepstas
Next in thread:

Subject: Re: gpasm quirks
From: Tim ODriscoll ####@####.####
Date: 20 Jun 2002 11:22:23 -0000
Message-Id: <Pine.LNX.4.33.0206201141450.1124-100000@cube.stokepogesway.net>

On Wed, 19 Jun 2002, Craig Franklin wrote:
> I know you are using it for pins but are you seeing something like this?
> <snip>
> You need to either use macros or place myVar in data memory.  The
> following is a example of how it could be accomplished using macros.
>
Hi again,

I've been converting all my functions into macro's this morning, and I
seem to have got them very wrong.. Is it possible to use 'call' and
'goto' statements in macro's? And how about nested macro's?.. I think this
could be my problem..

I'd like to go the easiest route, and that would seem to be putting myVar
into data memory, as suggested. Unfortunately, as I'm using myVar to
represent which pin of a port I'm addressing, I get this warning from
gpasm, "Argument out of range. Least significant bits used.".. Although it
still compiles the hex file, my program doesn't behave properly on the
chip.

Perhaps a more detailed example is in order:
;==============================
myVar	equ	0x1d
;------------------------------
loop	movlw	d'4'		; I want to talk to pin4
	movwf	myVar
	call	LED_on
	call	delay
	call	LED_off

	movlw	d'5'		; Now pin5
	movwf	myVar
	call	LED_on
	call	delay
	call	LED_off

	goto	loop
;------------------------------
LED_on	bsf	portb,myVar	; Switch specified LED on
	return
;------------------------------
LED_off	bcf	portb,myVar	; Switch specified LED off
	return
;==============================

Would a macro be a better solution to this, or am I using myVar in the
wrong way?

Cheers,

Tim


Previous by date: 20 Jun 2002 11:22:23 -0000 Re: gpasm quirks, Linas Vepstas
Next by date: 20 Jun 2002 11:22:23 -0000 Is this thing on?, Tim ODriscoll
Previous in thread: 20 Jun 2002 11:22:23 -0000 Re: gpasm quirks, Linas Vepstas
Next in thread:


Powered by ezmlm-browse 0.20.