i need to read 2 pieces of data in a single loop .Is this correct ?

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
mohy2910
Posts: 1
Joined: 27 May 2022 10:07

i need to read 2 pieces of data in a single loop .Is this correct ?

#1 Post by mohy2910 » 27 May 2022 10:22

if(UART1_data_ready()) //UART CHECK FOR DATA ENTRY
{
med = UART1_read(); //ASSUMING UART DATA TO A VARIABLE
delay_ms(500);

//--------------------------------------------//
//IF MEDICINE X IS ORDERED//
if(med=='x')
{
if(UART1_data_ready()){ //<-------here is the problem---------
quan = UART1_read();
delay_ms(500);
LCD_CMD(_LCD_CLEAR); //CLEAR LCD
LCD_chr(1,1,quan);
motor1=1; //TURN ON COIL Z
while (IR==0); //WAIT IR SIGNAL
if(counter==intger){
LCD_CMD(_LCD_CLEAR); //CLEAR LCD
//LCD_out(1,1,"WAITING"); //PRINT WAITING
motor1=0; //TURN OF COIL Z
}



}
}

Post Reply

Return to “mikroC PRO for PIC General”