Go to Post In conclusion we will have a spaghetti game - Darkseer54 [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-10-2007, 00:52
Abrakadabra Abrakadabra is offline
Here We Go !!!
AKA: Scott Kukshtel, Mr. K
FRC #3467 (The Windham Windup!)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Windham, New Hampshire
Posts: 160
Abrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant future
Re: WPILib & Analog/Digitial IO Split on Vex

Hi Vince,
Looks like traffic is a bit light in this forum lately. I just started working with WPILib this summer, and this one had me confused for a bit too. So, even if you've already figured it out, I thought an answer would be helpful for others who might hit the same issue.

The key is to look at the API.h header file. There you will see an function that for some reason is not mentioned in the .PDF documentation. DefineControllerIO() not only lets you specify the I/O direction for each port, but on the Vex also lets you specify as the first argument the number of analog channels to be used:

Code:
#ifdef _FRC_BOARD
void DefineControllerIO(unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4,
                        unsigned char p5, unsigned char p6, unsigned char p7, unsigned char p8,
                        unsigned char p9, unsigned char p10, unsigned char p11, unsigned char p12,
                        unsigned char p13, unsigned char p14, unsigned char p15, unsigned char p16,
                        unsigned char p17, unsigned char p18);
#endif // _FRC_BOARD
#ifdef _VEX_BOARD
void DefineControllerIO(unsigned char numberOfAnalogChannels,
                        unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4,
                        unsigned char p5, unsigned char p6, unsigned char p7, unsigned char p8,
                        unsigned char p9, unsigned char p10, unsigned char p11, unsigned char p12,
                        unsigned char p13, unsigned char p14, unsigned char p15, unsigned char p16);
#endif // _VEX_BOARD
The first n channels will be analog, where n is the first parameter of the Vex-specific function. Although I haven't actually tried it, I assume you could make all 16 channels analog in this way if you so desired.

Hope this helps!
Closed Thread


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
WPILib & Camera colors & data Thanatos Programming 2 19-02-2007 01:15
WPIlib beta for VEX Kurt Jensen Programming 0 05-10-2006 01:44
Using WPILib on a Vex robot koenig3456 Programming 2 02-05-2006 14:56
IRI VEX Q&A Kyle Love Off-Season Events 0 08-07-2005 23:51
VEX & FIRST in Newsweek! Rich Wong FIRST In the News... 2 22-03-2005 13:36


All times are GMT -5. The time now is 03:26.

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