OCCRA
Go to Post Maybe there's some reason that makes it not that simple... - Cory [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-13-2006, 08:10 PM
DavidSJohnson DavidSJohnson is offline
Registered User
#0133
 
Join Date: Feb 2005
Location: Buxton, Maine
Posts: 3
DavidSJohnson is an unknown quantity at this point
How to obtain battery voltage from within EasyC

I read where battery level could be obtained using a define within ifi_aliases.h, but that header is not available within EasyC. Is there some way of getting battery level (and maybe backup battery level too) from within EasyC?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-13-2006, 11:04 PM
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 537
BradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud of
Re: How to obtain battery voltage from within EasyC

Quote:
Originally Posted by DavidSJohnson
I read where battery level could be obtained using a define within ifi_aliases.h, but that header is not available within EasyC. Is there some way of getting battery level (and maybe backup battery level too) from within EasyC?
There are two functions recently added to WPILib (the runtime system for EasyC). These functions read the main and backup battery in 1/100ths of volt. The functions are:

unsigned GetBackupBattery(void) and

unsigned GetMainBattery(void)

You need to replace the copy of WPILib to get access to the functions. You also need to add the include file, "BuiltIns.h". The procedure is described elsewhere on this forum. Once you do that, then you can call these functions using User Code blocks.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #3   Spotlight this post!  
Unread 02-13-2006, 11:05 PM
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
None #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 662
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Send a message via AIM to Chris_Elston Send a message via Yahoo to Chris_Elston
Re: How to obtain battery voltage from within EasyC

Quote:
Originally Posted by DavidSJohnson
I read where battery level could be obtained using a define within ifi_aliases.h, but that header is not available within EasyC. Is there some way of getting battery level (and maybe backup battery level too) from within EasyC?

I think this is what you're going to need to do:

Go here:
http://users.wpi.edu/~bamiller/WPILib/Versions.html

Download this:
Version 060207

Unpack the .zip file and replace the copy of WPILIb.lib inside of the EasyC directory C:\Program Files\Intelitek\easyC for FRC\Frc\18F8722 with the copy of WPILib2k6.lib from the .zip file. (You'll need to rename WPILib2k6.lib to WPILIb.lib and over write the OLD "WPILIb.lib" file. Backup the old one FIRST. You need to do this for both 2005 controller and 2006 sub directories.

18F8722 = 2006 controller
18F8520 = 2005 controller

These two files need updated:
C:\Program Files\Intelitek\easyC for FRC\Frc\18F8722\WPILIb.lib
with
WPILib2k6.lib (rename this to WPILIb.lib, copy over the top of the old after backing it up)

and

C:\Program Files\Intelitek\easyC for FRC\Frc\18F8520\WPILIb.lib
with
WPILib2k5.lib (rename this to WPILIb.lib, copy over the top of the old after backing it up)


Start easyC

Make a USER CODE box or an ASSIGNMENT BOX, but you'll have to type it out, and put this in it:

myvariblebackupbattery = GetBackupBattery()
myvariblemainbattery = GetMainBattery()

There are two new functions to read the main and backup battery in 1/100ths of volt.

Good luck. Hopefully it will work for you.



-
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
Reply With Quote
Reply


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
Reading battery voltage in software RbtGal1351 Programming 17 10-21-2007 12:07 PM
battery voltage compensation Rickertsen2 Programming 5 10-17-2005 09:12 PM
RC Circuits Melissa Nute Math and Science 3 01-25-2004 04:02 AM
Battery Chargers Neal Probert Electrical 46 02-16-2003 09:31 PM


All times are GMT -5. The time now is 09:35 AM.

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


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