Go to Post You mean i can do something with the Kinect other than put large dents in wall with a robot? Rad.. - rachelholladay [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 27-09-2007, 11:36
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Programming a Devantech Magnetic Compass - CMPS03

You have datatyping issues. The result of Get_Analog_Value() (if its like the one in the '06 controller) returns an unsigned integer... and your dividing by a floating point... and assiging to an unsigned character!

You might try:

{
unsigned int temp;
temp = Get_Analog_Value(Compass);
temp *= 4023; //fraction version of
temp /= 1000; //your conversion factor - avoid floating point
pwm13 = (unsigned char)temp;
printf("%d", pwm13);
}
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interfacing a digital compass with the RC Kelly Electrical 14 27-09-2007 19:01
Where can I get a digital compass sensor? EHaskins Technical Discussion 6 26-09-2007 18:33
I2C Digital Compass Programming CyberWolf_22 Programming 7 03-01-2005 00:20
Political Compass Joshua May Chit-Chat 11 01-10-2004 22:32
Compass/direction sensor Frank(Aflak) Technical Discussion 10 06-04-2003 09:18


All times are GMT -5. The time now is 15:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi