EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / send data serially on port

send data serially on port

|

Microcontroller › 8051 › send data serially on port

  • This topic has 3 replies, 3 voices, and was last updated 10 years ago by madhu.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 6, 2012 at 10:17 am #1903
    chitra
    Participant

    hi 

    i want to send array af strings serially to controller and i want o/p on port.

    i have done program for it.i m getting values in SBUF,but not on port .plz suggest me something,,,,,,,,,

     

    here is my pro.

     

     

     

     unsigned char a[2][3] = {{0x30,0x81,0x92},{0xA4,0xB5,0xD6}};
     unsigned char  *p = &a[0][0];
     void pass(unsigned char * ) ; 
     
     void main()
     {
     TMOD = 0X20;
     SCON = 0X50;
     TH1 = 0XFD;
     TR1 = 1;
     
     pass(p);
     
     }  
     
     void pass(unsigned char *p) 
      {
      static unsigned char value,i,k,j;
       for(i = 0; i<2; i++)
     for( j =0;j < 3; j++ )
     {
         k = *p++;
         SBUF = k;
        while( TI == 0);  //and please tell me where should i write these 2 lines?? 
         TI = 0;              //
         value = SBUF;
         P2 = value;        //wann take o/p on port 2
     
        }
      }
       
    August 6, 2012 at 11:19 am #8415
    nikhiljain
    Participant

    Couple of problems I can see.

     

    1. Infinite loop is missing.

    2. Logical error, if you want to send the string on the port which is stored in the array, why do you need the serial port.

    August 6, 2012 at 5:58 pm #8420
    chitra
    Participant

    1> though m not using while(1) loop,its giving values in SBUF……..

     

    2> n m doing some experiment with that ,so i wanted to send array thr’ serial com…..i knw other methods will b benificial…..but y this is not working?????

     

    if  SBUF can hold values,then  y it is not copying the same on port?

    i have seen some xamples to send  single value on port.

      but again the same question arises, y port is not showing dat values???

     

    plz help…..

    August 14, 2012 at 6:25 am #8455
    madhu
    Participant

    you write the functions in interrupt.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • How know if solder iron has good quality tip? August 18, 2022
  • How does a transistor works as a switch? August 18, 2022
  • Peltier control August 18, 2022
  • How to set USB port as RS-485 entrance? How to interpret Growatt solar inverter commands? August 18, 2022
  • Component Identification August 18, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools