Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 11th March 2009, 01:16 PM   #91
Default

The chip that you chose has 128k of memory and most compilers assume that you will use a chip that has no more than 64k. With 64k of memory the address fits in 16 bits and so we can use near pointers (16 bit). When the address space gets bigger then we need bigger pointers. The far directive tells the compiler to use 24 bits as a pointer.

You must have lots of data in your project. May I ask what it is?

Mike.
Pommie is online now  
Old 11th March 2009, 01:41 PM   #92
Default

My project has many variables (900 bytes in data memory), and approximately 97,656 bytes of program data.
My application has several configuration menu and allows to measure several types of informations.
Thank you for your help Pommie
jorg1n is offline  
Old 11th March 2009, 02:20 PM   #93
Default

Pommie, I have a little question to ask:
- I want to display a "float" or "int" is that I convert my string variable, but I get a string of cloud of points.
That's how I proceeded:

Code:
char DATAtoLCD[30];
float voltage;
[...]
voltage = 6.654;
[...]
sprintf (DATAtoLCD,"%6.2f",voltage);
SetPos(73,19);                                           
PutMessage(DATAtoLCD);
I use the Microchip C18 compiler for more information.
Thank you in advance
jorg1n is offline  
Old 11th March 2009, 11:10 PM   #94
Default

I use this. You will need to convert your number to an integer, though.
Code:
void displayNum(int x, int y, int theValue) {
    char toPrint[4];
    
    toPrint[0] = (theValue/1000)+48;
    toPrint[1] = ((theValue%1000)/100)+48;
    toPrint[2] = ((theValue%100)/10)+48;
    toPrint[3] = (theValue%10)+48;
    
    SetPos(x,y);
    PutChar(toPrint[0]);
    PutChar(toPrint[1]);
    PutChar(toPrint[2]);
    PutChar(toPrint[3]);
}
I believe this is faster than using sprintf.
superbrew is offline  
Old 12th March 2009, 02:14 AM   #95
Default

The sprintf function in C18 does not support floating point. I suggest you look around for a ftoa function.

Mike.
Pommie is online now  
Old 12th March 2009, 05:21 AM   #96
Default

I had a play with this and here is the result. A quick and dirty ftoa routine.

Code:
void ftoa(float f,char* String,char Places){
long power;
char n,i;
    power=1;
    while(power*10<=f)
        power*=10;
    while(power>=1){
        n=(char)(f/power);
        f-=n*power;
        power/=10;
        *String++=n+'0';
    }
    *String++='.';
    for(i=0;i<Places;i++){
        f*=10;
        n=(char)f;
        f-=n;
        *String++=n+'0';
    }
    *String=0;
}
If you're sure your number will never go over 99,999 then you can change power to an int.

Mike.
Pommie is online now  
Old 22nd March 2009, 09:35 PM   #97
Default

Hi AtomSoft, I used your function void loadimg(rom char *image); and the mikroelectronica bitmap generator, I'm using C18 compiler, but when I build the project I have this message of error: Error - section '.idata_main.o' can not fit the section. Section '.idata_main.o' length=0x00000400

Waht can I do? thanks
juanog is offline  
Old 22nd March 2009, 09:44 PM   #98
Default bmp to C

Please Pommie can you convert my logo to use in GLCD...thanks
Attached Images
 
juanog is offline  
Old 22nd March 2009, 09:45 PM   #99
Default

Ive been out of the field for a while but if i remember its a memory issue.Like a linker issue.Ask pommie or futz.They helped me with a similar issue. If i remember ill be sure to post the information for you.
AtomSoft is online now  
Old 23rd March 2009, 12:10 AM   #100
Default

Try reading this: Microchip Technology User Forums
superbrew is offline  
Old 23rd March 2009, 02:27 AM   #101
Default

