Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LCD degree symbol with sprintf (BoostC)

Status
Not open for further replies.

futz

Active Member
Dumb question I'm sure, but how do I display a degree symbol ($df) on my LCD? I format my output with sprintf.
Code:
sprintf(string,"Temp: %u°C",an2);
That degree symbol in there was copied/pasted in. The LCD displays a hyphen (minus sign). :(
 
Last edited:
ASCII degree symbol is 248, can you type <alt> 0223 in the quotes?
It is? Thank you. I'll make a note!
EDIT: Whoops! 248 ($f8) does not work. I get a lowercase x with an "overscore" above it.

I fumbled on a way to do it. Had to split the line up into three separate outputs, but it works now.
Code:
		sprintf(string,"Temp: %u",an2);
		lcd_string(string);
		sprintf(string,"\xdf",0);
		lcd_string(string);
		sprintf(string,"C",0);
		lcd_string(string);
 
Last edited:
I fumbled on a way to do it. Had to split the line up into three separate outputs, but it works now.
Code:
		sprintf(string,"Temp: %u",an2);
		lcd_string(string);
		sprintf(string,"\xdf",0);
		lcd_string(string);
		sprintf(string,"C",0);
		lcd_string(string);

Got it down to two sends
Code:
		sprintf(string,"Temp: %u\xdf",an2);
		lcd_string(string);
		sprintf(string,"C",0);
		lcd_string(string);
 
Last edited:
You must type <alt> 223 on the number pad if I recall. Sometimes you need the leading zero. I've not used the method for ages.

PS I see on your site you've got one of dipmicros ICD2 clones, I wonder how Roman's going to make it 3.3V as it looks about the same as the Inchworm.

On a sidenote you can simply connect the Inchworm+ or Junebug to any 3.3V PIC as long as it has it's own 3.3V power supply and the PGC / PGD pins don't have analog.
 
Last edited:
223 is correct but with the alt method I think it depends on the font in windows. I know in windows you do need the leading zero, but they made a mess of the good old ascii table.lol I can use a 0176 to make this -->° Did I ever tell you I hate windows?..lol

-BaC

You must type <alt> 223 on the number pad if I recall. Sometimes you need the leading zero. I've not used the method for ages.
 
I just looked through the manual a bit does this work?
Code:
sprintf(string,"Temp: %u\223",an2);

I see \x is for hex and df is 223 in decimal, so I think the escape code is the \ and in the manual it says \xnn for hex and \nn for decimal so maybe it's just sprintf(string,"Temp: \223",an2); just curious now. lol
That works. :D Now it fits all on one line again. Excellent!
Code:
		sprintf(string,"Temp: %u\223C",an2);
 
The 223 is strictly for the LCD, it'll show up as who knows what in XP but the LCD should be happy.

Edit: glad it's working futz, plenty of smart folks hang around here. Nicely done BaCarDi
 
Last edited:
OOps I deleted this by mistake!..lmao
I'll put it back to make sense of your post futz, glad it worked out:)


-----------------------------------------------------------
I original said:

I just looked through the manual a bit does this work?
Code:
sprintf(string,"Temp: %u\223",an2);
I see \x is for hex and df is 223 in decimal, so I think the escape code is the \ and in the manual it says \xnn for hex and \nn for decimal so maybe it's just sprintf(string,"Temp: \223",an2); just curious now. lol
 
Last edited:
Yes but if your in windows trying the alt method that is exactly what you would get;)

Cheers Blue;)


-BaC

The 223 is strictly for the LCD, it'll show up as who knows what in XP but the LCD should be happy.

Edit: glad it's working futz, plenty of smart folks hang around here. Nicely done BaCarDi
 
Last edited:
PS I see on your site you've got one of dipmicros ICD2 clones, I wonder how Roman's going to make it 3.3V as it looks about the same as the Inchworm.
**broken link removed**. He's not exactly speeding ahead with the project as he has a PICkit 2 clone for sale now (and so doesn't really need the Stella anymore) and is very busy with other things.
 
OK now I am really curious, I'll bite and click the link..hehe

Ahhh I remember these days, now I will have to read up for a while..lol

EDIT:
Ok now I need to start using c again too...lol Damn that learning curve!
I really like that 2-wire LCD interface!

-BaC
 
Last edited:
I will say Stella looks familiar :)

As for the two wire LCD interface I had a SPI + 2 wire (4 wires) that I was going to use in a future kit design. I tied RW to gnd but used the 8 bit mode and standard mode 1 SPI . The E line was CS and RS was the other wire.
 
Ok now I need to start using c again too...lol Damn that learning curve!
Ya, I swore off C many years ago. Went back to assembler and wouldn't touch C. I remembered hating it. :p Then the dsPIC kind of forced me to get back into C programming and I realized I didn't hate it as much as I had remembered. Lately I'm doing nothing but C.

I really like that 2-wire LCD interface!
Me too. Think I'll build a board or two with 2-wire LCD circuits that I can plug into any PIC board or breadboard I'm using when I want a quick, easy LCD.
 
Very nice, I am too much a beginner to design anything nifty yet, hope to be their soon. Just a hobby as of now, but never know.

Maybe I will have to switch to that C complier, I am using ME's Pascal version right now, just because programed in pascal for a while so easier transition for me atm. I do allot in Linux in C of course mostly old school hacking, aka patching code..lol I also have their EasyPIC 5 board, and I like it allot, but as a company I think they are on the wrong track for the long haul. We'll see;)

-BaC
 
You talking Stella the drink or the board?..lol

-BaC
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top