![]() |
Getting the battery voltage
Hi!
I would like to get the voltage of the battery in the code itself. I belive this is very possible, but I do not know how to do it. I have the voltage shown properly on the driver station. If anyone knows how to get the voltage I would appreciate it. |
Re: Getting the battery voltage
Since your jumper is setup correctly, you just need to read Analog Input #8
You'll need an OPEN in your BEGIN.VI, then simply do a GET from that analog input. |
Re: Getting the battery voltage
I have already tried that, and it gave me a value of 0, than it also gave me 0 on the driver station.
I will try that again. Meanwhile, any other suggestions? |
Re: Getting the battery voltage
The communication task already acquires Analog Input 8 on slot 1. I don't think the system will let you open it again.
You might be able to modify the Start Communication vi to save the battery voltage in a global variable for you. Find the case where it says "Read the battery voltage every 200ms." and try storing the result of the multiplication in the "0" case into a new global that you can read elsewhere in the project. |
Re: Getting the battery voltage
Quote:
|
Re: Getting the battery voltage
Alternately, just wire the 12V into another AI port and read that.
|
Re: Getting the battery voltage
Quote:
If you aren't seeing it on the driver station, you may be missing the jumper that selects it. |
Re: Getting the battery voltage
Here is the odd thing. Like the OP, we do not display the battery voltage on the drivers station. It worked just fine until we applied the last updates to both the cRio and the DS. Now it only gives us "0.00".
The jumper is on the outer two pins of the analog bumper, exactly where it was before the update. Other than that, everything works perfectly. Any ideas? |
Re: Getting the battery voltage
Quote:
|
Re: Getting the battery voltage
Quote:
It really seems odd to us. The ONLY thing we changed between when it worked and when it didn't was the curio firmware and the DS software. |
Re: Getting the battery voltage
we had an issue similar to this but the problem was intermittent, eventually traced it back to a flakey jumper, try changing it out see if that makes a difference
|
Re: Getting the battery voltage
Quote:
|
Re: Getting the battery voltage
Well, the jumper checked out normal. So now we are at a loss. We will have the robot out of the bag for four hours this Saturday, hopefully we can figure this out.
Does anyone else have any ideas what may be preventing this from working correctly? Again, it worked fine until we did the last cRio and DS updates. |
Re: Getting the battery voltage
Quote:
If you have both analog modules installed, you could read the battery voltage from the slot 2 module. -Joe |
Re: Getting the battery voltage
We've seen this before when the analog breakout itself went bad at MARC last year - we were helping the robot next to us and NO one could figure out why they weren't getting battery voltage - so we started swapping out hardware.
You might try swapping your analog breakout. |
Re: Getting the battery voltage
OK, found the root cause of our issue. The "Diagnostics" tab on the drivers station is what pointed us in the right direction.
It turns out that one of our new programmers, a true genius but not experienced at programing, had placed a call to AI8 in the begin.vi that no one knew about. We are not using his portion of the code, so it was deleted and now we have a voltage displayed on the drivers station!! |
Re: Getting the battery voltage
Quote:
Quote:
I'm glad you found the problem. I'm especially glad that you found it based on the diagnostic messages provided by the system. |
Re: Getting the battery voltage
Quote:
We were tearing our hair out, wait, no, I have no hair, over this one. We had swapped out the AI module, the breakout board and the jumper with no success. We were at a loss. The I remembered seeing the diagnostics tab. "What the heck" I thought, "lets see if it says anything helpful". Duhhhhhh, error on analog input, resource already in use. "Oh man, let's look at the code again". And there it was. It's funny, I have made a living for the last 28 years troubleshooting systems. I have found that error messages are not always helpful, but sometimes they are. I have found that familiarity with the system is your best tool. I must say though, this error message definitely was helpful. Add this one to the lesson book. |
Re: Getting the battery voltage
Quote:
Quote:
|
| All times are GMT -5. The time now is 22:02. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi