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.



Works fine, takes both ShowBars(*"8") and ShowBars(8) to display correct
 
Not for me though

As soon as i make it d=FontBars[data*2]; it works fine.

Otherwise the result is like attached.
 

Attachments

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

Mike.
 

Attachments

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

Mike.

Pommie i agree with AtomSoft, This is the result i get when i use your code.
 

Attachments

  • Untitled.jpg
    35.4 KB · Views: 374
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.
 
For the code:

PutBars(0, 0, 80);
PutBars(20, 0, 90);
PutBars(40, 0, 100);

It produces on my computer.

 

Attachments

  • Untitled.jpg
    23.2 KB · Views: 570
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
    32.6 KB · Views: 341
Last edited:
Pommie what happens when you put some font in the same display, still same result. Maybe our codes (library of GLCD) aren't the same.
 
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
    44.2 KB · Views: 383
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
    116.7 KB · Views: 355
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…