This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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 Reply Children
  • "that is the problem...."

    What is the problem? Quote some context.

    "it's must have the same time (processor and microcontroller) in assembler anyway!?!??"

    Is this a question or a statement? Either way, explain what you mean.

    "it's never mind in serial with c?"

    I can't make any sense of this.

    "i'm must send data impulse every assigned time."

    Yes.

    "that's only a supposition"

    What is?

    "i need help"

    You need to explain what the problem is. These disjointed phrases full of "??!!??!!" and "..." are useless. We understand that your english is not very good but you could at least try and have the decency to write complete sentences. This is not a chat room.

  • i have solved the problem alone...

    i have write the folowing timer function (delay of one second):

    void timer(void)
    {
    #define TF0_VECTOR 1

    int R7=20;
    TR0=0;
    TF0=0;

    TMOD=TMOD | 0xF0; //Timer 0,16 bit Timer
    TMOD=TMOD & 0x01;

    TL0=0xAF; //Timer 0, set 1 second
    TH0=0x3C;
    TR0=1; //start timer

    while(R7!=0)
    {
    if(TF0!=0) //test if the timer overflow
    {
    TR0=0; //stop timer
    TF0=0; //clear the overflow flag
    R7--;
    TR0=1;
    }
    }


    }


    Thank's for you help

    yours sincerely

    nick