Discussion in "8051 Discussion Forum" started by    romel_emperado    Nov 4, 2010.
Mon Nov 08 2010, 02:10 pm
#31
how do i display this aray in the lCD? its different on the 16x2 lcd.




char digit[10]={1,2,3,4,5,6,7,8,9,0};
void main()
{


 while(1);
  {
   initlcd();
   cursorxy(3,4);
   putstr(digit[2]);   /// eror how to do this?
  }



}


[ Edited Mon Nov 08 2010, 02:17 pm ]
Mon Nov 08 2010, 02:24 pm
#32
yes it is diffrent from all aspects its function is diffrent from other lcd
use putchar function for a single character
Mon Nov 08 2010, 02:42 pm
#33
hi makoja if i want to display the content of an array how would i do that?
i tried but it doesnt display.. my code is posted below

#include <AT89X51.H>

#include "lcd.h"

char digit[10]={1,2,3,4,5,6,7,8,9,0};

void main()
{
 initlcd();
 cursorxy(1,1);
 putstr(digit[2]);   
while(1);

}
Mon Nov 08 2010, 03:11 pm
#34
hi romel
try this
unsigned char digit[10]={'1','2','3','4','5','6','7','8','9','0'};
then it will display
Mon Nov 08 2010, 03:32 pm
#35
i already tried that method error also

compiling clock.c...
CLOCK.C(11): error C214: illegal pointer conversion
Target not created




#include <AT89X51.H>

#include "lcd.h"

unsigned char digit[10]={'1','2','3','4','5','6','7','8','9','0'};


void main()
{
 initlcd();                    
 cursorxy(1,1);
 putstr(digit[3]);   
while(1);
                              
}
Mon Nov 08 2010, 03:39 pm
#36
wee!!! helo majoka i see the problem instead of using putstr i used putchar and it works.. huhu my 6hours is focus in this problem.. hehe
if i had known by using putchar will solve this i will not spend my 6 hours in this line.. hehe but its okay.. hehe

#include <AT89X51.H>

#include "lcd.h"

unsigned char digit[10]={'1','2','3','4','5','6','7','8','9','0'};


void main()
{
 initlcd();                    
 cursorxy(1,1);
 putchar(digit[3]);   
while(1);
                              
}


[ Edited Mon Nov 08 2010, 03:40 pm ]
Mon Nov 08 2010, 03:44 pm
#37
hi romel_emperado
i think u do not read my previous reply i mention that use putchar(); for single character as putstr(); is a function that receive strings address instead of single byte of data
obviously now ur problem should be solved
anyhow u learn from these 6 hours now u will not do this mistake in future orif do u understand it in a second
this is called learning
this is my reply in previous post

use putchar function for a single character

 romel_emperado like this.
Mon Nov 08 2010, 04:03 pm
#38


hi romel_emperado
i think u do not read my previous reply i mention that use putchar(); for single character as putstr(); is a function that receive strings address instead of single byte of data
obviously now ur problem should be solved
anyhow u learn from these 6 hours now u will not do this mistake in future orif do u understand it in a second
this is called learning
this is my reply in previous post

use putchar function for a single character


majoka



its my mistake i did not properly read your post..

-------------------------------------------------------------------------------------------------------------

do u have idea on this on how to solve this problem? it is the same error as above

unsigned char days[3]={"Monday","tuesday","wednesday"};

unsigned char days[3]={'Monday','tuesday','wednesday'};

o tried using putchar and putstr but no luck.
Mon Nov 08 2010, 06:31 pm
#39
try :

 char* days[3]={"Monday","tuesday","wednesday"};


use putstr(days[1])....etc.
Mon Nov 08 2010, 06:42 pm
#40
hi sham thanks it now okay and displaying.. let me ask a question.
what's with that "*" ? what is the explaination behind that? sorry Im noob.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am