I need some help regarding how to give input through serial port. I can see the output of serial port in UART #1.
char rxcharacter(void) { char character;
SBUF = _getkey (); //SBUF = 'G';
while(RI != 1);
character = SBUF; RI = 0;
return character; }
Do you mean you are just new to the Keil tools, or also new to the 8051?
Do you have any general 'C' experience?
For Keil details, study the Manuals: http://www.keil.com/support/man_c51.htm
In particular, http://www.keil.com/support/man/docs/uv4/uv4_examples.htm
See also: http://www.keil.com/books/
For the 8051 in general, see:
http://www.8052.com/tutorial
www.8052.com/.../120112
http://www.keil.com/books/8051books.asp
For general starting with 'C', see: blog.antronics.co.uk/.../
SCON = 0x10; /* recieve enabled mode 0 ---> 8-bit shift register with baud rate = 1MHz */ the validity of the above will depend on 1) clock speed 2) derivative
Erik
Very new to keil tool and 8051.
But I have some C experience.
thanks for the links.
i am using 8051AH. crystal frequency = 12MHz
As SM0 = 0 and SM1 = 0 ---> serial mode 0 ===> it will work as a 8 bit shift register with a baud rate = 12MHz /12 = 1MHz
You are saying my baud rate is very high?
Thanks a ton. Now I used serial mode 1. It is working. Do suggest me the best books for 8051 and derivatives. and books for C and assembly.
#include <stdio.h> #include <reg51.h>
void txcharacter(char character); char rxcharacter(void);
main(){
unsigned char character;
SCON = 0x50;
TMOD = 0x20; TH1 = 0x06; TL1 = 0x06; TR1 = 1;
TI = 1; // you can now transmit on the line
while(1){
character = rxcharacter();
txcharacter(character); } }
void txcharacter( char character) {
while(TI != 1); TI = 0; SBUF = character; return; }
I've already given you a book list!
Cautionary notes: www.8052.com/.../175610 www.8052.com/.../185943
However, it does seem that you are using an extremely old chip!! http://www.keil.com/dd/docs/datashts/intel/80xxah_ds.pdf
yeah. i am using very old chip. i just wanted to start from scratch.
please suggest me a step by step way to learn more about all important chips.
like, what could be the next chip i could learn and understand easily and then what could be the next.
thanks
yeah. i am using very old chip. i just wanted to start from scratch. cut the 'yeah' it will cost you more to program that old chip than 10 new ISP chips will cost you If you were to start driving "from scratch" would you drive a 1920 car first?
like, what could be the next chip i could learn and understand easily and then what could be the next. cut the 'like' I would suggest you buy a SILabs devboard, it comes with everything. The silabs chips have one HUGE advantage for beginners, the JTAG
thank you Erik.
could you suggest me the preferable kit i need to buy. please give me more details. so that, i just order the right devboard.
on where you want to go.
do you want to end up designing: robots, scales, moving signs, .....
if "all of the above" get the f120DK.
then another Kit
you can "select by feature" if you go to digikey and choose 8051f the silabs website may be of help, but I find digikey a better "choosing place"
we are back to the f120
Could you please suggest me a generic board if any. which comes with most of the features. I am planning to buy it in the coming week.
no generic boards
if the featurs are not very important, the most powerful is the f12
some can do USB some can do LAN some can do CAN some can do 24-bit A/D some can ...
you need to go through what there is and choose what fit you the best
" href= "http://search.digikey.com/us/en/cat/programmers-development-systems/general-embedded-dev-boards-and-kits-mcu-dsp-fpga-cpld/2621773?k=8051f"> search.digikey.com/.../2621773
might be of some help