How can I using C Compiler in order to communication between 8051 with PC via serial port using RS232. I want to have an Example for Keil C for 8051 and an example Visual basic for Receive/transmitter on PC.Thank You very much.
There are example serial communication programs for the 8051 on this website. For Visual Basic examples you might try the Microsoft website? Stefan
Your 8051 neither knows nor cares what is connected at the far end of the RS232 link - it could be a PC, a VT-100 terminal, another 8051, etc, etc, etc, ... The only things of concern to the 8051 are: 1. configuring the UART as required (Baud rate, framing, etc); 2. sending bytes to the UART for transmission as required; 3. reading received bytes from the UART as required. There is 8051 example code to do all this on this site. Similarly, all the PC software needs to do is configure the COM port, read & write characters. For example VB code, you wil need to go to a VB site! Hint: Don't try to develop both ends of the link at the same time! Start by just using a dumb terminal or terminal emulator to get one end working first! Note that you can get the uVision simulator to send its serial simulation output to a COM port - so you don't even need to have your hardware working before you can get the code going!
As far as the VB side, I user Visual Studio's VBTERM. The complete project is available and ready to do any thing you need.
The only things of concern to the 8051 are: 1. configuring the UART as required (Baud rate, framing, etc); 2. sending bytes to the UART for transmission as required; 3. reading received bytes from the UART as required. AND 4. a 232 interface chip such as the MAX232 to interface with the PC Erik
sir, Please send me this project source code and digram. thanks
Take a look to the board schematics of a Keil MCB eval board (i.e. http://www.keil.com/mcb517). As a second step use the example programs that come with a Keil Eval Version (for example: ..\C51\Examples\Measure). When you do this together with Hyperterm you get an impression of what you need to do.
For the 8051, grab my free UART driver at http://www.embeddedfw.com and then be sure it works with HyperTerm. Then pull up VB and drop a COMM object onto a form and configure it for the correct baud rate, etc.
Sir can u please send me serial communication using 8051 and PC code, diagram and other useful information.Please thank u
Sir, do you know how to handle 9 bit mode with visual basic?? thanx for your help
The UART inside a PC is not well suited to receiving 9 bit mode. If you are receiving bytes slowly, you might be able to try setting the port to s81 mode ("space parity", 8 data, 1 stop), which might generate a parity error when the ninth bit is high, but you would have to detect and process this before the next data byte arrived (or you would not know which byte the error applied to), so the normal input buffering for VB would be useless. Responding to events in real time under Windows is not guaranteed either, so you might need to use something external to the PC to translate your data into standard 8 bit serial.
How can I using transmite and receive 8051 network via SN75176? I want to use bit SM2 for multiprocessor communication but difficult for me.Using serial interrupt to transmittion and Receive data. Help me!
You use serial port as UART "9600" baud rate. then use c++ conio.h. function outp will sent data to com port of pc. by good lock
Hmm, you know, UART of PC is able to support 11-bit mode without problems. We use such mode in our API, really (= For example, to send ninth bit as zero you should do next (here we define PORT value as 0x3F8 for COM1): _outp(PORT+3, (32+16+8+2+1)); //set mode: 8 data bits, 1 stop bit, parity bit always is zero _outp(PORT+0, data); //sending one start bit, 8 data bits, parity bit as 0 and one stop bit To send ninth bit as 1 do next: _outp(PORT+3, (32+8+2+1)); // parity bit always is 1 _outp(PORT+0, data); To read COM port with 11-bit mode you should use next routine: int ReadByte (unsigned int time_out) { unsigned int data, timeout = time_out; unsigned char status; _outp(PORT+3, (32+8+2+1)); // wait for parity bit as 1 while (! ((status = _inp(PORT+5)) & 1)) { if (! timeout--) return (-1); // timeout } data = (int)_inp(PORT+0); if (status & 8) return (-2); // frame error if (!(status & 4)) data += 256; return (data); // ninth bit of data is TB8 } Btw, it is only example; we use different routine (based on COM interrupt). Anyway these examples are worked; we tested it on Win98 with 115200 baudrate. Good days!
I Am Iranian Boy And In This Country We Dont Have Enough Refrence Please Help Meeeee