Jump to content

C Conventions?


Recommended Posts

I just idly wonder if arguments and strings are supposed to follow the conventions, especially the \xdd format - I've played with the LCD routines and using "\x1D" as argument isn't understood .. while using the real character is.

 

So a "char *" variable cannot be initialized with the "\x0A" format, but have to be entered directly? I am not sure about this, but I would have thought \xDD to be ansi standard :)

 

Is there another way, if you want to make an argument for LCD_Printf(), that really creates the character you wish for?

 

/Mii, sweden.

Link to post
Share on other sites

Mil,

 

The lcd printf (lprintf) is only a mini printf, not a full blown one.

It could be more sophisticated, but it would use more code memory.

 

It can only output strings and numerical values.

 

It supports conversion specifiers:

%d - decimal

%X - hex

%b - binary (non Ansi standard)

 

It allows leading zeros and width to be specified:

 

lprintf( "bin numb:%08b", 0x32 );

 

Displays "bin numb:00100000".

 

\n always moves the cursor to start of the second line.

 

Use lcd_gotoxy( x, y ) to move the cursor else where.

 

 

Getting the character in a string is another matter, its nothing to do with lprintf.

 

Currently the only support format is "\32\16\23", the number after the \ is the decimal value. The compile does this conversion during compilation.

 

Hope that helps.

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...