Autor Tema: Símbolos en la programación de un LCD  (Leído 3964 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado ramirez

  • PIC16
  • ***
  • Mensajes: 195
Símbolos en la programación de un LCD
« en: 15 de Junio de 2009, 13:49:07 »
Hola a todods de nuevo, quisiera preguntar donde puedo encontrar el significado de los símbolos que aparecen a la hora de utilizar un LCD, aunque conozco el significado de alguno de ellos, cada vez veo más que no conozco como ejemplo: printf(lcd_putc,"\fFecha: %2X/%2X/%2X\nHora: %2X:%2X:%2X",day,mth,year,hour,min,sec); o /n, /f , %3u, etc.

Gracias de nuevo por vuestra colaboración.

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Símbolos en la programación de un LCD
« Respuesta #1 en: 15 de Junio de 2009, 14:02:56 »
Parámetros especiales de la función lcd_putc:
"\f" -> Borra display y coloca cursor en el origen.
"\n" -> Salta a la siguiente linea.
"\b" -> Mueve cursor a la izquierda


Parámetros de la función printf:
Cita de: Ayuda CCS
Syntax:
 printf (string)
   or
printf (cstring, values...)
   or
printf (fname, cstring, values...)

fprintf (stream, cstring, values...)

 
Parameters:
 String is a constant string or an array of characters null terminated. Values is a list of variables separated by commas, fname is a function name to be used for outputting (default is putc is none is specified).  Stream is a stream identifier (a constant byte)
 
Returns:
 undefined
 
Function:
 Outputs a string of characters to either the standard RS-232 pins (first two forms) or to a specified function.  Formatting is in accordance with the string argument.  When variables are used this string must be a constant.  The % character is used within the string to indicate a variable value is to be formatted and output.  Longs in the printf may be 16 or 32 bit.  A %% will output a single %.  Formatting rules for the % follows.

If fprintf() is used then the specified stream is used where printf() defaults to STDOUT (the last USE RS232).

Format:

The format takes the generic form %nt. n is optional and may be 1-9 to specify how many characters are to be outputted, or 01-09 to indicate leading zeros, or 1.1 to 9.9 for floating point and %w output. t is the type and may be one of the following:
c
 Character
 s
 String or character
 u
 Unsigned int
 d
 Signed int
 Lu
 Long unsigned int
 Ld
 Long signed int
 x
 Hex int (lower case)
 X
 Hex int (upper case)
 Lx
 Hex long int (lower case)
 LX
 Hex long int (upper case)
 f
 Float with truncated decimal
 g
 Float with rounded decimal
 e
 Float in exponential format
 w
 Unsigned int with decimal place inserted. Specify two numbers for n. The first is a total field width. The second is the desired number of decimal places.

Ejemplos:
int data=10;
printf(lcd_putc,"%u",data);
10

int data=10;
printf(lcd_putc,"%03u",data);
010

int data=10;
printf(lcd_putc,"%X",data);
A

float data=1.3;
printf(lcd_putc,"%1.1f",data);
1.3

« Última modificación: 15 de Junio de 2009, 14:06:43 por Suky »
No contesto mensajes privados, las consultas en el foro

Desconectado ramirez

  • PIC16
  • ***
  • Mensajes: 195
Re: Símbolos en la programación de un LCD
« Respuesta #2 en: 17 de Junio de 2009, 19:12:04 »
Y la siguiente instrucción, ¿qué significa,"\n %d ~ %s",?

printf(lcd_putc,"\n %d ~ %s",dir,read_ext_eeprom(dir));


Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Símbolos en la programación de un LCD
« Respuesta #3 en: 17 de Junio de 2009, 19:14:18 »
\n salta a la siguiente linea, %d Muestra el valor de dir que es un decimal y %s Muestra el estring de read_ext_eeprom(dir)
No contesto mensajes privados, las consultas en el foro


 

anything