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 CCS Technical Support

number type problem ?

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



Joined: 24 May 2006
Posts: 14

View user's profile Send private message

number type problem ?
PostPosted: Mon Mar 09, 2009 1:54 am     Reply with quote

I have an LCD character display and I wrote my own routines. Thats fine.
Wrote a function that initializes the lcd and prints a string.
Code:
char mybuffer[16]="hello world";

However, on the display I see ---- hfllo woqld
I tried a few other sentences too, and some letters are not coming through as they should.
So instead of an char array, I thought I'd send a single character
Code:
char temp='r';

that in turn, still gave me the letter q.
I thought maybe if I go with the hex value instead of the letter r
Quote:
char temp=0x72;

Still got the letter q
Then I went with its decimal value.
Code:
char temp=113;

Guess what ? the letter R !

Which is why I'm believing its not a problem with my function, and maybe something I need to set in CCS. I'm sure this problem(if it truly is) has been addressed before.

Thanks !
efox



Joined: 24 May 2006
Posts: 14

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 2:45 am     Reply with quote

I use mplab for my ide.

watching the variables, i discovered that the numbers are indeed different.

char temp='r'; --> 114 (decimal)
char temp=0x72; --> 114
char temp=113; --->113

doing the same test for say the letter 'h' yielded all values the same.

stumped.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 2:56 am     Reply with quote

Surely not a number type problem. Most likely something's wrong with your display hardware interface, or the way, how you drive it in your software.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 2:57 am     Reply with quote

Quote:
I have an LCD character display and I wrote my own routines.
On the display I see ---- hfllo woqld

You have written your own LCD driver and want to use it.
Therefore, we can't fix your problem.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 3:04 am     Reply with quote

Apparently D0 and D1 have been mixed up.
Guest








PostPosted: Mon Mar 09, 2009 12:36 pm     Reply with quote

FvM wrote:
Apparently D0 and D1 have been mixed up.


thats what i thought too...but i checked the wires, and there is no mix up

I dont think its anything with my hardware because when i send the decimal value of the letter 'r', it displays correctly. However when i use its hex or character value, thats when I get a problem.

How can the 113,0x72, and 'r' be different ? That doesnt seem like its a hardware issue.

Pretend this is not for an LCD, pretend its just a variable.
Why are some characters correct, and some not, when its not a hardware problem and the value stored for each character appears to be different.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 1:01 pm     Reply with quote

Quote:
How can the 113,0x72, and 'r' be different

'r' is 0x72, which is 114 decimal. 113 can never be = 0x72.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Mar 09, 2009 4:28 pm     Reply with quote

Mixed up data lines are a plausible explanation, if you reported the observations correctly. To further clarify the issue, you should write more different ASCII codes.
efox



Joined: 24 May 2006
Posts: 14

View user's profile Send private message

PostPosted: Tue Mar 10, 2009 12:26 am     Reply with quote

I'm sorry. I'm stupid.

It was a hardware issue. My wiring was all over the place and I traced the wrong wire.

D0 and D1 were swapped.

My apologies and my gratitude for insight to resolving this problem.
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