We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have used the following code to send a display string to an RS232 port. It always worked in Keil Microvision2. Now in microvision5 it does not.
DispString (“Abcdefg\n”); Void DispString ( unsigned char *gp) { unsigned char i; For (i=0; *(gp+i) != ‘\n’; i++) { putChar (*(gp+i) ); } }
So why does the above DispString not work..?? I get no error messages. However if I change (“Abcdefg”) to (‘Abcdefg’) I get error message …. > too many characters in character literal – extra leading characters ignored.. Can anyone explain and tell me what is the correct way in #5 (and maybe why it doesn't ?) Thanks. Bhal
"it is not true that single quotes are not the correct way to write strings in C"
Yes, it is - please study your 'C' textbook.
"I have single quotes (e.g. putChar('a'); )and it works"
That's a single character - not a string. They are different in 'C' - again, see your 'C' textbook.
"it is stuck @ DispString(...) line"
That's a function call. If it's stuck there, that means it is stuck somewhere in the code inside the function.
So use the debugger to step into the function - and see what's happening ...
"Perhaps you can explain why I am getting the error"
If you do as suggested above, you will see the error for yourself. You will learn a lot more that way.
Debugging is a key skill - you need to learn it: www.avrfreaks.net/.../2418156