Reply by CBFalconer September 14, 20062006-09-14
tanu wrote:
> > Thanks alot for help > and ur suggetion to me > now i'll take care while wrtiting anything > actually i m new to google group so dont know and was bit in hurry to > write here > now ll xplain all the thing properly > after 3 hr bye thanx a lot bye
Don't use silly abbreviations in usenet. Do capitalize the first letters in sentences and the personal pronoun I. Do terminate sentences with periods. Failure to spell things properly simply marks you as childish and makes your articles hard to read. Most won't bother to read them. You are not using google groups, you are using usenet. Google only supplies a very poor interface to the usenet system. -- "I have a creative mind. You (singular) are eccentric. He is insane. We are losing sight of reality. You (plural) are smoking crack. They are certifiable." Declension of verbs, per Lewin Edwards -- Posted via a free Usenet account from http://www.teranews.com
Reply by tanu September 14, 20062006-09-14
Thanks alot for help
and ur suggetion to me
now i'll take care while wrtiting anything
actually i m new to google group so dont know and was bit in hurry to
write here
now ll xplain all the thing properly
after 3 hr bye thanx a lot bye

Reply by Tom Lucas September 13, 20062006-09-13
"tanu" <tanumeister@gmail.com> wrote in message 
news:1158148235.476036.290200@i3g2000cwc.googlegroups.com...
> hi all > i m using a 240*128 pix lcd with t6963c controller > wanna see the graphics in it > lcd is interfaced with atmega 128 microcontroller
By assigning 3840 bytes for the Bitmap buffer I assume you are using 1 bit per pixel black and white. I can't see a reason why the LCD array is the size it is 42240 bytes or why you need to define it. A frame buffer of 3840 will be plenty by itself.
> for graphics i thougt of converting the gif file to binary data so did > this
The files would definitely have to be treated as binaries when opening, although you shouldn't have to convert anything - fopen will handle that.
> i had 1st save the gif file in to the txt > so to get ascii data > before i aslo tried direct gif to binary
The gif won't map directly to your bitmap buffer - you will need to decode it. Why don't you start with a bitmap file until you get the hang of the display and then move onto compressed formats like gif.
> i m getting binary data rite acording to the txt file but when i m > seeing this data > in the lcd i m not getting that image > infact i had discarded the 22 bytes from the data
Do you mean that 22 bytes of the data were missing from the buffer or did you purposefully discard them. If so, why? Is this you stripping off the header? If you use bitmap data then you can just copy the data section of the file straight to the buffer. In windows bitmaps, the 32bit word in the 11th, 12th, 13th and 14th bytes of the file tells you how far from the start of the file the data begins. <snip code> Your code could really use some comments and some more meaningful variable names.
> so do tell me where m i wrong > and do tell if there is any other way to find the binary data
You may need "rb" in your fopen to open the file as a binary file. Other than that then you should have the binary data where you want it but I'm not convinced it will be data in the form you think it should be. And for goodness sake use capital letters and apostrophes - you're a big boy now.
Reply by Stef September 13, 20062006-09-13
In comp.arch.embedded,
tanu <tanumeister@gmail.com> wrote:
> hi all > i m using a 240*128 pix lcd with t6963c controller > wanna see the graphics in it > lcd is interfaced with atmega 128 microcontroller > > for graphics i thougt of converting the gif file to binary data so did > this > i had 1st save the gif file in to the txt > so to get ascii data > before i aslo tried direct gif to binary > i m getting binary data rite acording to the txt file but when i m > seeing this data > in the lcd i m not getting that image > infact i had discarded the 22 bytes from the data > >
I am sorry, but I'm unable to understand what exactly you have tried to do here. A GIF file is a graphics file in a specific format that you need to parse to get the image. See www.wotsit.org for the GIF file format. But you may want to start of with something like the BMP format as it is much easier to decode (also see wotsit for the format).
> #include <stdlib.h> > #include <stdio.h> > #include<conio.h>
This is a non-standard header, what is your platform?
> typedef unsigned char byte; > #define SIZEBMP 3840
240 * 128 / 8
> #define SIZELCD 42240
Where does this number come from?
> static int i; > int ig,jg; > unsigned char tg; > int y; > char kg[8]; > void convert(void); > //byte getvertByte(int ,int bit); > unsigned char getbits(unsigned x, int p, int n); > byte count, arrayLCD[SIZELCD], arrayBmp[SIZEBMP];
Why are these variable global?
> main()
int main(void)
> { > clrscr(); > FILE *fp; > > /* open the bitmap for reading in binary mode */ > > if ( (fp = fopen("\\compass22.txt", "r")) == NULL)
Binary mode? --> "rb"
> { > fprintf(stderr, "Error opening file."); > } >
Program gets here if open suceeded or not
> fp = fopen("\\compass22.txt", "r");
Open again? That will probably fail.
> fread(arrayBmp, sizeof( byte), SIZEBMP, fp); > for(ig=0;ig<SIZEBMP;ig++) > { > printf("%c",arrayBmp[ig]); > for(y=0;y<sizeof(char)*8;y++) > { > kg[y]=arrayBmp[ig] & (1<<y)?'1':'0'; > } > for(y=7,jg=0;y>=0,jg<8;y--,jg++) > { > printf("%c",kg[y]); > arrayLCD[11*ig+jg]=kg[y]; > } > if(jg==8) > {arrayLCD[11*ig+jg]=','; > jg++; > arrayLCD[11*ig+jg]='0'; > jg++; > arrayLCD[11*ig+jg]='b';} > } > printf("\n\n\n"); > > fclose(fp); >
Ok file now closed, your indentation makes it seem like it's in a loop, but it's not.
> if ( (fp = fopen("\\compass234.txt", "w+b")) == NULL) > { > fprintf(stderr, "Error opening file."); > exit(1);
Now you do something on an error,
> } > fp = fopen("\\compass234.txt", "wb");
But you als open the file twice, why? And in different modes this time.
> fwrite(arrayLCD, sizeof(byte), SIZELCD, fp); > for(ig=0;ig<SIZELCD;ig++) > { > printf("%c",arrayLCD[ig]); > } > fclose(fp); > > return(0); > } > > > so do tell me where m i wrong > and do tell if there is any other way to find the binary data >
You are not parsing the graphics file properly, read the stuff on wotsit. Your variable names seem to suggest you are using the BMP format but you say you are using GIF. -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail)
Reply by Boudewijn Dijkstra September 13, 20062006-09-13
Op Wed, 13 Sep 2006 13:50:35 +0200 schreef tanu <tanumeister@gmail.com>:
> hi all > i m using a 240*128 pix lcd with t6963c controller > wanna see the graphics in it
Is that a question? If not, and you omitted an "I" then the obvious remedy is: try looking at the display while it is faced upwards.
> lcd is interfaced with atmega 128 microcontroller > > for graphics i thougt of converting the gif file to binary data
Which gif file? Which binary format do you intend to use?
> so did this > i had 1st save the gif file in to the txt > so to get ascii data
Which txt? How?
> before i aslo tried direct gif to binary > i m getting binary data rite acording to the txt file but when i m > seeing this data > in the lcd i m not getting that image
Please rephrase this part, using proper sentences and without "rite", which is not a word.
> infact i had discarded the 22 bytes from the data
Which 22 bytes? Why did you discard them?
> [...program code...]
Which platform was this code designed to run on? What did you expect of the program?
> so do tell me where m i wrong > and do tell if there is any other way to find the binary data
You are wrong in the assumption that we are your personal slaves. You are wrong in the assumption that most people will easily understand what you are talking about. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/
Reply by tanu September 13, 20062006-09-13
hi all
i m using a 240*128 pix lcd with t6963c controller
wanna see the graphics in it
lcd is interfaced with atmega 128 microcontroller

for graphics i thougt of converting the gif file to binary data so did
this
i had 1st save the gif file in to the txt
so to get ascii data
before i aslo tried direct gif to binary
i m getting binary data rite acording to the txt file but when i m
seeing this data
in the lcd i m not getting that image
infact i had discarded the 22 bytes from the data


#include <stdlib.h>
#include <stdio.h>
#include<conio.h>
typedef unsigned char byte;
#define SIZEBMP 3840
#define SIZELCD 42240
static int i;
int ig,jg;
unsigned char tg;
int y;
char kg[8];
void convert(void);
//byte getvertByte(int ,int bit);
unsigned char getbits(unsigned x, int p, int n);
byte count, arrayLCD[SIZELCD], arrayBmp[SIZEBMP];
main()
{
clrscr();
FILE *fp;

/* open the bitmap for reading in binary mode  */

     if ( (fp = fopen("\\compass22.txt", "r")) == NULL)
     {
	 fprintf(stderr, "Error opening file.");
     }

fp = fopen("\\compass22.txt", "r");
fread(arrayBmp, sizeof( byte), SIZEBMP, fp);
for(ig=0;ig<SIZEBMP;ig++)
  {
  printf("%c",arrayBmp[ig]);
  for(y=0;y<sizeof(char)*8;y++)
   {
   kg[y]=arrayBmp[ig] & (1<<y)?'1':'0';
   }
 for(y=7,jg=0;y>=0,jg<8;y--,jg++)
   {
   printf("%c",kg[y]);
   arrayLCD[11*ig+jg]=kg[y];
   }
  if(jg==8)
    {arrayLCD[11*ig+jg]=',';
    jg++;
    arrayLCD[11*ig+jg]='0';
    jg++;
    arrayLCD[11*ig+jg]='b';}
    }
    printf("\n\n\n");

       fclose(fp);

     if ( (fp = fopen("\\compass234.txt", "w+b")) == NULL)
     {
	 fprintf(stderr, "Error opening file.");
	 exit(1);
     }
  fp = fopen("\\compass234.txt", "wb");
  fwrite(arrayLCD, sizeof(byte), SIZELCD, fp);
  for(ig=0;ig<SIZELCD;ig++)
   {
   printf("%c",arrayLCD[ig]);
   }
      fclose(fp);

    return(0);
}





so do tell me where m i  wrong
and do tell if there is any other way to find the binary data