Quote:
Originally Posted by juanog View Post
Please Pommie can you convert my logo to use in GLCD...thanks
Try this,
Code:
const rom unsigned char Logo[]={
    35,58,
    0x20,0x01,0x00,0x00,
    0xA0,0x03,0x00,0x20,
    0x01,0x00,0x00,0x00,
    0x08,0x10,0x00,0x00,
    0x00,0x00,0x00,0x00,
    0x90,0x00,0x08,0x01,
    0x00,0x00,0x00,0x00,
    0x00,0x21,0x00,0x40,
    0x00,0x16,0x00,0x08,
    0x09,0x20,0x12,0x00,
    0xF2,0x80,0x10,0x00,
    0x80,0x08,0x89,0x04,
    0x08,0xBC,0x54,0x00,
    0x40,0x40,0x12,0x02,
    0x00,0x30,0x0A,0x08,
    0x09,0x10,0x00,0x1C,
    0x02,0x80,0xB4,0x45,
    0x3E,0x00,0x04,0x00,
    0x01,0x10,0x40,0x00,
    0x18,0x00,0x80,0x8E,
    0x02,0x66,0x0B,0xD4,
    0x00,0x84,0xAC,0xA0,
    0x0D,0x08,0xAC,0x85,
    0x6B,0x00,0x60,0x2D,
    0xF0,0x04,0x00,0xAB,
    0x63,0x14,0x00,0x58,
    0x0F,0xB5,0x01,0xC0,
    0x9A,0xC1,0x08,0x00,
    0xD6,0xCB,0x3A,0x00,
    0xB0,0x02,0x6A,0x02,
    0x80,0x95,0xD2,0x13,
    0x00,0xB2,0x04,0x77,
    0x00,0x60,0x24,0x44,
    0x03,0x80,0x1A,0xC1,
    0x23,0x00,0xD2,0x08,
    0x23,0x02,0xC0,0x49,
    0xD0,0x2A,0x80,0x59,
    0x02,0x49,0x03,0xE8,
    0x12,0x38,0xF7,0x5A,
    0x8F,0x40,0x5A,0xAD,
    0x3B,0x04,0x4A,0x00,
    0x26,0xA4,0x90,0x47,
    0x50,0x87,0x84,0x02,
    0x22,0xD1,0x03,0xE4,
    0x49,0xD5,0x19,0xA0,
    0xA2,0x08,0xF2,0x00,
    0x2D,0xA7,0x64,0x01,
    0x48,0x96,0x5A,0x1C,
    0x40,0x73,0x45,0xB2,
    0x00,0x75,0xCE,0x68,
    0x02,0x70,0x8C,0x68,
    0x29,0x00,0x10,0x2B,
    0xB4,0x00,0x60,0x9A,
    0x7E,0x01,0x00,0x96,
    0x56,0x0E,0x00,0x98,
    0x43,0x0F,0x00,0x40,
    0x13,0x84,0x01,0x90,
    0x4A,0xD0,0x36,0x00,
    0x00,0x48,0x00,0x00,
    0x98,0x01,0x4C,0x51,
    0x60,0x4D,0x80,0x2A,
    0x05,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,
    0x00,0x00
};
As I said the code I wrote is a bit clunky and so I may have made a mistake. Let us know if it works.

Mike.
Pommie is online now  
Old 25th March 2009, 02:04 PM   #102
Default

Hello,

I want to display a "int". I have used the function of SuperBrew (displayNUM)
Code:
void displayNum(int x, int y, int theValue) {
    char toPrint[4];
    
    toPrint[0] = (theValue/1000)+48;
    toPrint[1] = ((theValue%1000)/100)+48;
    toPrint[2] = ((theValue%100)/10)+48;
    toPrint[3] = (theValue%10)+48;
    
    SetPos(x,y);
    PutChar(toPrint[0]);
    PutChar(toPrint[1]);
    PutChar(toPrint[2]);
    PutChar(toPrint[3]);
}

I use it like this:
Code:
int BacklightType;
[...]
BacklightType++;
[...]
displayNum(50,40, BacklightType);
but I get this when I try to display "10" (see photo)
I guess I have "0010" but my character does nothing ...

I also post my glcd.c so you can see my function "putchar". But I find the strange outcome ...
Have you any idea?

Thank you in advance
Attached Thumbnails
Unicorn GLCD demo.-000_0323.jpg  
Attached Files
File Type: c GLCD.c (21.0 KB, 31 views)
jorg1n is offline  
Old 30th March 2009, 07:24 AM   #103
Default

Hello,

I return to you because I managed to correct my error display (declaration problem of my variables), but I would now like to add a function to write in large letters .. But I can not find a solution ..
I thank you in advance
jorg1n is offline  
Old 30th March 2009, 02:16 PM   #104
Default

to write in large letters you have to make a new font. larger
AtomSoft is online now  
Old 30th March 2009, 03:07 PM   #105
Default

Hello AtomSoft,

I already create a new policy of width 8 and height 13, but I don't know how to use this. I want to make a function "putchar" to display the font. Could you help me? Will you or may already be a policy of this kind with a function call?
Thank you in advance

I have another problem, I use the function to display a "INT" of SuperBrew, but sometimes it displays symbols like my previous photo! and sometimes it works, would you also an idea about this problem?

Thank you in advance AtomSoft
jorg1n is offline  
Reply

Tags
demo, glcd, unicorn

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Unicorn Oscilloscope running GLCD 128x64 & Photo blueroomelectronics Micro Controllers 8 18th June 2007 03:06 PM
Help understanding the Unicorn Kyle-s4h Micro Controllers 2 5th June 2007 07:09 PM
Open MultiSim DEMO Files mayo General Electronics Chat 1 3rd May 2007 04:52 PM
mcuStudio an Eclipse based IDE for PIC: flash demo available octal Micro Controllers 0 23rd August 2006 06:44 AM
Honeywell HMR3000 DEMO KIT shermaine General Electronics Chat 5 26th May 2005 09:35 AM



All times are GMT. The time now is 12:27 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker