We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to have some leds in P2.0~2.3 and show off the "ON" lamp in VB6.0 program though RS232 during the sensors are +5V output to P1.0~1.3 89S52 MCU. But it appears many errors and doesn't work in PC. Please advise me the comments for the following code. Thanks a lot!!
But what you need first is to get a firm, foundational understanding of the principles.
If you just want examples, there are tons available all over the internet - serial comms must be one of the commonest tasks on an 8051!
There are even plenty of examples on this very site: http://www.keil.com/download/list/c51.htm
The most basic example of serial comms is, of course, the classic "Hello, world" program - see: http://www.keil.com/support/man/docs/uv4/uv4_ex_hello.htm
See also: http://www.keil.com/support/man/docs/uv4/uv4_ex_measureovw.htm
Thanks! If i have the following codes, how to write the code through RS232 to PC?? Please advise it!!
#include<REGX52.H> #include<STDIO.H> main() { TMOD=0x20; TH1=230; TL1=230; TR1=1; SCON=0x70; while(1) { RI=0; TI=0; SBUF=P1 | 0xf0; while(TI==0); while(RI==0); if(SBUF==0xfe) P1=0x3f; else if(SBUF==0xfd) P1=0xcf; else if(SBUF==0xfb) P1=0x0f; else if(SBUF==0xf7) P1=0xff; } }
Please re-read the entire thread from the top. Nobody here is going to do your homework.
Do you actually understand what it's doing?
If you do, then put in comments to show your understanding.
If not, then clearly that is your basic problem!
Why don't you just start with "Hello World", get to understand it, and work from there?
PS
Your layout is still messy; don't use TABs - they don't work on (most) internet forums - use only spaces for indenting.
Note that any decent editor (including uVision) can be set to insert spaces when you press the TAB button:
Edit > Configuration > Editor > Insert spaces for tabs
I just want to ask the related questions, hope someone can help me. Why you say that!! how come the rules to do it!! If I can solve it, i dont need to post my questions!!
I know it's messy for you!! But now I m very urgent to know how to do it!! In fact, if i can't do it, I ll be worst!! I
If I can solve it, i dont need to post my questions!!
No. You should have posted:
"If I cannot solve it, I need to read the documentation and to debug".
"I'm very urgent to know how to do it!!"
There are no shortcuts! If you want to know how to do it, then you need to spend time learning the principles involved!
IF this is a homework assignment, then it is assumed that a capable student should be able to do it. If you really can't do it, then you need to speak to your tutors about either getting some additional tuition, or switching to another course...
But you're not listening to the answers!
Hey!! you are not me!!
I always know no shortcut!!
OK! Dont waste my time!!
Oh, yeah: all those pesky details of learning & understanding what you're doing - what a time-waster!
Good luck with your exams...
You too~~~
That pleases me.