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 IO problem without interrupt

Hi, I'm french so excuse me for my English.
I want to communicate with a PC and a 80c552 card made by myself, this with a serial link.
I have no INT and just an emission of an octet from the 80c552 card to the PC.
My problem is that the PC receives values but not the good one.
In fact only FF is received correctly.
I have made a communication between two PC so my program on the PC is ok.
So the problem comes from the program loaded on the 80c552 and written with keil c51.
I use the mode 1 of serial IO with SM1=1 and I have tried several speed from 2400 to 20000 bauds but nothing changed.
I have no parity and just an octet with a start bit and a stop bit.
Thanks for your help, please answer in english (your french is not so good...), and tell me if there is a better forum for this kind of problem.

Florian

Parents
  • Since you set PCON.7, your controller should run with a transmission rate of 19'200Bd. Is that what you wanted ?

    Your initialization of the control register S0CON resets REN, RI and TI.

    See my comments in your code to find what happens to TI.

    S0CON=0x40; /* TI is S0CON.0, cleared now */
    

    void main(void)
    {
    initialisation_serie(); /* TI=0 after initialization */
    TR0=1;
    while(1)
    {
    if(TI==1) /* TI is still 0, so the if */
    /* condition will never come true... */
    {
    TI=0;
    S0BUF=0xEE;
    }
    

    To get things running, you must transmit a character by writing to S0BUF before entering the while()-loop or simply set TI by writing 0x41 to S0CON.

    HHK

Reply
  • Since you set PCON.7, your controller should run with a transmission rate of 19'200Bd. Is that what you wanted ?

    Your initialization of the control register S0CON resets REN, RI and TI.

    See my comments in your code to find what happens to TI.

    S0CON=0x40; /* TI is S0CON.0, cleared now */
    

    void main(void)
    {
    initialisation_serie(); /* TI=0 after initialization */
    TR0=1;
    while(1)
    {
    if(TI==1) /* TI is still 0, so the if */
    /* condition will never come true... */
    {
    TI=0;
    S0BUF=0xEE;
    }
    

    To get things running, you must transmit a character by writing to S0BUF before entering the while()-loop or simply set TI by writing 0x41 to S0CON.

    HHK

Children