getting problem in receiving data from serial port

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parvathireddy
    New Member
    • Jan 2014
    • 8

    getting problem in receiving data from serial port

    I need to receive data from pc to Pos using serial port RS 232 . I am receiving data but garbage values and overlapping is occuring.

    // data received //
    Code:
    ret=(PortRecvs(0,buff,sizeof(buff)-1,1000)<0);
    /// 0 is comport, 1000=time in ms//
    //********Explain me from here****////

    // comparing the data//
    Code:
    if(ret<0)       
    	        { 
    				ScrCls();
    				Lcdprintf("Receive Fail..");
    				DelayMs(500);
    		   }
    		else
    		  {
    				ScrCls();
    				Lcdprintf("Receive Buff:\n%s\n",buff);//j=12
    				DelayMs(1000);
    		  }
    		break;
    	}

    // now i need to validate the data and again i should send////


    thanks in advance
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Tell me about this PortRecvs() function.
    • Did you write it?
    • Does this function access the RS-232 hardware or does it interact with an interrupt service routine?
    • What operating system is being used?
    • How big is the receiver buffer in the RS-2332 hardware? In the interrupt service routine?

    Are you sure the transmitter and receiver RS-232 channels are configured properly (data bits, parity, baud rate)?

    Comment

    Working...