View unanswered posts | View active topics It is currently Wed Jul 23, 2014 4:29 am



Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next
 temperature 
Author Message

Joined: Mon Sep 27, 2010 5:26 pm
Posts: 85
How can I read the DS temperature?
I know there are 2 sensors in the screens but what is the code for reading the temperature?

I found this in libnds/include/nds/arm7 touch:
Code:
uint32 touchReadTemperature(int * t1, int * t2);

But what does it give me? What information?


Tue Nov 02, 2010 9:12 pm
Profile

Joined: Tue Jul 20, 2010 2:55 pm
Posts: 7
like this:
Code:
int t1,t2;
u32 temp=touchReadTemperature(&t1, &t2);
printf("%.2f\n",(double)temp/0x1000);


Of course in actual code you need to transfer temp to ARM9 using fifo or IPC.


Fri Nov 05, 2010 4:08 am
Profile

Joined: Mon Sep 27, 2010 5:26 pm
Posts: 85
Quote:
Of course in actual code you need to transfer temp to ARM9 using fifo or IPC.


What did you mean? Can you explain me what I have to do if I want to include this code
Code:
int t1,t2;
                     u32 temp=touchReadTemperature(&t1, &t2);
                     printf("%.2f\n",(double)temp/0x1000);

in my script?


Sat Nov 06, 2010 2:21 pm
Profile

Joined: Wed Mar 31, 2010 6:05 pm
Posts: 212
I just added an example of user fifo. And lucky you, I used temperature to demonstrate it.

http://devkitpro.svn.sourceforge.net/vi ... /userfifo/


Sat Nov 06, 2010 11:08 pm
Profile

Joined: Mon Sep 27, 2010 5:26 pm
Posts: 85
thank you very much zermorus :D

But just one last question:
When I start your example on DS I get an endless list of nubers:
739 844 112842
...

And they change very fast... Is this the temperature? And how can I make it in °C and looks better?
Please help


Sun Nov 07, 2010 1:37 pm
Profile

Joined: Wed Mar 31, 2010 6:05 pm
Posts: 212
The temperature is fixed point 20.12 degrees celsius. If you can't figure out why there is an endless list of changing numbers then you've got the wrong hobby.


Sun Nov 07, 2010 10:53 pm
Profile

Joined: Mon Sep 27, 2010 5:26 pm
Posts: 85
Quote:
The temperature is fixed point 20.12 degrees celsius.


??
What did you mean with that?

And what does these numbers mean? They're are not given in degrees celsius/fahrenheit or Reaumur!
Quote:
739 844 112842


Mon Nov 08, 2010 8:14 pm
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 323
I will give you a hint...
Code:
int t1,t2;
u32 temp=touchReadTemperature(&t1, &t2);

then, look up "fixed point arithmetic"


Mon Nov 08, 2010 9:22 pm
Profile

Joined: Mon Sep 27, 2010 5:26 pm
Posts: 85
The temperature is given in detail, but what are these numbers in degrees celsius? I mean
how can get these numbers in °C???


Tue Nov 09, 2010 6:51 pm
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 323
Get ready here comes the baby spoon... temp is the temperature in degrees celcius in 20.12 fixed point - divide the number by 4096 (2 to the 12th power) to convert it to an integer.

Seriously though, asking for help and putting in no effort on your part is really annoying.


Wed Nov 10, 2010 12:02 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads