serial transfer with c in assembler

hi members...

i'm programming assembler and likewise c.
a practical training force me to write assembler in c.
the serial port names P3.1 and i can send every time 8 bit (2bit = start- and stopbit and the last 6 bit's are data).
i must abide the exactly speed (baudrate) for my pc and microcontroller.
in assembler is that very easy because i can use the cycle's.
i have realized the delay with loops in c but the loops are very inexactly!
i've got the answer to use the processortime or related.
How!?!?!

thank's for you sympathy

yours sincerely

nick

Parents
  • Trying to write precise delay loops in 'C' is futile. If this is what the assignment requires, then it is a stupid assignment!

    Trying to write precise delay loops in 'C' is futile because the only way to know precisely how long the loop will take is to examine the generated assembler. And every time you re-compile, you must re-examine the generated assembler to ensure that it is still exactly the same.
    Since you're going to have to keep on examining the generated assembler anyhow, you might as well just write it once in assembler and be done with it!

    Do not try to write precise delay loops in 'C'!!!

Reply
  • Trying to write precise delay loops in 'C' is futile. If this is what the assignment requires, then it is a stupid assignment!

    Trying to write precise delay loops in 'C' is futile because the only way to know precisely how long the loop will take is to examine the generated assembler. And every time you re-compile, you must re-examine the generated assembler to ensure that it is still exactly the same.
    Since you're going to have to keep on examining the generated assembler anyhow, you might as well just write it once in assembler and be done with it!

    Do not try to write precise delay loops in 'C'!!!

Children
More questions in this forum