gnupic: Not being able to use variables on pic18fxx50
Subject:
Not being able to use variables on pic18fxx50
From:
Lope Vega ####@####.####
Date:
18 Aug 2008 16:21:29 -0000
Message-Id: <728257.33837.qm@web28203.mail.ukl.yahoo.com>
Hi list!
I'm new to microcontrolers, and I'm tying to program a pic18f4550,
under gnu/linux and/or freebsd.
The main problem I'm finding is with variables. I can't make them work.
gpasm would say "Warning [231] No memory has been reserved by this instruction." when it sees:
myvar res 1
I tried with:
myvar res 2
with no succesful results, I've tried something like this:
;; setup processor and output format
list p=p18f4550,f=inhx32
include <p18f4550.inc>
;; disable watchdog timer
config wdt = off
;; chip will use internal oscillator (4 mhz)
config fosc = intoscio_ec
org 0
goto main
;; let `count1' and `count2' live after the previous
;; `goto' instruction on code-memory, where shouldn't
;; clash with program's instructions
count1 equ 0x6
count2 equ 0x8
;; offset our program by 32 bytes, so we have space for the previous and other variables I might want to use
org 0x20
main:
.....
After I started "decoding" hex-files' dumps, doesn't work either, so I'm a bit lost, have tried even more different approaches but I can't get the pic to "respect" and work with any variables other than constants.
This is an example program I wanted to start with:
;; setup processor and output format
list p=pic18f4550,f=inhx32
include <p18f4550.inc>
;; disable watchdog timer
config wdt = off
;; chip will use internal oscillator (4 mhz)
config fosc = intoscio_ec
org 0
counter res 2
main:
;; portd will be all outputs
clrf PORTD
clrf TRISD
restart:
;; give the memory address location `0x0' the value `5'
movlw 5
movwf 0x0
loop:
;; decrement this value till it's 0, what will cause the
decfsz 0x0, f
goto loop
btg PORTD, RD1
goto restart
end
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.es