uart string to binary

Varunme

Member
I want to interpret uart string as binary values, i have made a code but not compiling


Code:
void main(){
            char output[7];
int i,rot;
trisb=0x00;
portb=0x00;

UART1_Init(9600);

while(1){

     //  Initialize string with all '\0'
        for(i=0; i<7; i++)
            output[i] = '\0';

        if (!UART1_Data_Ready());        // if there is UART character in buffer
          UART1_Read_Text(output, "m", 255);   // read input from uart

        for(i=0; i<7; i++)
          portb=  output[i] <<1;
}
 
What errors does your compiler tell you? Also post the whole file, not just parts.
 
Last edited:
Ok, so your code really is that short. So once again, what errors is your compiler telling you?
 
some syntax errors, but i am not seeing any errors in the code
attached the screenshot
 

Attachments

  • zzztitled-1.jpg
    311.4 KB · Views: 397
The while statement isn't complete there is an end brace missing "}"

C:
void main()
      {
       char output[7];
       int i,rot;
       trisb=0x00;
       portb=0x00;
 
       UART1_Init(9600);

      while(1){

     //  Initialize string with all '\0'
        for(i=0; i<7; i++)
            output[i] = '\0';

        if (!UART1_Data_Ready());        // if there is UART character in buffer
          UART1_Read_Text(output, "m", 255);   // read input from uart

        for(i=0; i<7; i++)
          portb=  output[i] <<1;
      } //<---- HERE
}
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…