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 / Replies / still it will take the first

still it will take the first

|

Microcontroller › 8051 › Cannot Receive 4digit Integer value from serial port › still it will take the first

December 22, 2014 at 5:36 pm #12445
Bakhtiar
Participant

still it will take the first block value ,i mean the array value is not empty.

 

if i press another block of value then previous array value will empty.

 

for example

 

first time

 

when press “1234” then lcd display

 

if i again press only “1” of that block that time also lcd display.But i want if i again press “1234” second time then lcd will display.

 

 

after your advice i change my code in below way.

 

void compare()
{

if(strcmp(msg,”1234″)==0)
{
     
     lcdcmd(0x01);
     lcddata(‘B’);
    
     i=0;
    
   }
else if (strcmp(msg,”4321″)==0)
{

 
     lcdcmd(0x01);
     lcddata(‘C’);
    
     i=0;
        }
}

void recieve() interrupt 4
{

while (RI != 1) {;}

msg[i++] = SBUF;
    RI = 0;

        compare();
    
         
 }

 

but still face problem

RSS Recent Posts

  • Can I use an SPDT 5 wire Relay in reverse? August 9, 2022
  • Basic questions about MOSFETS, Gate Drivers and Diodes August 9, 2022
  • LTSpice DC-AC August 9, 2022
  • Circuit Problem August 8, 2022
  • Google translate suggest "device sheet" or "apparatus sheet" but that cannot be ? August 8, 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