Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/10/09 16:44
Read: times


 
#162251 - About your Code
Responding to: ???'s previous message
I copied your source code in Keil and this is what I found first:

1. You have a 3 mismatched brakets.
2. You have defined parameters inside the function and after using the commands...remember Keil is C ..NOT C++. So define them at the begining of th function..example of your mistake:

int main()
{
while (1=1)
{


int row_buff[9];
unsigned char msg_org[3]={"ABC"};
int word_count;
for (int loop_words=0;loop_words<3;loop_words++)
{

 



This should have been:

int main()
{
int row_buff[9];
unsigned char msg_org[3]={"ABC"};
int word_count;
int loop_words;

while (1)
{
for (loop_words=0;loop_words<3;loop_words++)
{

 



4. There is a mistake in your code:
  if (row=0)
 


shouldn't that be
  if (row==0)
 


You have repeated this mistake several times..I don't know which C you have learnt. All versions of C that I have learnt..nobody uses "if (row=0)" for checking if "row is equal to zero".


5. You cannot use the following :
     P1^1=1;
 


a better way to do this in Keil is:

sbit    OUTPUT_PIN1=P1^1;

void main (void)
{
...
..
for (;;)
 {
 ...
 OUTPUT_PIN1=1;
 ...
 ...
 }
 



6. You need some serious help in writing the code...i mean, the way you write the code. I bet you will not understand anything out of this code yourself after six months. Do practise a method so that you can understand the code even after years..I have (and many on this forum) written certain codes many years ago...and still using it untouched. Please don't feel offended, because, I blew off my top when I saw the mismatch in brakets in your code.


Anyways Bye,
And with best regards from,
Kiran V Sutar







List of 35 messages in thread
TopicAuthorDate
C++ and Keil problem            01/01/70 00:00      
   be less suprised,            01/01/70 00:00      
   Keil C51 is _not_ a C++ compiler.            01/01/70 00:00      
   Very old!            01/01/70 00:00      
      Ok guys            01/01/70 00:00      
         Totally missing the point!            01/01/70 00:00      
            Now what is the problem...            01/01/70 00:00      
               Post the full build output            01/01/70 00:00      
                  the code...            01/01/70 00:00      
                     Missing the point again            01/01/70 00:00      
                     No successful output from compiler possible            01/01/70 00:00      
                        C99            01/01/70 00:00      
                           C99 in Keil            01/01/70 00:00      
                     About your Code            01/01/70 00:00      
                        Local variables within inner blocks            01/01/70 00:00      
                           Thanks for correcting me.            01/01/70 00:00      
                              Improved scope            01/01/70 00:00      
   an often missed fact is ...            01/01/70 00:00      
      Coming to harware implementation.            01/01/70 00:00      
         Consultancy fees            01/01/70 00:00      
         will help            01/01/70 00:00      
         problems of Keil with C            01/01/70 00:00      
         New Topic, New Thread            01/01/70 00:00      
   I got the error            01/01/70 00:00      
      C241 Error            01/01/70 00:00      
         RTFM            01/01/70 00:00      
            how to get rid of it?            01/01/70 00:00      
               if something is too big, you need to make it smaller            01/01/70 00:00      
                  Please have a look            01/01/70 00:00      
                     Bounds checking            01/01/70 00:00      
                        Thanks            01/01/70 00:00      
                           But did you look at your code?            01/01/70 00:00      
                              ok            01/01/70 00:00      
                              ISR Problem            01/01/70 00:00      
                                 Start a new thread!            01/01/70 00:00      

Back to Subject List