Google

Oct 15, 2009

Dely loop in AVR

Amer:

Hello freinds.
Can anybody help me regarding how to write a assembly language delay loop (loop-in-loop method no use of internal timers) for AVR microcontroller and how to evaluate the time delay provided by a loop?
I have an example of such loop taken from EFY mag's Nov.05 issue. You can help me by explaining the calculations for that code. The code goes as follows:-


delay: clr r19
ldi r17,$ff
loop1: inc r17
brne loop1
inc r19
brne loop1
ret
Please include the step by step calculation procedure for the delay loop in your reply so that i will be able to write loops for desired delay.
Also does anybody has another type of such code to generate delay? please explain the evaluation of the same.
Thanks in advance...

Arun Dayal
May be my C code for PWM Servo controller routine help u! Just follow my web at http://www.dayalsoft.com . An ASM delay can be written similarly. The routine is not using any of the internal timers and produces a variable delay ranging from 800 to 1250 uS precisely.

sajiD
main:
ser r16
loop1:
dec r16
brnq loop1
ret
that is very ez ok

Prasanna.S

for calulation of delay loop you should know the clock cycle period(i.e1/frequency) once you get this if you are writing code in assembly language you have to check no. of cyles required for each instruction(but for avr most of the instruction are single cycle)
refer processor manual write a simlpe code with decrement in loops the value to be given is calculated
no to be decremented=sec required/(no of cycles /loop)*period in sec

to exact value you have to consider the jump instruction in the end of loop completion etc.

Oct 13, 2009

C Programming Options in AVR

I am new to AVRs
I want to know what all programming options are there for C.
I know about BASCOM, but dont personally like BASIC that much.

ans:

* hey try codvisionavr c compiler .....it good and easy to learn and when u become pro use
WinAVR GCC

* I think you should see the page http://www.lancos.com and everthing will be clear! U will be able to make ur own circuit to program downloader circuit! as well as software to download for free!
U should use IAR Embedded C Compiler! It is widely supported by C Libraries and Evaluation version if free and sufficient for new users!

One of the International Journal Paper of mine for Your Use
http://www.convergencepromotions.com/atmelonline/v_9/pdf/AtmelJournal_V9_ConstructingA16-Channel.pdf

Similar ones u could find at http://www.atmel.com web site

* You may try AVRstudio from http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 along with WINAVR from winavr.sourceforge.net/ . AVRstudio serves as the IDE and Debugger/Simulator and WINAVR the C compiler. Both complement each other.

For the hardware part you could try the JTAG emulator described in this site.
http://www.scienceprog.com/build-your-own-avr-jtagice-clone/

I have made the emulator using GP board and it works perfectly.

* i recommend you to use C Language for programming AVR microcontroller
C is quite commonly used for programming microcontrollers and a lot of help is
available on programming microcontroller in C
you can design your own programmer for AVR because AVR microcontroller has SPI & other ports for In-Circuit programming

Oct 5, 2009

How To to build an ISP for Atmega 128

You can check out Electronics For You Vol 31 nov 2005 edition

or

First of all ATMEGA 128 supports ISP. One can use the same ISP programmer used for ATMEGA 16/32 to burn a ATMEGA 128. In your target platform just take out the connections for SPI, (MISO, MOSI, SCK, and RESET) and connect those line to your ISP programmer. For schematic and PCB layout mail me : nibir.chakraborty@gmail.com. You can mention the details of the target board like what other things you want in the platform.