hello sir i have 8 bit data which is coming from ADC0808 this is taken into the AT89c51 micro controller via port P0 now i want to transmit this serially so i have to place data into SBUF (for this please send the C code)....
and after that i received some data serially into SBUF now i ahave to show this data on port P2( for this please send the C code)
i used this code:
SBUF=P0 /// to transfer port dat into SBUF P2=SBUF // to transfer SBUF data into port 2<pre/> but it is not working
There is plenty of exaple code ready & waiting for you in the downloads area of this very site
See also:
RS232 guide for 8052 users: www.8052.com/.../120308
8051 Tutorials: www.8052.com/tutorial.phtml
the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
Books about the 8051: http://www.keil.com/books/8051books.asp www.8052.com/books.phtml
You do not need new code.
You need to understand already available sample code.
How do you know that you have a valid value from the ADC?
How do you know that the serial port is ready to transmit a new character?
HowÂ'do you know the serial port has a character to pick up?
You do not need code, but to spend a bit of time understanding how things work - if you don't, then you will not understand new code either. And your professor will expect you to understand the code you turn in.
<b.sir
here i am sending the detailed code see it and tell the correction
#include<reg51.h> void serial_init() { TOMD=0x20; SCON=0x50; TH1=0xfd; TR1=1; } void main(void) { unsigned char var; serial_init(); while(1) { while(!RI); RI=0; ACC=SBUF; val=ACC; SBUF=val; while(!TI); TI=0; } }
but i am not able to send data correctly into SBUF and not extracting data from SBUF into any other regioster
please help me in code i tried in so many fashions but failed
void serial_init() { TOMD
But did you start by studying the links provided?
As already noted, you need to study those links to understand how these things work - just "trying" stuff randomly without understanding will (continue to) get you nowhere
you need to study those links to understand how these things work
What a great slogan (don't you think?):
"A zero step journey starts with one step forward followed by one step backwards"
sorry it is TMOD only ... please tell me how to simulate in KEIL also.. please please if i am doing any wrong please let me know i read all the links also but i don't know where i am getting caught by this bug
I'm not a C51 guy, but it took me just about 35 seconds to find the following link in one of Andy's suggested links:
www.8052.com/.../Serial_com.asm