This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RS232 & MAX232 serial communication


Iam connecting microcontroller 8051 with my PC COM1 port to have serial communication. To have same voltage levels between PC and 8051 i have used MAX232 but i need to know what other components like capacitors and resistor i need to connect in between controller and MAX232. i have the data sheet but information is limited.

so can any one suggest capacitor value and quanity and other minor components.

Parents
  • Hi Jon,

    I have done one simple serial rs232 c program in keil and when download in eprom it produce no output on the termulator.This program is to do serial transmission from 8051 to pc.

    Here is the code:

    /* RS232 SIMPLE TRIAL */
    
    #include <stdio.h>
    #include <reg51.h>
    
    
    /*Function to initialize RS232 serial port*/
    void serial_init()
    {
    	SCON=0X50;		//Setup for 8-bit data
    	TMOD=0X20;		//Setup Timer 1 for auto-reload
    	TH1=0XFD;		//Setup for 9600 baud
    	TR1=1;			//Turn on Timer 1
    	T1=1;			//Indicate Ready to Transmit
    }
    
    /*This func display a null-terminated string on the rs232 port*/
    
    void send_serial(unsigned char*s)
    {
     while(*s!=0x0)
     {
      SBUF=*s;
      while(!T1)
      {  }
      T1=0;
      s++;
      }
    }
    
    /*Start of main program*/
    
    main()
    {
     unsigned char crlf[]={0x0D,0x0A,0x0};
     serial_init();
     for (;;)
     {
      send_serial("Another test");
      send_serial(crlf);
     }
    }
    

    since i am using off chip memory i have set it to 0x0000. But when i turn on the board, there is no data displayed except letter 'n'. Why this thing happen? I am using Maxim 232.

    your help is much appreciated.

Reply
  • Hi Jon,

    I have done one simple serial rs232 c program in keil and when download in eprom it produce no output on the termulator.This program is to do serial transmission from 8051 to pc.

    Here is the code:

    /* RS232 SIMPLE TRIAL */
    
    #include <stdio.h>
    #include <reg51.h>
    
    
    /*Function to initialize RS232 serial port*/
    void serial_init()
    {
    	SCON=0X50;		//Setup for 8-bit data
    	TMOD=0X20;		//Setup Timer 1 for auto-reload
    	TH1=0XFD;		//Setup for 9600 baud
    	TR1=1;			//Turn on Timer 1
    	T1=1;			//Indicate Ready to Transmit
    }
    
    /*This func display a null-terminated string on the rs232 port*/
    
    void send_serial(unsigned char*s)
    {
     while(*s!=0x0)
     {
      SBUF=*s;
      while(!T1)
      {  }
      T1=0;
      s++;
      }
    }
    
    /*Start of main program*/
    
    main()
    {
     unsigned char crlf[]={0x0D,0x0A,0x0};
     serial_init();
     for (;;)
     {
      send_serial("Another test");
      send_serial(crlf);
     }
    }
    

    since i am using off chip memory i have set it to 0x0000. But when i turn on the board, there is no data displayed except letter 'n'. Why this thing happen? I am using Maxim 232.

    your help is much appreciated.

Children
No data