Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

invalid number?

invalid number?

2006-12-29 by Thomas Keller

Inthe following code, I am getting a fata "Invalid Number" error on the 
line with the out instruction. I have tried this with bot h the register 
name as defined in the def file (TCNT0) as well as with the literal 
register address (0x2f), which is the value defined in 1n15def.inc 
file.  Why is it telling me "invalid number?  (note, I have also tried 
moving the value from r31 ro r0 and outputting it from there.  same 
error)    I am flummoxed.


;  begin

.include "tn15def.inc"

; set interrupt vectors, if any
;
reset:
   rjmp start
   reti      ; Addr $01
   reti      ; Addr $02
   reti      ; Addr $03
   reti      ; Addr $04
   reti      ; Addr $05
   reti      ; Addr $06        Use 'rjmp myVector'
   reti      ; Addr $07        to define a interrupt vector
   reti      ; Addr $08
   reti      ; Addr $09
   reti      ; Addr $0A
   reti      ; Addr $0B        This is just an example
   reti      ; Addr $0C        Not all MCUs have the same
   reti      ; Addr $0D        number of interrupt vectors
   reti      ; Addr $0E
   reti      ; Addr $0F
   reti      ; Addr $10


; Program starts here after Reset
;
start:
   nop       ; Initialize here ports, stack pointer,
   nop       ; cleanup RAM, etc.
   nop       ;
   nop         ;

;
;    this table povides the data for the intesnity curve needed for
;    the beacon simlation.  the data represent the value sin^3 * 255 for
;    each angle from 0 through 90  at .9 degree increments

TABLE:.db    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 5, 6, 6
      .db    8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24, 26, 29, 31, 34, 36
      .db    39, 44, 48, 52, 55, 59, 62, 66, 70, 74, 78, 82, 86, 90, 94, 99
      .db    103, 108, 112, 117, 121, 126, 130, 135, 140, 144, 149, 153
      .db    158, 163, 167, 172, 176, 180, 185, 189, 193, 197, 201, 205
      .db    209, 212, 216, 219, 223, 226, 229, 232, 234, 237, 239, 242
      .db    344, 346, 247, 249, 250, 252, 253, 254, 255, 255, 255, 0
     
;

DELAY:

    ldi     r31,    0xff                    ; load 255 into temp register
    out  r31,    0x2f                    ; store in timer/counter 1
    ldi     r16,    0xff                    ; store 255 into primary counter
    ldi     r17,    0x49                    ; store 73  into secondary 
counter
   

tom

Re: [AVR-Chat] invalid number?

2006-12-29 by John Samperi

At 11:47 AM 29/12/2006, you wrote:
>     out  r31,    0x2f                    ; store in timer/counter 1

You have them back to front :)

Try     out  0x2f,r31                   ; store in timer/counter 1

Better use the actual register name (TCNT1 ??) rather than the
address as it may change in another chip so that you will be able
to reuse your code.



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
********************************************************

Re: [AVR-Chat] invalid number?

2006-12-29 by Thomas Keller

Thanks, John.  I figured that out about 3 minutes before your reply 
arrived in my inbox *blush*.

   Yeah, I was using the label, but switched tot he literal in a failed 
attempt to eliminate the error.

tom

John Samperi wrote:
Show quoted textHide quoted text
>
> At 11:47 AM 29/12/2006, you wrote:
> > out r31, 0x2f ; store in timer/counter 1
>
> You have them back to front :)
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.