Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need alternate solution for AVR delay library

Status
Not open for further replies.

vishu489

Advanced Member level 4
Full Member level 1
Joined
Aug 28, 2011
Messages
116
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Visit site
Activity points
2,120
Hello friends

I'm trying to optimize my code size which is return for atmega8. After spending several hours i found that the actual reason behind my code bulkiness is utilization of avr inbuilt delay.h library which has all the inline function. Can anyone suggest me different way of getting delay which will reduce code memory usage as compare to _delay_ms() and _delay_us() function. Also i dont want to use timer since not having any one of them free and i dont need accurate delay.

Also when i tried to convert _delay_ms() and delay_us() function from inline to general compiler gives me error of memory overflow
and When i tried following method my code size was bigger than previous one

Void Delay_ms(uint16_t Duration)
{
while(Duration != 0)
{
_delay_ms(1U);
--Duration
}
}

if _delay_ms() function is inline then compiler should replace it by function body only within Delay_ms() and not anywhere else
Then why my code size is increasing? i want to decrease my flash usage since it almost 78% full

please help me

Thank you in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top