Discussion in "8051 Discussion Forum" started by    nordic    Mar 27, 2014.
Wed Apr 16 2014, 01:58 pm
#21
Hello, I didn't receive any code with the display. Can you post the link from where you downloaded the file or maybe upload the file to one of those file sharing sites and share the link.
Thanks.
Tue May 13 2014, 10:11 pm
#22
Once drove off display I decided to make a counter with buttons. made fon 16x32 figures do not fully visible, some show half and see other purpose. Any ideas why. This is the code



void main_Write_COM( int DH) //öÝàÍ
{
LCD_RS=0;
LCD_CS =0;
LCD_DataPortH=DH>>8;
LCD_DataPortL=DH;
LCD_WR=0;
LCD_WR=1;
LCD_CS =1;
}

void main_Write_DATA(int DH) //éÙ+ù
{
LCD_RS=1;
LCD_CS =0;
LCD_DataPortH=DH>>8;
LCD_DataPortL=DH;
LCD_WR=0;
LCD_WR=1;
LCD_CS =1;
}

void main_W_com_data( int com1,dat1) //öÝàÍéÙ+ùð¦ôÏ
{
main_Write_COM(com1);
main_Write_DATA(dat1);
}



void LCD_SetPos(unsigned int x1,unsigned int x2,unsigned int y1,unsigned int y2)
{
main_Write_COM(0x002a);
main_Write_DATA(x1>>8); //©Lé+X
main_Write_DATA(x1); //©Lé+X
main_Write_DATA(x2>>8); //+ÀéÜX
main_Write_DATA(x2); //+ÀéÜX
main_Write_COM(0x002b);
main_Write_DATA(y1>>8); //©Lé+Y
main_Write_DATA(y1); //©Lé+Y
main_Write_DATA(y2>>8); //+ÀéÜY
main_Write_DATA(y2); //+ÀéÜY
main_Write_COM(0x002c);
}

#include "16x32.h"
void LCD_PutChar16x32(unsigned int x,unsigned int y,unsigned int c,unsigned int fColor,unsigned int bColor)
{
unsigned int i,j;
LCD_SetPos(x,x+16-1,y,y+32-1);
for(i=0; i<32;i++) {
unsigned int m=Font16x32[c*32+i];
for(j=0;j<16;j++) {
if((m&0x8000)==0x8000) {
Write_Data_U32(fColor);
}
else {
Write_Data_U32(bColor);
}
m<<=1;
}
}
}

void LCD_PutChar(unsigned short x, unsigned short y,unsigned int c, unsigned int fColor, unsigned int bColor) {

LCD_PutChar16x32( x, y, c , fColor, bColor );
}

void my_itoa(unsigned int number) // preobrazuva v chislo samo v tozi sluchai
{


data_ind[5] = '\0';
data_ind[4] = (number%10);
data_ind[3] = '.';
data_ind[2] = ((number%100) - data_ind[4])/10;
data_ind[1] = ((number%1000) - data_ind[2]*10 - data_ind[4])/100;
data_ind[0] = ((number) - data_ind[4] - data_ind[2]*10 - data_ind[1]*100)/1000;


data_ind[4] = data_ind[4] + '0';
data_ind[2] = data_ind[2] + '0';
data_ind[1] = data_ind[1] + '0';
data_ind[0] = data_ind[0] + '0';

}

void izobrazqvane ()
{

my_itoa(CNT2);

LCD_PutString(100,100,data_ind,Black,White);
}





Attachment
Thu May 15 2014, 10:18 am
#23
An interesting way of writing array. I did not understand what problem you're facing write now and the picture is not clear either. Did you try printing numbers with static input?
e.g.
LCD_PutChar(100, 100, '1', Black, White);
Wed May 28 2014, 09:49 am
#24
When I print only 1 number there is not problem.
The problem is solved. I reduced the font to 8x32.
Thu May 29 2014, 10:18 am
#25
Thanks for updating. But for bigger fonts if one character is working fine then probably you need to look into function LCD_PutString, where you're passing data to probably putchar function.

also try sending fix string data to "LCD_PutString" and see if it works, if it does then your number to ascii conversion routine is causing an issue.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm
Richardedils
Wed Apr 24 2024, 04:07 am