Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Inline Assembly 8051 Keil

Status
Not open for further replies.

JeffreyPeter

New Member
Hi, I want to learn about embedding Assembly lines in C code for creating accurate time delay.
What are the steps to be followed ?
Thanks in advance ....
 
That code I helped you with.... I had to use asm for the nop delay..

As you probably know, I use SDCC (free) compiler

Code:
#define DELAY  \
      __asm      \ 
      nop         \
      __endasm

Remember that the standard 8051 has 12 ticks per instruction..... 4mhz / 12 = 3uS... From here you can generate precise delays..
 
Last edited:
Not really..... SDCC is ansi compliant as is Keil, The only differences are in.... a) definitions , no two programmers define things the same ... b) libraries for the same reason....

The back end stuff ( the stuff you don't see) will also be different..... efficiency etc.... but that is transparent...

It took me, literally, 5 minutes to convert your code to SDCC...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top