Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

uart string to binary

Status
Not open for further replies.

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
    zzztitled-1.jpg
    311.4 KB · Views: 246
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
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top