I go a bit further with this method and use a previous project as a template.
I often find myself having the same subroutines in a lot of programs.
This has the advantage of having fully tested code already written.
http://www.ckp-railways.talktalk.net/pcbcad21.htm
John Samperi <samperi@ampertronics.com.au> wrote: At 03:27 AM 19/01/2007, you wrote:
> > That is why I have adopted the practice of installing a
> > full vector table, with all the standard labels and filling
> > the unused ones with RETI or jump to an error handler.
A practise that I have also adopted. With the AVR I have developed
interrupt vector and interrupt service routines files for each type
of processor that I use. With the vector file I only need to .include
the file into my multi file projects without changes. Following the
problem a well know member of this list had with jmp and rjmp :) in
the table I simply copy the vectors from the data sheet, add a ISR_
keyword to each vector and save it. (so far the pdfs used are not
copy protected) ie (part of the int_v_tiny2313.asm file)
;Reset and Interrupt vectors Tiny2313
;
.cseg
;0x0000
rjmp RESET ;Reset Handler
;0x0001
rjmp ISR_INT0 ;External Interrupt0 Handler
;0x0002
rjmp ISR_INT1 ;External Interrupt1 Handler
The standard interrupt service routines have been styled on examples
found on David's old web page when I was first looking at the AVR.
(part of the int_s_tiny2313.asm file, save_sreg is usually r15)
;REMEMBER to save any registers you may want to use here!
;Int. flags are automatically cleared.
.cseg
;
ISR_INT0:
in save_sreg,SREG ;Save Status register
;Do something here
out SREG,save_sreg ;Restore Status register
reti
;
ISR_INT1:
in save_sreg,SREG ;Save Status register
;Do something here
out SREG,save_sreg ;Restore Status register
all I need to do with the service file is to copy it into a file
which is specific to the project and then either copy code from
another project or write handlers for the project. ie the
int_s_tiny2313.asm file would be copied to int_s_projectname.asm file
and massaged as necessary.
Using multiple files in your project has the advantage of not having
long files clogging up your screen and they are also easier to manage.
Regards
John Samperi
********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************
---------------------------------
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
[Non-text portions of this message have been removed]Message
Re: [AVR-Chat] *HAHAHA*
2007-01-18 by np np
Attachments
- No local attachments were found for this message.