View previous topic :: View next topic |
Author |
Message |
efox
Joined: 24 May 2006 Posts: 14
|
number type problem ? |
Posted: Mon Mar 09, 2009 1:54 am |
|
|
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
that in turn, still gave me the letter q.
I thought maybe if I go with the hex value instead of the letter r
Still got the letter q
Then I went with its decimal value.
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
|
|
Posted: Mon Mar 09, 2009 2:45 am |
|
|
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
|
|
Posted: Mon Mar 09, 2009 2:56 am |
|
|
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
|
|
Posted: Mon Mar 09, 2009 2:57 am |
|
|
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
|
|
Posted: Mon Mar 09, 2009 3:04 am |
|
|
Apparently D0 and D1 have been mixed up. |
|
|
Guest
|
|
Posted: Mon Mar 09, 2009 12:36 pm |
|
|
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
|
|
Posted: Mon Mar 09, 2009 1:01 pm |
|
|
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
|
|
Posted: Mon Mar 09, 2009 4:28 pm |
|
|
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
|
|
Posted: Tue Mar 10, 2009 12:26 am |
|
|
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. |
|
|
|