Yahoo Groups archive

AVR-Chat

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

Thread

now what?

now what?

2006-12-30 by Thomas Keller

Alright, I am totally flumbasted by this one.

   The first line in my code is .include "tn25def.inc" which is 
working.  Yet, when I run the code in the simulator, the debugger is 
dumping a gazillion errors at me, mostly begin geenrated by my .db 
statements.

   The data are apparently being misinterpreted as instrcutiosn, and 
creating illegal opcode and ilegql instruction errors.   While I am 
typing this, it occurs ot me that perhaps I need to put a .dseg in front 
of my .db definitions, yes?  i will try that, and get back to you all.


tom

Re: [AVR-Chat] now what?

2006-12-30 by Thomas Keller

OK.  Nope.   That didn't help any.

I am getting infinite looping at addresses beyond the end of my 
generated code (0x17 and 0x117), with errors of "illegal opcode" and 
"illegal instruction" (MUL and MULS)   There are not looping 
instructions in the code.   The last instructionof the code maps to 
0x16.   I am flambasted again.


Thomas Keller wrote:
Show quoted textHide quoted text
>
>
> Alright, I am totally flumbasted by this one.
>
> The first line in my code is .include "tn25def.inc" which is
> working. Yet, when I run the code in the simulator, the debugger is
> dumping a gazillion errors at me, mostly begin geenrated by my .db
> statements.
>
> The data are apparently being misinterpreted as instrcutiosn, and
> creating illegal opcode and ilegql instruction errors. While I am
> typing this, it occurs ot me that perhaps I need to put a .dseg in front
> of my .db definitions, yes? i will try that, and get back to you all.
>
> tom
>
> 
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.16.0/610 - Release Date: 12/30/2006
>

RE: [AVR-Chat] now what?

2006-12-30 by larry barello

Sounds like a stack problem and returning to never-never land (random
op-codes in un-initialized memory in the simulator) or just the program
running into your .db statements thinking it was code.
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Thomas Keller
Sent: Saturday, December 30, 2006 8:36 AM
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] now what?

OK.  Nope.   That didn't help any.

I am getting infinite looping at addresses beyond the end of my 
generated code (0x17 and 0x117), with errors of "illegal opcode" and 
"illegal instruction" (MUL and MULS)   There are not looping 
instructions in the code.   The last instructionof the code maps to 
0x16.   I am flambasted again.


Thomas Keller wrote:
>
>
> Alright, I am totally flumbasted by this one.
>
> The first line in my code is .include "tn25def.inc" which is
> working. Yet, when I run the code in the simulator, the debugger is
> dumping a gazillion errors at me, mostly begin geenrated by my .db
> statements.
>
> The data are apparently being misinterpreted as instrcutiosn, and
> creating illegal opcode and ilegql instruction errors. While I am
> typing this, it occurs ot me that perhaps I need to put a .dseg in front
> of my .db definitions, yes? i will try that, and get back to you all.
>
> tom
>
> 
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.16.0/610 - Release Date: 12/30/2006
>   



 
Yahoo! Groups Links

Re: [AVR-Chat] now what?

2006-12-30 by Thomas Keller

Yeah, except that I am not using the stack.   I have no subroutine 
calls, and I never address the stack in any way.  There are all of about 
8 lines of code in this fiel so far.   All I do is set up a few values 
and stuff them in some control registers.
\
larry barello wrote:
Show quoted textHide quoted text
>
> Sounds like a stack problem and returning to never-never land (random
> op-codes in un-initialized memory in the simulator) or just the program
> running into your .db statements thinking it was code.
>

Re: [AVR-Chat] now what?

2006-12-30 by Ned Konz

Thomas Keller wrote:
>   Yeah, except that I am not using the stack.   I have no subroutine 
> calls, and I never address the stack in any way.  There are all of about 
> 8 lines of code in this fiel so far.   All I do is set up a few values 
> and stuff them in some control registers.

Why don't you post your code?



-- 
Ned Konz
ned@bike-nomad.com
http://bike-nomad.com

Re: [AVR-Chat] now what?

2006-12-30 by Thomas Keller

Easy for you to say !  *grin*

include "tn25def.inc"

; Define here the variables
;
.def  temp  =r16

; Define here Reset and 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:
 
;    this table povides the data for the intensity curve needed for
;    xxxxxxxxxxxxxxx. 

    .dseg

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
     
;
     .cseg
BEGIN:

    ldi    r31,    0x00                        ; set up upper WGM byte
   out   WGM01,    r31                   ; and once again
   ldi    r31,    0x03                          ; set upo to set 
waveform configuration
   out   WGM00,    r31                   ; output to appropriate control 
register

;
;    set up timer delay for .01 second
;
;    counter clock will be prescaled by 1024 to make the .01 second 
count easier
;

    ldi        r31,    0x38                 ;  load low byte of delay count
    out      TCNT0,    r31             ; output to counter/timer 0-
   

    .exit
   

Ned Konz wrote:
Show quoted textHide quoted text
>
> Why don't you post your code?
>
> -- 
> Ned Konz
> ned <mailto:ned%40bike-nomad.com>
>
> .
>
> 
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.16.0/610 - Release Date: 12/30/2006
>

Re: [AVR-Chat] now what?

2006-12-30 by Jim Wagner

Step through the code with the Studio Simulator and see
where it is going wrong!

Jim


