Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Unicorn GLCD demo.

Status
Not open for further replies.
here it is better yet:
Code:
void ShowBars(unsigned char data){
unsigned char i,d;

    for(i=0;i<14;i++){
        d=FontBars[(data)][i];
        if(d!=0x55){
            GLCD_Write_Data(d);
            MoveRight();
        }
    }
    GLCD_Write_Data(0xff);
    MoveRight();
    
}

//call like:
SetPos(112,58);
ShowBars(3);
SetPos(112,50);
ShowBars(6);
SetPos(112,42);
ShowBars(8);
SetPos(112,34);
ShowBars(10);
 
it works fine if i remove the *2... remember this:

your looping 14 character inside a 2 dimension array. the array counts each 14 as 1

to better understand fill in the array data:

const rom unsigned char FontBars[11][14]={

11 arrays of 14 byte data meaning

1 = 0-13
2 = 14-27

etc.... but the array sees it as

1 = 0-13
2 = 0-13

etc....

the 1 and 2 are address to the 14 byte data start so if array 1 is in address 0x10 then array 2 starts at address 0x10+14 = 0x1A

so :
Code:
ARRAY ELEMENT             ADDRESS             bytes

         1             0x10             0-13
         2             0x1A             0-13
 
Last edited:
You code is not working :( Also when i remove the * 2, the result doesn't remain the same.

void ShowBars(unsigned char data){
unsigned char i,d;
switch(data){
case 0:
data = '0';
break;
case 1:
data = '1';
break;
case 2:
data = '2';
break;
case 3:
data = '3';
break;
case 4:
data = '4';
break;
case 5:
data = '5';
break;
case 6:
data = '6';
break;
case 7:
data = '7';
break;
case 8:
data = '8';
break;
case 9:
data = '9';
break;
case 10:
data = ':';
break;
}

for(i=0;i<14;i++){
d=FontBars[(data-48)*2];
if(d!=0x55){
GLCD_Write_Data(d);
MoveRight();
}
}
GLCD_Write_Data(0xff);
MoveRight();

}


Works fine, takes both ShowBars(*"8") and ShowBars(8) to display correct :)
 
works ok for me:
 

Attachments

  • screen.jpg
    screen.jpg
    319.4 KB · Views: 319
You really don't need to define characters, this is what the code I posted earlier produces.

Mike.
 

Attachments

  • Bars.jpg
    Bars.jpg
    31 KB · Views: 309
Try this function,
Code:
void PutBars(unsigned char x,unsigned char y,unsigned char Percent){
unsigned char i;
        for(i=(100-Percent)/10;i<10;i++){
            vline(x+i,x+10,y+2*i);
        }            
}
It puts the display at x,y with percent/10 bars.

Mike.
 
This is what I get with,
Code:
        PutBars(0,10,10);
        PutBars(12,10,20);
        PutBars(24,10,30);
        PutBars(36,10,40);
        PutBars(48,10,50);
        PutBars(60,10,60);
        PutBars(72,10,70);
        PutBars(84,10,80);
        PutBars(96,10,90);
        PutBars(108,10,100);

Edit, it looks like the emulator isn't emulating reading the display correctly.

Mike.
 

Attachments

  • Bars.jpg
    Bars.jpg
    32.6 KB · Views: 264
Last edited:
With text etc.

Mike.
Edit, just had a thought, I made i local in my copy. Try,

Code:
void PutBars(unsigned char x,unsigned char y,unsigned char Percent){
unsigned char k;
        for(k=(100-Percent)/10;k<10;k++){
            vline(x+k,x+10,y+2*k);
        }            
}
 

Attachments

  • Bars.jpg
    Bars.jpg
    44.2 KB · Views: 305
Last edited:
Pommie can you please kindly send me the library files you are using. Also the controller name of your GLCD. I want to test this on proteus. In my one year experience with Proteus, its never deceived me once from the actual output in hardware.
 
Here you go Pommie :)

Seemed as my GLCD library was different :)

I told you its not usual for Proteus to mislead :)

Thank you very much for bearing with me, i know i am a newbi (as said in my account profile)

AtomSoft thanks to you too for your time and effort. :)

Very nice forum!
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    116.7 KB · Views: 284
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top