1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

Need Help - Using 8051 with RS232

Discussion in 'Microcontrollers' started by maxfourier, Aug 7, 2011.

  1. maxfourier

    maxfourier New Member

    Likes Received:
    0
    Trophy Points:
    0
    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 :

    [​IMG]



    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?
    Tags:
  2. tushki7

    tushki7 New Member

    Likes Received:
    0
    Trophy Points:
    1
    Dont worry its easy !!!

    Hello,
    first of all i think microcontroller you are using is P89v51rd2 !!!:cool:
    ok here is the solution :
    1. Do you have any microcontroller book?? if not i suggest you to buy one (The 8051 microcontroller and embedded systems by MAZIDI)..
    2. here is the circuit for max232 : RS232.jpg
    3. after connecting rx and tx pins to microcntroller, do following connections to make p89v51rd2 work:
    1747-200705151343449451.gif.jpg
    4. Now connect your DB9 with your max232, u need three pins -> pin2, pin 3 pin 5.. check it by looking numbers written adjacent to the holes and at the end check which wire is connected to 2nd pin 3rd pin and 5th pin out of 5 wires(use multimeter to check c). . there is possibility that 5th pin is not connected as in mine so you have to solder it as shown
    final.jpg
    5. connect Db9 to your computer serial port(which is also db9).. if there is no serial port you need to buy usb to serial cable .. it looks like this USB-to-DB9-Cable-15223045201.jpg
    6. after connecting usb to serial check which com port is it using:
    right click on My Computer and click properties goto device manager and check com port number in mine its com4 as shown :
    sd.jpg
    7. install flash magic and goto options -> advance options -> in hardware config tab uncheck use dtr to control rst :
    fl.jpg
    8. Turn everthing on and select read device signature from isp :
    1.jpg
    now u will see this :
    2.jpg
    and after pressing reset key of your micrcontroller you will get something like this :
    3.jpg
    9. if you able to see last window i.e device signature then you can easily burn hex files by using start command !!!
    10. If nothing happens after pressing reset key then check your hardware . .

    Good Luck :)
  3. maxfourier

    maxfourier New Member

    Likes Received:
    0
    Trophy Points:
    0
    tushki7.. you're awesome :) this is what i was looking for, a pure desi style solution. I'm gonna do this and get back if i still have a problem.
  4. maxfourier

    maxfourier New Member

    Likes Received:
    0
    Trophy Points:
    0
    reset switch

    How do i connect the switch for the rest circuit - it has 4 pins. Can't find it's pinout on google.
  5. maxfourier

    maxfourier New Member

    Likes Received:
    0
    Trophy Points:
    0
    All i could find out is that it's called a "tack" switch.
  6. tushki7

    tushki7 New Member

    Likes Received:
    0
    Trophy Points:
    1
    Reset switch

    pheww . . i am happy to see it helped you :)
    Tack switch has 4 pins >>> actually 2 pins>> 2 are interconnected internally and two are not...Zzzz
    here is image :
    3.jpg

    is same as this two pin tack switch :-

    2.jpg

    connect 1 pin to vcc(5v) and other to reset pin of microcontroller .. To reset a microcontroller just press it for few seconds . . actually your microcontroller automatically gets reset when you swith on the power because of 10uf capacitor and 10k resistor used in reset circuitry(Dont forget to check reset circuitry) ..

    See this : ioi84.jpg

    Good Luck :cool:

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      41.9 KB
      Views:
      23
  7. maxfourier

    maxfourier New Member

    Likes Received:
    0
    Trophy Points:
    0
    can't set it up

    Hey man.. Did everything as per the steps but its not reading the port. Only COM1 and printer port(LPT) are showing up.

    All i can guess is some issue with the tack switch. I have attached an image of how I've connected it. Please check it.

    Or it could be the 5th pin - it was not connected + i did not have a soldering iron.. So I used a wire taped it nicely.. checked it.

    But i will get a soldering iron. I'm sick of visiting the red fort everyday.. but i'm gonna do that the first thing tomorrow - and get back to you after that.

    Could it be that one of the IC's (8051 or max232) is faulty? How can I check that?

    Attached Files:

  8. tushki7

    tushki7 New Member

    Likes Received:
    0
    Trophy Points:
    1
    try try try . .

    Hey . .
    what you are using >> usb to serial converter?? or simple serial port in your computer??
    Check your hardware. .
    i think you had connected tack switch with ground. . 1 pin goes to vcc and the other one to reset pin... also reset pin is grounded via 10 k resistor and a capacitor -ve end is connected to reset pin(+ve of capacitor to vcc)... and dont use 10uf capacitors with max 232 just use .1uf (104 number written on ceramic capacitor) .. check reset circuit in above post. .
    if you want to check whether reset circuit is working or not, take a led and tie its +ve pin to reset and -ve to ground. . and give power to circuit. .
    1. as soon as you switch on power your led will glow for very few seconds, this shows our 10uf capacitor and resistor pair is connected properly and working fine..
    2. now press tack switch if led glows then it is working fine (caution: dont press it for more then seconds as you are giving 5v directly a led can withstand it for few seconds after it will get burn, use white blue green but dont red led)

    and buy a good soldering iron, pcb, soldering wire and all.. you will need it!!!
    i olwayz avoid breadboard. . when using breadboard check each and every connection and its connectivity. .
    No i dont think your ic's are faulty!!!

    Good Luck again :)
  9. saitiku

    saitiku New Member

    Likes Received:
    0
    Trophy Points:
    0
    hey,
    i soldered the whole circuit as you said. but when i try to "read device signature" i get an error that says."unable to communicate.Failed to auto band" please help asap
  10. :pH

    :pH Moderator

    Likes Received:
    0
    Trophy Points:
    0
    it simply means two things :

    1.may be you have selected wrong port number , baud rate
    2. your controller has blown
Loading...

Share This Page

Loading...