temperature

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: temperature

Post by zeromus » Wed Dec 01, 2010 4:27 am

filling you guys in on what you don't know would take an entire textbook. the only specific guidance i can offer is to use the example in SVN and use it as a starting point, since you don't understand how to extract the relevant parts.
How about a yes/no question: can someone just type a few lines of code (or less) to read the temp sensors? I'm not even talking about gaining a ºC value from them, just reading them directly.
Yes. Be sure to type it into an arm7 program. Youve seen it already in this thread.
when you outgrow printf then advance to glut or sdl. thatll keep a fellow busy for a couple of years.
Great job showing off your vocabulary. Now say something useful.
You wouldn't know useful if it smacked you in the face. There wasnt vocabulary there, just a concise educational program which has serviced thousands of game programmers very well.

Jordan_Gray
Posts: 23
Joined: Sat Jun 12, 2010 3:31 am

Re: temperature

Post by Jordan_Gray » Wed Dec 01, 2010 4:08 pm

You wouldn't know useful if it smacked you in the face. There wasnt vocabulary there, just a concise educational program which has serviced thousands of game programmers very well.
That's the point. I am a newb. You are not. When you say something like that to us new people, it is really not helpful because we don't know what it means, and it just makes things more complicated.

ritz
Posts: 24
Joined: Thu Jun 04, 2009 3:17 pm
Location: Canada

Re: temperature

Post by ritz » Wed Dec 01, 2010 4:29 pm

This thread was finished on the first page and everything else should be deleted. Help was asked for, and appropriate help was given (in the context of programming on the DS).

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: temperature

Post by zeromus » Wed Dec 01, 2010 5:43 pm

Jordan_Gray wrote:
You wouldn't know useful if it smacked you in the face. There wasnt vocabulary there, just a concise educational program which has serviced thousands of game programmers very well.
That's the point. I am a newb. You are not. When you say something like that to us new people, it is really not helpful because we don't know what it means, and it just makes things more complicated.
The educational program had two steps. When you've completed the first step, youll know what the second step means. Until then, why should you expect to understand it?

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: temperature

Post by Izhido » Fri Dec 03, 2010 7:13 pm

Seriously, guys.

This isn't going anywhere.

Please resume the discussion about temperature reading (and this time, do it with sensible, reasonable arguments), or I'll be forced to move this pointless topic to "Offtopic" (or worse yet, delete the topic), since it's not helping *anyone* to improve his/her skills at DS programming.

Will you, please?

lazyprogramer
Posts: 85
Joined: Mon Sep 27, 2010 5:26 pm

Re: temperature

Post by lazyprogramer » Fri Dec 03, 2010 9:52 pm

Yeah, let's talk about the temperature!

Sepreath
Posts: 2
Joined: Thu Dec 16, 2010 3:50 pm

Re: temperature

Post by Sepreath » Thu Dec 16, 2010 4:56 pm

lazyprogrammer fixed point maths:

[all of this assumed you are using unsigned ints]

your number 112842 is represented using 20.12 fixed point.
On the DS int = 32 bits. Notice 20+12=32! What is means
is that the first 20 bits of 112842 represent the whole part
of the temperature number and the last 12 represent the
fractional part.

112842 =
000000000000011011100011001010

000000000000011011 = 27
100011001010 = 2250

The answer however is NOT 27.2250 The fractional part must
be converted before we can use it. The whole part can be used
as it is.

To convert the fractional part into decimal you take the number
of bits that are used for the fractional part of the number. 12 in
our case and do this 2^12 = 4096.

2250 / 4096 = ~0.55

So our answer is 27.55 C

You can divide the entire number by 2^12 and get the same answer.
I thought I'd show you how it was worked out first.

16.16 floating point would therefore use:
16 bits for the whole part of the number
16 bits for the fractional part
and to convert you would use 2^16 which is 65536

User avatar
vuurrobin
Posts: 222
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: temperature

Post by vuurrobin » Thu Dec 16, 2010 9:50 pm

wow, 4 pages of talk and nobody asked why he needs the temperature in the first place...

anyway, people who want to learn what fixed point math is should read this:
http://www.coranac.com/tonc/text/fixed.htm

as for the u32 type:
http://libnds.devkitpro.org/a00132.html

as for the temperature itself: the temperature registers can only be read from the arm7 processor while you normally program just for the arm9 and use a default arm7 binary. so you would have to write a custom arm7 binary to read the temperature, use the fifo (which, in the context of libnds, is the mechanism that libnds uses for arm7<->arm9 communication) to send the temperature to the arm9 and print it from there. seeing as creating custom arm7 code and processor communication isn't exactly beginners stuff, I suggest you continue with some simpler stuff first or find an other solution for your problem. which brings us to the question that should have been asked first:

lazyprogramer, why do you need the temperature?

lazyprogramer
Posts: 85
Joined: Mon Sep 27, 2010 5:26 pm

Re: temperature

Post by lazyprogramer » Fri Dec 17, 2010 2:38 pm

Thank you, Sepreath and vuurrobin!
Man! This is very difficult!
lazyprogramer, why do you need the temperature?
I wondered that the DS can read the temperatur, this was very surprising! So I wanted to know how to
code the reading of temperatur! I find it's still a funny small feature and I wanted to use this little feature
in a project. I'm from Germany and I did not finished school yet ,so sometimes it's hard to understand how to code
something...

Sepreath
Posts: 2
Joined: Thu Dec 16, 2010 3:50 pm

Re: temperature

Post by Sepreath » Fri Dec 17, 2010 3:10 pm

Some reading material for you:
Fixed point maths

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests