The following line
what I get is that I'm printing the size of mytext array - 1?Code:printf( (char*) &mytext[0], sizeof(mytext) -1);
The following line
what I get is that I'm printing the size of mytext array - 1?Code:printf( (char*) &mytext[0], sizeof(mytext) -1);
You are printing the first string contained in what appears to be an array. In that string, there is a formatting character (maybe %d or %i or %u) that is expecting the defined size of your array, less the null terminating character.
Mainframe assembler programmer by trade. C coder when I can.
Are you kidding? Where are the printf() format specifiers? And what is the array type for mytext[]?
The string is something like this.
What do you mean kidding? can't we ask questions here if we don't know the answer?
Code:const char mytext[] = " dsPIC33F Demo ";
That doesn't make sense. First of all, (char*)&mytext[0] can be rewritten as just mytext. Secondly, since you are passing a second parameter to printf(), the first parameter should contain a format specifier (like %d). The text " dsPIC33F Demo " doesn't have any format specifiers, so why are you passing a second parameter to printf()?
bit∙hub [bit-huhb] n. A source and destination for information.
Given that string the result will be the same as:
This will just print the mytext string. The second parameter will be ignored. The conversion to char * is pointless here.Code:printf(" dsPIC33F Demo ",15);
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
This is how it originally was and the I added the printf.
Code:void Update_LCD( void ); const char mytext[] = " dsPIC33F Demo "; const char mytext1[] = "Press S3 to cont"; const char time_msg[] = "Time 00: 00: 00 "; const char adc_msg1[] =" RP5 = 0.00 Vdc "; int main ( void ) { /* Welcome message */ home_clr(); puts_lcd( (char*) &mytext[0], sizeof(mytext) -1 ); line_2(); puts_lcd( (char*) &mytext1[0], sizeof(mytext1) -1 );Code:void puts_lcd( unsigned char *data, unsigned char count ) { while ( count ) { lcd_data( *data++ ); count --; } }
Last edited by drkidd22; 12-09-2009 at 08:21 PM.
Well "puts_lcd" is not the same thing as printf. It looks more like a fwrite style...
Quzah.
Hope is the first step on the road to disappointment.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.