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
1) You show code using the UART - so why did you mention USB in your post?
2) Your functions exits from main() - where do you think they will end up then?
3) Who are expected to accept the return value from main() in case you receive something?
I was trying to fix it with USB but my advisor said it can be done in UART too. So i was trying all sort of method to get it fix. The Tx and Rx are P0.0/TX and P0.1/RX from C8051F220 microcontroller on Transmitter and P0.0/TX and P0.1/RX from C8051F226 on receiver. I've tried linking Tx to Rx and light up one of the LED on receiver but it just don get it work. Please advise! Thanks...
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
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.
What is "NYP" ?
"i am just a beginner"
Surely, by your 3rd year, you should be significantly more than just a beginner?!
The SiLabs chips have on-chip debug - so that should greatly facilitate locating the problem!