anyway to "simulate" asynch io "to" the usart from avrstudio?
2004-11-29 by James Washer
Yahoo Groups archive
Index last updated: 2026-04-28 22:41 UTC
Thread
2004-11-29 by James Washer
Just wondered if there was a way to "inject" traffic to the "usart" while running under the avrstudio debugger. I suspect not... but it never hurts to ask. - jim
2004-11-29 by Dave VanHorn
At 12:00 AM 11/29/2004, James Washer wrote: >Just wondered if there was a way to "inject" traffic to the "usart" while >running under the avrstudio debugger. I suspect not... but it never hurts >to ask. Other than hitting the RXD bit and faking it in byte by byte? AFAIK, no.
2004-11-29 by Andrew Lim
Hi All,
I'm currently using ATmega8535L for my development and I'm thinking of migrating my design to ATmega16L.
From what I see on the datasheet, the pin configurations are the same. I guess there wont be any issue on this. And I guess the coding will still be the same as well.
However when I was trying to compile using AVRstudio, the system prompted me to change from rjmp to jmp and rcall to call. So, I did that and after it has compiled successfully, I used PonyProg to flash it.
Here is the "fun" part.... the system did not run at all. I wonder if there any additional stuff that I need to do before it can work properly? (i have use m16def.inc as my include file switching from m8535def.inc)
Thanks a lot.
Regards,
Andrew
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?
2004-12-01 by wbounce
Hi All,
I'm currently using ATmega8535L for my development and I'm thinking of migrating my design to ATmega16L.
From what I see on the datasheet, the pin configurations are the same. I guess there wont be any issue on this. And I guess the coding will still be the same as well.
However when I was trying to compile using AVRstudio, the system prompted me to change from rjmp to jmp and rcall to call. So, I did that and after it has compiled successfully, I used PonyProg to flash it.
Here is the "fun" part.... the system did not run at all. I wonder if there any additional stuff that I need to do before it can work properly? (i have use m16def.inc as my include file switching from m8535def.inc)
Thanks a lot.
Regards,
Andrew
Do you Yahoo!?
The all-new My Yahoo! – What
will yours do?
2004-12-01 by John Samperi
At 07:05 PM 30/11/04 -0500, you wrote:
>Here is the "fun" part.... the system did not run at all.
>I wonder if there any additional stuff that I need to do
Check your interupt vectors and stack location. Also
it looks as if you are going over the 8k page boundaries,
(call an jmp instead of rcall and rjmp) so there may be some
problems there. Check your list file to see were the program
is now located. You should be able to do some simulation in
Studio to see what happens after reset. I may be working
on a project that will start with the 8535 but may end up
with a M16 or even M32, so I would be interested in your
results and findings.
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************2004-12-01 by Andrew Lim
Hi John,
I have tried checking my interrupt vectors and stacks. I have no problem with these cos I'm using .EQU labels. Any changes in the address will be replaced when I use m16def.inc
I have also changed the rjmp and rcall command to jmp and call. But still not working.
Anyhow, I will try if I can make it alive. Will let u guys know. Thanks.
Regards,
Andrew
John Samperi <samperi@ampertronics.com.au> wrote:
At 07:05 PM 30/11/04 -0500, you wrote:
>Here is the "fun" part.... the system did not run at all.
>I wonder if there any additional stuff that I need to do
Check your interupt vectors and stack location. Also
it looks as if you are going over the 8k page boundaries,
(call an jmp instead of rcall and rjmp) so there may be some
problems there. Check your list file to see were the program
is now located. You should be able to do some simulation in
Studio to see what happens after reset. I may be working
on a project that will start with the 8535 but may end up
with a M16 or even M32, so I would be interested in your
results and findings.
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************
Yahoo! Groups Sponsor
Get unlimited calls to
U.S./Canada
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.2004-12-01 by Paul Maddox
Dear all, I've long been a user of C on AVRs, but now I have need for speed, and I'm kinda stuck :-) I have a two dimensional array, called array[16, 256], stored in flash memory (these vaules won't change). and what I need to do is something like this ;- PORTD = array[num, step] ; // C psuedo code The array contains only 8 bit values, but these are organised as 16 lots of 256 bytes. Any suggestions how, given that both 'num' and 'step' are variables held in ram. Thanks in advance Paul
2004-12-01 by John Stiekema
Hi Paul, This untried, but pretty sure that I would go for: //assume that we have 16 blocks of 256 in the array... LDS r16,step //this one 0-255? LDS r17,num //this one 0-15? CLR r18 LDI r30,LOW(array) LDI r31,HIGH(array) ADD r30,r16 ADC r31,r17 LPM r18,r30 OUT PORTD,r18 /*...and can be two cycles quicker if you dedicate a permanent pointer to 'step' and 'num' sequentially in SRAM: LD r16,X LDD r17,X+1 */ John S Paul Maddox wrote:
> Dear all, > > I've long been a user of C on AVRs, but now I have need for speed, and I'm > kinda stuck :-) > I have a two dimensional array, called array[16, 256], stored in flash > memory (these vaules won't change). > and what I need to do is something like this ;- > > PORTD = array[num, step] ; // C psuedo code > > The array contains only 8 bit values, but these are organised as 16 lots of > 256 bytes. > Any suggestions how, given that both 'num' and 'step' are variables held in > ram. > > Thanks in advance > Paul > > > > > > > Yahoo! Groups Links > > > > > > > >
2004-12-01 by John Samperi
At 03:30 AM 1/12/04 -0800, you wrote:
> Hi John, I have tried checking my interrupt vectors and stacks. I have
>no problem with these cos I'm using .EQU labels. Any changes in the address
>will be replaced when I use m16def.inc I have also changed the rjmp and
>rcall command to jmp and call. But still not working.
Just for fun I reassembled a working program using the 90S8535 with
the Mega16 definitions. After changing a couple of lines that refer to
'ramend'
where the stack pointer starts off (0x45f in the m16 vs 0x25f in the 8535),
the program worked well in the ICE200 and I would say that no change
would have been needed if a had a real m16 (the ICE has no ram past 0x25f
as it is only intended for the 8535, so the stack pointer doesn't work).
The interesting thing is that I did NOT get any warnings about rcall and
rjmp as
the program is still within the 8K boundaries. Is any part of your program
straying into the upper 8k?
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************2004-12-02 by Andrew Lim
Hi John,
I have got my Atmega16L up and running!
I had changed all rcall and rjmp to call and jmp. Plus one important thing.
I forgot to disable the JTAG function because I used those pins for other purposes.
Thanks.
Regards,
Andrew Lim
John Samperi <samperi@ampertronics.com.au> wrote:
At 03:30 AM 1/12/04 -0800, you wrote:
> Hi John, I have tried checking my interrupt vectors and stacks. I have
>no problem with these cos I'm using .EQU labels. Any changes in the address
>will be replaced when I use m16def.inc I have also changed the rjmp and
>rcall command to jmp and call. But still not working.
Just for fun I reassembled a working program using the 90S8535 with
the Mega16 definitions. After changing a couple of lines that refer to
'ramend'
where the stack pointer starts off (0x45f in the m16 vs 0x25f in the 8535),
the program worked well in the ICE200 and I would say that no change
would have been needed if a had a real m16 (the ICE has no ram past 0x25f
as it is only intended for the 8535, so the stack pointer doesn't work).
The interesting thing is that I did NOT get any warnings about rcall and
rjmp as
the program is still within the 8K boundaries. Is any part of your program
straying into the upper 8k?
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.2004-12-02 by Gert Mueller
Hi all, I'm new on this board - so my question may have been addressed already - sorry if that's the case... I just have migrated from AVR Studio 4.07 to 4.10 and in a program that assembled allright in Studio 4.07 now in 4.10 the code line cpi AL,'#' ends up in the error message: Garbage at end of line. However, when I rewrite that line to cpi AL,35 ; 35 is the ASCII value of '#' the assembler has no complaints. Bug or feature ? Thanks for any enlightenment Gert Mueller
2004-12-02 by leon_heller
--- In AVR-Chat@yahoogroups.com, "Gert Mueller" <gert-mueller@g...> wrote: > Hi all, > > I'm new on this board - so my question may have > been addressed already - sorry if that's the case... > > I just have migrated from AVR Studio 4.07 to 4.10 > and in a program that assembled allright in Studio 4.07 > now in 4.10 the code line > > cpi AL,'#' > > ends up in the error message: Garbage at end of line. > However, when I rewrite that line to > > cpi AL,35 ; 35 is the ASCII value of '#' > > the assembler has no complaints. Looks like a bug to me. It was OK in the 4.09 version, so I upgraded to 4.10, and got the same error as you did. You ought to notify Atmel. Leon
2004-12-02 by Gert Mueller
Leon, Thx for proofing that feature as bug on your system. I just notified Atmel - awaiting the next bug... Gert Mueller
> Looks like a bug to me. It was OK in the 4.09 version, > so I upgraded to 4.10, and got > the same error as you did. > You ought to notify Atmel. > Leon
2004-12-02 by John Samperi
At 11:57 PM 1/12/04 -0800, you wrote:
> Hi John, I have got my Atmega16L up and running!
Congratulations!! :-)
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************2004-12-02 by Gert Mueller
Hi Leon, ...wow - what a quick response from AVR support. Here is what they wrote back: > Hello Gert > Unfortunately there is a bug here so that is why > you receive an error when trying to write '#' > AVRStudio 4.11 will be out early next year and here > this will be fixed. I am sorry for the inconvenience. > Best Regards, > Kristian Saether > Atmel AVR Technical Support ----------------------------------------------------------
> Hello, > I just updated from AVR Studio 4.07 to 4.10 > and in a program source that assembled allright > in Studio 4.07 now in 4.10 the code line > cpi AL,'#' > ends up with the error message: Garbage at end of line. > However, when I rewrite that line to > cpi AL,35 ; 35 is the ASCII value of '#' > the assembler has no complaints. > Bug or feature ? Thanks for any enlightenment > Gert Mueller
2004-12-03 by Andrew Lim
Hahaha... I guess I've stumble into another problem now.
I tried to set the Fuse Bit to change to External Xtal in PonyProg and guess wat? I cannot access the uP anymore.
I tried to reprogram back the Fuse Bit but it says device not found.
Can you help me out?
Regards,
Andrew
John Samperi <samperi@ampertronics.com.au> wrote:
At 11:57 PM 1/12/04 -0800, you wrote:
> Hi John, I have got my Atmega16L up and running!
Congratulations!! :-)
Regards
John Samperi
******************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: samperi@ampertronics.com.au
Website http://www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
******************************************************
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
The all-new My Yahoo! � Get yours free!2004-12-03 by gouy yann
hello, if I'm right, unless you plug an external Xtal, your uP won't be accessible anymore, because even if the SPI provide a clock signal, the uP needs its own clock signal to work. regards. Yann --- Andrew Lim <normaxcite@yahoo.com> a écrit : > Hahaha... I guess I've stumble into another problem > now. > > I tried to set the Fuse Bit to change to External > Xtal in PonyProg and guess wat? I cannot access the > uP anymore. > > I tried to reprogram back the Fuse Bit but it says > device not found. > > Can you help me out? > > > Regards, > Andrew > > John Samperi <samperi@ampertronics.com.au> wrote: > At 11:57 PM 1/12/04 -0800, you wrote: > > Hi John, I have got my Atmega16L up and > running! > > Congratulations!! :-) > > Regards > > John Samperi > > ****************************************************** > Ampertronics Pty. Ltd. > 11 Brokenwood Place Baulkham Hills, NSW 2153 > AUSTRALIA > Tel. (02) 9674-6495 Fax (02) > 9674-8745 > Email: samperi@ampertronics.com.au > Website > http://www.ampertronics.com.au > * Electronic Design * Custom Products * Contract > Assembly > ****************************************************** > > Yahoo! Groups SponsorADVERTISEMENT > > > --------------------------------- > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/AVR-Chat/ > > To unsubscribe from this group, send an email to: > AVR-Chat-unsubscribe@yahoogroups.com > > Your use of Yahoo! Groups is subject to the > Yahoo! Terms of Service. > > > > --------------------------------- > Do you Yahoo!? > The all-new My Yahoo! Get yours free! ===== Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
2004-12-03 by Paul Maddox
Andrew/Yann, Yes you're right, unless you've got the internal clock enabled, the AVR needs a clock in order to do anything, including setting fuses. which makes setting fuses a risky business, especially if you get it wrong! Paul ----- Original Message ----- From: "gouy yann" <gouy_yann@yahoo.fr> To: <AVR-Chat@yahoogroups.com> Sent: Friday, December 03, 2004 9:24 AM Subject: RE: [AVR-Chat] Migrating from ATmega8535L to ATmega16L > > hello, > > if I'm right, unless you plug an external Xtal, your > uP won't be accessible anymore, because even if the > SPI provide a clock signal, the uP needs its own clock > signal to work. > > regards. > Yann > > --- Andrew Lim <normaxcite@yahoo.com> a écrit : > > Hahaha... I guess I've stumble into another problem > > now. > > > > I tried to set the Fuse Bit to change to External > > Xtal in PonyProg and guess wat? I cannot access the > > uP anymore. > > > > I tried to reprogram back the Fuse Bit but it says > > device not found. > > > > Can you help me out? > > > > > > Regards, > > Andrew > > > > John Samperi <samperi@ampertronics.com.au> wrote: > > At 11:57 PM 1/12/04 -0800, you wrote: > > > Hi John, I have got my Atmega16L up and > > running! > > > > Congratulations!! :-) > > > > Regards > > > > John Samperi > > > > > ****************************************************** > > Ampertronics Pty. Ltd. > > 11 Brokenwood Place Baulkham Hills, NSW 2153 > > AUSTRALIA > > Tel. (02) 9674-6495 Fax (02) > > 9674-8745 > > Email: samperi@ampertronics.com.au > > Website > > http://www.ampertronics.com.au > > * Electronic Design * Custom Products * Contract > > Assembly > > > ****************************************************** > > > > Yahoo! Groups SponsorADVERTISEMENT > > > > > > --------------------------------- > > Yahoo! Groups Links > > > > To visit your group on the web, go to: > > http://groups.yahoo.com/group/AVR-Chat/ > > > > To unsubscribe from this group, send an email to: > > AVR-Chat-unsubscribe@yahoogroups.com > > > > Your use of Yahoo! Groups is subject to the > > Yahoo! Terms of Service. > > > > > > > > --------------------------------- > > Do you Yahoo!? > > The all-new My Yahoo! - Get yours free! > > ===== > > > > > > > > Vous manquez d'espace pour stocker vos mails ? > Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! > Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ > > Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
> > > > > Yahoo! Groups Links > > > > > > > >
2004-12-03 by Andrew Lim
Hi Paul, Actually I have tried setting the Fuse bit earlier on using the [Write] command button at the Security and Configuration Menu in PonyProg. Some one suggested that I need to use [Program] function at the PonyProg to program the Fuse bit and I tried it on this time. I still face the same problem. To give you more detail, I have a 1.8432MHz external Xtal attached to my uP. The settings for CKSEL is 0110 which sets the external RC for 0.9MHz to 3Mhz. The settings for SUT is 10. [ 0 means programmed and 1 means unprogrammed according to the datasheet] The convention in PonyProg is the reverse from the datasheet. Is there anything that I left out? Regards, Andrew Lim Paul Maddox <P.Maddox@signal.qinetiq.com> wrote: Andrew/Yann, Yes you're right, unless you've got the internal clock enabled, the AVR needs a clock in order to do anything, including setting fuses. which makes setting fuses a risky business, especially if you get it wrong! Paul
----- Original Message ----- From: "gouy yann" <gouy_yann@yahoo.fr> To: <AVR-Chat@yahoogroups.com> Sent: Friday, December 03, 2004 9:24 AM Subject: RE: [AVR-Chat] Migrating from ATmega8535L to ATmega16L > > hello, > > if I'm right, unless you plug an external Xtal, your > uP won't be accessible anymore, because even if the > SPI provide a clock signal, the uP needs its own clock > signal to work. > > regards. > Yann > > --- Andrew Lim <normaxcite@yahoo.com> a �crit : > > Hahaha... I guess I've stumble into another problem > > now. > > > > I tried to set the Fuse Bit to change to External > > Xtal in PonyProg and guess wat? I cannot access the > > uP anymore. > > > > I tried to reprogram back the Fuse Bit but it says > > device not found. > > > > Can you help me out? > > > > > > Regards, > > Andrew > > > > John Samperi <samperi@ampertronics.com.au> wrote: > > At 11:57 PM 1/12/04 -0800, you wrote: > > > Hi John, I have got my Atmega16L up and > > running! > > > > Congratulations!! :-) > > > > Regards > > > > John Samperi > > > > > ****************************************************** > > Ampertronics Pty. Ltd. > > 11 Brokenwood Place Baulkham Hills, NSW 2153 > > AUSTRALIA > > Tel. (02) 9674-6495 Fax (02) > > 9674-8745 > > Email: samperi@ampertronics.com.au > > Website > > http://www.ampertronics.com.au > > * Electronic Design * Custom Products * Contract > > Assembly > > > ****************************************************** > > > > Yahoo! Groups SponsorADVERTISEMENT > > > > > > --------------------------------- > > Yahoo! Groups Links > > > > To visit your group on the web, go to: > > http://groups.yahoo.com/group/AVR-Chat/ > > > > To unsubscribe from this group, send an email to: > > AVR-Chat-unsubscribe@yahoogroups.com > > > > Your use of Yahoo! Groups is subject to the > > Yahoo! Terms of Service. > > > > > > > > --------------------------------- > > Do you Yahoo!? > > The all-new My Yahoo! - Get yours free! > > ===== > > > > > > > > Vous manquez d'espace pour stocker vos mails ? > Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! > Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ > > Le nouveau Yahoo! Messenger est arriv� ! D�couvrez toutes les nouveaut�s pour dialoguer instantan�ment avec vos amis. A t�l�charger gratuitement sur http://fr.messenger.yahoo.com > > > > > Yahoo! Groups Links > > > > > > > > Yahoo! Groups SponsorADVERTISEMENT --------------------------------- Yahoo! Groups Links To visit your group on the web, go to: http://groups.yahoo.com/group/AVR-Chat/ To unsubscribe from this group, send an email to: AVR-Chat-unsubscribe@yahoogroups.com Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard.
2004-12-03 by Graham Davies
--- In AVR-Chat@yahoogroups.com, "Paul Maddox" <P.Maddox@s...> wrote: > ... the AVR needs a clock in order > to do anything, including setting > fuses. which makes setting fuses a > risky business ... This is not true for all AVRs. Some have a JTAG interface, such as the ATmega16. You can program and clear fuses via the JTAG interface without a main clock and therefore without worry. The JTAG clock is used instead. Did I mention that I offer a JTAG interface for sale? Graham. http://www.ecrostech.com
2004-12-03 by sami saqqa
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
2004-12-03 by Geert De Pecker
Hi,
I am about to start with the fascinating world of AVR and, although
I do not have the STK500 for real tests, I'm playing around with the
AVR Studio.
I made a small test program to simulate, but run into the following
problem: when I run it and the subroutine "doStep" comes at the "ret"
instruction, the program counter jumps back to the "main" label instead
of the instruction after the "rcall" instruction.
What am I doing wrong?
Regards,
Geert
.include "8515def.inc"
;
; Stepper output ports and pins
;
.equ sPort = PORTB
.equ sVertStep = 0
.equ sVertDir = 1
.equ sHorStep = 2
.equ sHorDir = 3
;
; Position registers
;
.def moveH = r18
.def moveL = r19
.def posVertL = r20
.def posVertH = r21
.def posHorL = r22
.def posHorH = r23
;
; Steps per count
;
.equ stepsPerCount = 8
;
; General vars
;
.def tmp1 = r10
.def tmp2 = r11
.def tmp3 = r12
;
; Org
;
.org 0x0000
;
; Interrupts
;
;rjmp main
;--------------------------------------------------
; Start of program
;
main:
;
; Init counters
;
ldi posVertH, 0x00
ldi posVertL, 0x00
ldi posHorH, 0x00
ldi posHorL, 0x00
;
; Test
;
ldi moveH, 0x00
ldi moveL, 0x0A
rcall doStep
ldi r17, 0x00
ldi r17, 0x00
ldi r17, 0x00
ldi moveH, 0x01
ldi moveL, 0x03
rcall doStep
;--------------------------------------------------
; doStep
;
doStep:
cpi moveL, 0x00
brne doStepLow
cpi moveH, 0x00
breq doStepEnd
dec moveH
ldi moveL, 0xFF
doStepLow:
dec moveL
rjmp doStep
doStepEnd:
ldi r17, 0x00
ret2004-12-03 by Dave VanHorn
At 06:00 PM 12/3/2004, sami saqqa wrote: >i have this befor >you must intilaized the stak pointer 1st >for examble > >.org 0x0a > ser temp > out SPL,temp > out SPH,temp > >if the AVR have more than 8-bit stak pointer More correctly: ldi temp,low(Ramend) out SPL,TEMP ldi temp,high(Ramend) out SPH,TEMP You still need to load SPL on machines with 8 bit stack pointer. You don't HAVE to point SP to the end of ram, but it's the most conventional place.
2004-12-03 by sami saqqa
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?
2004-12-04 by Andrew Lim
Geert,
U need to initialise the stack pointer.
Add these few lines after ur MAIN.
;==============================================
Main:
ldi Temp, Low(Ramend)
out SPL, Temp
ldi Temp, High(Ramend)
out SPH, Temp
;==============================================
These 4 lines of code will initialise ur stack pointer. U will be able to use rcall now.
Cheers,
Andrew Lim
Geert De Pecker <geert.de.pecker@skynet.be> wrote:
Hi,
I am about to start with the fascinating world of AVR and, although
I do not have the STK500 for real tests, I'm playing around with the
AVR Studio.
I made a small test program to simulate, but run into the following
problem: when I run it and the subroutine "doStep" comes at the "ret"
instruction, the program counter jumps back to the "main" label instead
of the instruction after the "rcall" instruction.
What am I doing wrong?
Regards,
Geert
.include "8515def.inc"
;
; Stepper output ports and pins
;
.equ sPort = PORTB
.equ sVertStep = 0
.equ sVertDir = 1
.equ sHorStep = 2
.equ sHorDir = 3
;
; Position registers
;
.def moveH = r18
.def moveL = r19
.def posVertL = r20
.def posVertH = r21
.def posHorL = r22
.def posHorH = r23
;
; Steps per count
;
.equ stepsPerCount = 8
;
; General vars
;
.def tmp1 = r10
.def tmp2 = r11
.def tmp3 = r12
;
; Org
;
.org 0x0000
;
; Interrupts
;
;rjmp main
;--------------------------------------------------
; Start of program
;
main:
;
; Init counters
;
ldi posVertH, 0x00
ldi posVertL, 0x00
ldi posHorH, 0x00
ldi posHorL, 0x00
;
; Test
;
ldi moveH, 0x00
ldi moveL, 0x0A
rcall doStep
ldi r17, 0x00
ldi r17, 0x00
ldi r17, 0x00
ldi moveH, 0x01
ldi moveL, 0x03
rcall doStep
;--------------------------------------------------
; doStep
;
doStep:
cpi moveL, 0x00
brne doStepLow
cpi moveH, 0x00
breq doStepEnd
dec moveH
ldi moveL, 0xFF
doStepLow:
dec moveL
rjmp doStep
doStepEnd:
ldi r17, 0x00
ret
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.2004-12-04 by Geert De Pecker
Andrew, Sami, Dave, Thansk for the help. Works ok now. On to timer interrupts... Geert Andrew Lim wrote:
> Geert, > > U need to initialise the stack pointer. > > Add these few lines after ur MAIN. > > ;============================================== > Main: > > ldi Temp, Low(Ramend) > out SPL, Temp > ldi Temp, High(Ramend) > out SPH, Temp > ;============================================== > These 4 lines of code will initialise ur stack pointer. U will be able > to use rcall now.