Need Help - Using 8051 with RS232

Thread Starter

maxfourier

Joined Aug 7, 2011
16
I'm an electronics student working on my first project. I have explained my problem below. Need some help.

Please consider that I'm a newbie with projects.. I have only brought a few things and downloaded some software. Apart from that I have my logic ready. So, all i would need to do is write the code and program the microcontroller.


This is what i have :

Hardware :

8051 (NXP 80V51RD2)
RS232 with DB9
max232

Software :

Keil
Flash Magic


What i want to do : is just program the microprocessor. I have tried Googling "Interfacing 8051 rs232" but could not really get it.

I can interface the microprocessor and the max232 but I'm having problems interfacing the RS232.

Moreover, I have NO idea how (& where) to connect the RS232. Here is what my cable looks like :





Again, What i need to know is:


-Which side of the cable goes where(PC n 8051)
-How is it connected to the microprocessor.
-How do I write my c code into the microprocessor - How to convert it to hex(or whatever required)? Why do I need Keil & Flash Magic?
 

Chygoz

Joined Apr 27, 2011
14
You'll use the serial communication pins of the 8051 microcontroller. They should be pins 10 and 11. I can't remember the details now and i'm not on my pc but you can google serial communication in 8051. Also you can look for a textbook "microcontrollers and embedded systems" by Mazidi. It should help you.
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
I have already interfaced the 8051 & the max232.
All i need now is how to interface the max232 & the rs232. And how to connect the rs232 to my pc.
 

t06afre

Joined May 11, 2009
5,934
The signal chain will be 8051->max232->PC port.
This is the 9 pin PC port. In the simplest form you need to use pin 2,3 and 5. On the PC side pin 2 is the input pin. So this must be connected to the output pin on the max 232 chip. And the opposite for pin 3 on PC side. Connect pin 5 GND on the PC side to ground (0 volt) on your 8051 board.
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
The problem is, I don't have such a port on my PC. However, i was told that this cable would do the job. (Please see the image in the original post). Now, how do i use that cable to interface to the max232 & my pc?

If the cable i have is the wrong one, then which one do i need?
 

bertus

Joined Apr 5, 2008
22,270
Hello,

The cable needed is dependend on the type (brand and model) of the motherboard inside your PC.
There should be information on the connector on the motherboard in the manual of the motherboard.

Bertus
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
I'm really confused here.. :(

Do i need a cable that has two ends - one connecting to the max232 & other connecting somehow to the PC? (on an existing port on the PC?)

OR

Do i need a new port on the PC?
 

t06afre

Joined May 11, 2009
5,934
Many/almost all modern computers do not have RS232 serial ports. The most common way is to use a USB to serial converter. If this is a school project, ask your teacher if he/she has a one USB to serial you can use. If the school PCs do not have RS232 ports
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
@t06afre - I do have the port on my pc.

But, how do i connect it to the max232? Do i directly connect the pins 2 & 3 of the db9 port to the T & R pins of the max232.

Or do i need to use the cable?(please see the image in the original post)
If yes, how do i use it?
 

t06afre

Joined May 11, 2009
5,934
The cable you have will fit into a PC 9 pin Rs232 port. One end of the cable goes into the PC and the other end goes to the correct pins of the MAX232 circuit. If this done via some connector or not is not important. Hope this help
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
Right! So, now i have the cable connected to the pc 9 port. And all i need to do now is connect the other end (the molex )to the max232. And I do that by a 5 pin molex header/ And then I have everything ready.

Please correct me if I'm wrong.
 

t06afre

Joined May 11, 2009
5,934
Right! So, now i have the cable connected to the pc 9 port. And all i need to do now is connect the other end (the molex )to the max232. And I do that by a 5 pin molex header/ And then I have everything ready.

Please correct me if I'm wrong.
Well it is not insane ;). As long as the internal signal routing is correct you should be OK. However I do not known if the pin 1 on the moles goes to pin 1 on the RS232 connector. Can not tell from the picture
 

Thread Starter

maxfourier

Joined Aug 7, 2011
16
Just need to know one more thing. I have a tack switch with 4 pins.. I need to use it for the rest circuit. How do i do that.. I need a pinout for the switch/?
 
Top