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

C8051 USB Programme

Hi all,

i am a 3rd year NYP student and i am currently doing a project that needs to link transmitter USB to a receiver USB(example tx to rx) in silicon laboratories. I has been trying for a month and yet no results has shown. I not too sure which part i did wrong. Seeking helper to solve my problem, i am just a beginner :( Do anyone doing similar things like me? Many thanks.

C8051 microcontroller
using C language

//Transmitter
#include <f200.h>

void main()
{

TMOD = 0x20; SCON = 0x50; TH1 = 0xFD; TL1 = 0xFD; TR1 = 1;

while(!TI); TI = 0; SBUF = 0x4F;
}

//Receiver
#include <f200.h>

void main()
{ TMOD = 0x20; SCON = 0x50; TH1 = 0xFD; TL1 = 0xFD; TR1 = 1;

while(!RI); RI = 0; return SBUF;
}

These codes may look very wrong but really need helps from you guys. Thanks
MJ

Parents
  • i am a 3rd year NYP student ....
    I've tried linking Tx to Rx and light up one of the LED on receiver

    what is 'NYP' ?
    If you, after 2+ years after studying can not a) do the above OR b) describe your problem in an understandable way, I wonder what has happened in those years.

    fix it with USB ... C8051F220
    SILabs have many chips with USB slave capability, why are you trying with one that does not?

    Erik

Reply
  • i am a 3rd year NYP student ....
    I've tried linking Tx to Rx and light up one of the LED on receiver

    what is 'NYP' ?
    If you, after 2+ years after studying can not a) do the above OR b) describe your problem in an understandable way, I wonder what has happened in those years.

    fix it with USB ... C8051F220
    SILabs have many chips with USB slave capability, why are you trying with one that does not?

    Erik

Children
  • Because the goal seems to be to get UART communiation working, and USB seems to be a random side track.

    But still so much lack of information.

    We know the signals used on the two processors, and that it's RX-TX, TX-RX. But that is all we know.

    There are two different processors. SO we don't know if they have the same clock frequency. We don't know if they get the same baudrate. We don't know if they are mounted on two SDK and one has logic-level signals and one have RS-232 signals. And having spent weeks and still have code that returns from main() means that the OP have not spent any real time looking at all the example programs that exists out there. There isn't any OS that will get any exit result from a program that ends, since a standalone program in a 8051 don't have anywhere to exit.

    First few days should have been enough to write the code. Next days should have been spent figuring out why it doesn't work. And an initial post to a forum should have been able to specify exactly what have been tested, and the outcome of all these tests.

    So the situation is basically:
    - project started a number of weeks ago.
    - no time was spent on the project.
    - now the allowed time is almost up, and the OP is in panic to get the code working.

  • The SiLabs chips have on-chip debug - so that should greatly facilitate locating the problem!