Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 30th May 2008, 02:59 AM   (permalink)
Default LCD degree symbol with sprintf (BoostC)

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).
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 30th May 2008 at 03:00 AM.
futz is offline   Reply With Quote
Old 30th May 2008, 03:09 AM   (permalink)
Default

It's 223 decimal on a typical LCD.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 30th May 2008, 03:15 AM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
It's 223 decimal on a typical LCD.
Yes, $df = 223. That's why I mentioned it in my op. But I can't figure out how to get it displayed with sprintf. Sourceboost's sprintf is a little bit non-standard, and their docs on it aren't very thorough.

In assembler it would be very simple.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 30th May 2008 at 03:16 AM.
futz is offline   Reply With Quote
Old 30th May 2008, 03:20 AM   (permalink)
Default

ASCII degree symbol is 248, can you type <alt> 0223 in the quotes?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 30th May 2008, 03:26 AM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
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);
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 30th May 2008 at 03:28 AM.
futz is offline   Reply With Quote
Old 30th May 2008, 03:31 AM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
ASCII degree symbol is 248, can you type <alt> 0223 in the quotes?
<alt> is not a valid escape code for BoostC's sprintf (or any that I've used). All I get displayed is "<alt>223".
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 30th May 2008 at 03:32 AM.
futz is offline   Reply With Quote
Old 30th May 2008, 03:46 AM   (permalink)
Default

Quote:
Originally Posted by futz View Post
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);
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 30th May 2008 at 03:46 AM.
futz is offline   Reply With Quote
Old 30th May 2008, 04:14 AM   (permalink)
Default

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.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 30th May 2008 at 04:18 AM.
blueroomelectronics is offline   Reply With Quote
Old 30th May 2008, 04:26 AM   (permalink)
Default

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

Quote:
Originally Posted by blueroomelectronics View Post
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.
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground
BaCaRdi is offline   Reply With Quote
Old 30th May 2008, 04:31 AM   (permalink)
Default

Quote:
Originally Posted by BaCaRdi View Post
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. Now it fits all on one line again. Excellent!
Code:
		sprintf(string,"Temp: %u\223C",an2);
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline   Reply With Quote
Old 30th May 2008, 04:32 AM   (permalink)
Default

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
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 30th May 2008 at 04:35 AM.
blueroomelectronics is offline   Reply With Quote
Old 30th May 2008, 04:35 AM   (permalink)
Default

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
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground

Last edited by BaCaRdi; 30th May 2008 at 04:37 AM.
BaCaRdi is offline   Reply With Quote
Old 30th May 2008, 04:38 AM   (permalink)
Default

Yes but if your in windows trying the alt method that is exactly what you would get

Cheers Blue


-BaC

Quote:
Originally Posted by blueroomelectronics View Post
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
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground

Last edited by BaCaRdi; 30th May 2008 at 04:39 AM.
BaCaRdi is offline   Reply With Quote
Old 30th May 2008, 04:51 AM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics View Post
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.
Here are his notes. 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.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline   Reply With Quote
Old 30th May 2008, 05:07 AM   (permalink)
Default

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
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground

Last edited by BaCaRdi; 30th May 2008 at 05:17 AM.
BaCaRdi is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
College Degree: A Complete Waste so far DigiTan Chit-Chat 150 11th August 2008 06:14 PM
math.h and lib for BoostC? futz Micro Controllers 3 31st March 2008 05:29 AM
Symbol ? ATSRND General Electronics Chat 1 9th January 2008 03:04 AM
Final Year Electronics Degree Project rgraj Electronic Projects Design/Ideas/Reviews 2 25th March 2006 04:18 PM
What does this symbol mean? DJ_ReL@X! General Electronics Chat 6 24th October 2004 12:00 AM



All times are GMT. The time now is 12:40 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.