On Sat, 30 Dec 2006 13:06:09 -0600
 Thomas Keller <tjkeller1@alltel.net> wrote:
> Easy for you to say !  *grin*
> 
> include "tn25def.inc"
> 
> ; Define here the variables
> ;
> .def  temp  =r16
> 
> ; Define here Reset and 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:
>  
> ;    this table povides the data for the intensity curve
> needed for
> ;    xxxxxxxxxxxxxxx. 
> 
>     .dseg
> 
> 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
>      
> ;
>      .cseg
> BEGIN:
> 
>     ldi    r31,    0x00                        ; set up
> upper WGM byte
>    out   WGM01,    r31                   ; and once again
>    ldi    r31,    0x03                          ; set upo
> to set 
> waveform configuration
>    out   WGM00,    r31                   ; output to
> appropriate control 
> register
> 
> ;
> ;    set up timer delay for .01 second
> ;
> ;    counter clock will be prescaled by 1024 to make the
> .01 second 
> count easier
> ;
> 
>     ldi        r31,    0x38                 ;  load low
> byte of delay count
>     out      TCNT0,    r31             ; output to
> counter/timer 0-
>    
> 
>     .exit
>    
> 
> Ned Konz wrote:
> >
> > Why don't you post your code?
> >
> > -- 
> > Ned Konz
> > ned <mailto:ned%40bike-nomad.com>
> >
> > .
> >
> > 
> >
>
------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.409 / Virus Database: 268.16.0/610 -
> Release Date: 12/30/2006
> >   
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: [AVR-Chat] now what?

2006-12-31 by John Samperi

At 06:06 AM 31/12/2006, you wrote:

>RESET:
>    rjmp START

.................

>; Program starts here after Reset
>;
>START:

I hope you do REALLY HAVE A PROGRAM here and not just the table :)
and have a .cseg defined at this point.

>     .dseg

I never have any spaces with a directive such a .dseg (may not make 
any difference)

>TABLE:
>;    .db    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 5, 6, 6

You are commenting out your table so it will NEVER be assembled

well this is a start :)

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] now what?

2006-12-31 by John Samperi

At 06:06 AM 31/12/2006, you wrote:

>     .dseg
>
>TABLE:

And of course I just realized that you are trying to put
a .db statement in RAM (.dseg) which is impossible to do.

A .db  can only exist in Flash (.cseg) or EEPROM (.eseg) and
never in RAM (.dseg).

If you end up using .cseg for the table then you will need
a properly constructed lpm instruction to fetch the data or
if .eseg then you will need an EEPROM byte reading routine.

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] now what?

2007-01-03 by larry barello

Why are you even messing with asm right now?  It seems to be causing you a
fair amount of grief.

I downloaded Atmel Studio 4.0 and the service pack (->4.498), created a new
GCC project (downloaded and installed WinAvr), created the new project,
added some code, hit build and run and was immediately in the debugger
(simulator) and it just worked.

I was (given that I have been working with this stuff for 8 years now)
completely shocked at how easy and fast it was.

Now, if Studio can handle multiple files I'll really be pleased....

YES! It does.  Nice.
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Thomas Keller
Sent: Saturday, December 30, 2006 11:06 AM
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] now what?

Easy for you to say !  *grin*

include "tn25def.inc"

; Define here the variables
;
.def  temp  =r16

; Define here Reset and 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:
 
;    this table povides the data for the intensity curve needed for
;    xxxxxxxxxxxxxxx. 

    .dseg

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
     
;
     .cseg
BEGIN:

    ldi    r31,    0x00                        ; set up upper WGM byte
   out   WGM01,    r31                   ; and once again
   ldi    r31,    0x03                          ; set upo to set 
waveform configuration
   out   WGM00,    r31                   ; output to appropriate control 
register

;
;    set up timer delay for .01 second
;
;    counter clock will be prescaled by 1024 to make the .01 second 
count easier
;

    ldi        r31,    0x38                 ;  load low byte of delay count
    out      TCNT0,    r31             ; output to counter/timer 0-
   

    .exit
   

Ned Konz wrote:
>
> Why don't you post your code?
>
> -- 
> Ned Konz
> ned <mailto:ned%40bike-nomad.com>
>
> .
>
> 
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.16.0/610 - Release Date: 12/30/2006
>   



 
Yahoo! Groups Links

RE: [AVR-Chat] now what?

2007-01-03 by John Samperi

At 07:10 AM 4/01/2007, you wrote:
>Now, if Studio can handle multiple files I'll really be pleased....

It does with assembler :) :) I could not live without that. But
looks like you have been pouched by the darC side :-D


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] now what?

2007-01-03 by David VanHorn

On 1/3/07, John Samperi <samperi@ampertronics.com.au> wrote:
>
> At 07:10 AM 4/01/2007, you wrote:
> >Now, if Studio can handle multiple files I'll really be pleased....
>
> It does with assembler :) :) I could not live without that. But
> looks like you have been pouched by the darC side :-D


:)

Indeed.

I prefer to carve my projects up into files, sometimes as many as 30.
I've done some pretty large projects in assembler.
When you have a M128 at 99% in ASM, you've written a lot of code :)

I find it's easier to manage that way.  LCD code is in LCD.inc and so on.
I do wish SOMEONE would do an assembler with hypertext links though, so I
can include links to pin assignments and such.  That would avoid the age-old
problem of the comments getting out of sync with the code so easily.


[Non-text portions of this message have been removed]

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.