CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Display problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
art



Joined: 21 May 2015
Posts: 181

View user's profile Send private message

Display problem
PostPosted: Tue Jan 17, 2017 2:55 am     Reply with quote

Hi,

I'm trying to display a result " 1_0_1_0_ " from my code, but when I compile it, it shows message "Code has no effect" and display result is " 0_0_0_0_ "

Kindly please help. Here is my code:
Code:

#include <18F4550.h>
#fuses HSPLL,NOWDT,PROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS)
#include <string.h>
#include <input.c>
#include <stdio.h>
#include <stdlib.h>
#include <usb_cdc.h>

 
void main()
   {
      char c;
      int8 i ;
      unsigned char d;
      unsigned char key;

   usb_init_cs();

   while (TRUE)
         {
         usb_task();

            if (usb_cdc_kbhit())
               {
                 c=usb_cdc_getc();
                 if (c=='\n') {putc('\r'); putc('\n');}
                 if (c=='\r') {putc('\r'); putc('\n');}

                 while(true)
                     {
                  ART:

                  d = usb_cdc_getc();

                         if(d=='R')   // push U for INPUT BUTTON
                             {
                                while (key!=32) // push SPACE BAR to stop
                                   {

                                 if(usb_cdc_kbhit())
                                   {key=usb_cdc_getc();}
 
                                int16 a1,a2,a3,a4;
                                int b1,b2,b3,b4;

                               a1=10000;
                               a2=4000;
                               a3=9500;
                               a4=5000;

                             {

                              if (a1>=9000);
                                  b1=1;
                              if (a1<9000);
                                  b1=0;
                              if (a2>=9000);
                                  b2=1;
                              if (a2<9000);
                                 b2=0;   
                              if (a3>=9000);
                                 b3=1;
                              if (a3<9000);
                                 b3=0;
                              if (a4>=9000);
                                 b4=1;
                              if (a4<9000);
                                 b4=0;
   
                             printf(usb_cdc_putc,"%u_%u_%u_%u_" b1,b2,b3,b4 );     
                             }                                     

                                   } key=0; // to initialize 'key' not as SPACE BAR
                             }

                     } // For USB format
               }       // For USB format
         }             // For USB format
}                      // For USB format
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue Jan 17, 2017 6:05 am     Reply with quote

Look closely at this. What do you see at the end of the If lines?
Code:
 
                              if (a1>=9000);
                                  b1=1;
                              if (a1<9000);
                                  b1=0;
                              if (a2>=9000);
                                  b2=1;
                              if (a2<9000);
                                 b2=0;   
                              if (a3>=9000);
                                 b3=1;
                              if (a3<9000);
                                 b3=0;
                              if (a4>=9000);
                                 b4=1;
                              if (a4<9000);
                                 b4=0;

_________________
Google and Forum Search are some of your best tools!!!!
art



Joined: 21 May 2015
Posts: 181

View user's profile Send private message

PostPosted: Tue Jan 17, 2017 6:36 pm     Reply with quote

You are correct. Should not put " ;" at line if. Thank you very much
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group