Go to Post I'm gonna go back to my corner and write some more code... - Kevin Watson [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 29-05-2006, 22:50
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: Vex Library and Sample Code

Quote:
Originally Posted by tacman1123
I'm hoping I'm missing something really obvious. I've looked though the ifi_*.c files, and the .h files, and everything is very low-level. I was using get_input(1) as an example, but I don't believe there is a get_input function. Is there one? If so, where is it?

Is there sample code somewhere that turns two motors on and goes for 5 seconds, or reads a switch (or even better, the remote control unit)? Right now, it looks like if you want to simply go forward for 5 seconds, you have immerse yourself in hundreds of lines of code. Again, I keep hoping there's some high-level function calls documented somewhere that I just can't see (again, beside the ones in EasyC).


Tac
oops. sorry, thought you were maybe talking about some existing easyC code about which i know nothing.

to test for a limit switch closed on pin 1 in the analog/digital section of the rc and then send the damped signal from channel 1 of the radio to a motor connected to motor port 1 on the rc, use

if (rc_dig_in01 == 0)
pwm01 = pwm_in1 / 5 + 100;

the names used are all defined in ifi_aliases.h. the code would probably go into user_routines.c which runs every 18.5 ms.
Reply With Quote
  #2   Spotlight this post!  
Unread 30-05-2006, 07:46
tacman1123 tacman1123 is offline
Registered User
AKA: Tac Tacelosky
FRC #1900
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Washington, DC
Posts: 17
tacman1123 is an unknown quantity at this point
Send a message via AIM to tacman1123
Re: Vex Library and Sample Code

Quote:
Originally Posted by foobert
to test for a limit switch closed on pin 1 in the analog/digital section of the rc and then send the damped signal from channel 1 of the radio to a motor connected to motor port 1 on the rc, use

if (rc_dig_in01 == 0)
pwm01 = pwm_in1 / 5 + 100;

the names used are all defined in ifi_aliases.h. the code would probably go into user_routines.c which runs every 18.5 ms.
This is exactly what I'm looking for -- thanks! Is there documentation on this anywhere, besides reading the source code comments? How does one know what rc_dig_in01, pwm01 and pwm_in1 are?

Or sample programs, simpler than the VexCode on vexlabs.com? Something like the GearToothTest that Brad has in WPILib, mentioned in the previous post?

Again, thanks very much, I feel like I'm at least getting closer to understanding how to program without EasyC.

Tac
Reply With Quote
  #3   Spotlight this post!  
Unread 31-05-2006, 08:25
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: Vex Library and Sample Code

Quote:
Originally Posted by tacman1123
This is exactly what I'm looking for -- thanks! Is there documentation on this anywhere, besides reading the source code comments? How does one know what rc_dig_in01, pwm01 and pwm_in1 are?

Or sample programs, simpler than the VexCode on vexlabs.com? Something like the GearToothTest that Brad has in WPILib, mentioned in the previous post?

Again, thanks very much, I feel like I'm at least getting closer to understanding how to program without EasyC.

Tac
arrrgh, you wouldn't believe the long insightful answer i had for you when my connection timed out...

the short answer is study the sample code and refer to the 18f8520 datasheet, (watch any ad for a prescription med on the tele for a list of possible side effects), and have a look at theEntropyWorks.com, (a fine example of good intentions and what becomes of them).

anyway, to use pin 1 for input initialize io1 = 1 and to set it to output io1 = 0. when the rc powers up all pins are set to input so that you need not worry that the attached chainsaw on your deathbot will gobble your arm before you can jump clear.

must go to work...
Reply With Quote
  #4   Spotlight this post!  
Unread 31-05-2006, 09:44
tacman1123 tacman1123 is offline
Registered User
AKA: Tac Tacelosky
FRC #1900
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Washington, DC
Posts: 17
tacman1123 is an unknown quantity at this point
Send a message via AIM to tacman1123
Re: Vex Library and Sample Code

Upgrading to EasyC 2.0 solved half my problem, as there is now a call GetRxInput(rx, channel) that gets the values I was looking for.

I think Brad Miller's WPILib will solve some of the rest of the problems, but I'll have to wait until that's out to see.

Thanks for your reply.

Tac
Reply With Quote
  #5   Spotlight this post!  
Unread 01-06-2006, 08:19
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: Vex Library and Sample Code

Quote:
Originally Posted by tacman1123
Upgrading to EasyC 2.0 solved half my problem, as there is now a call GetRxInput(rx, channel) that gets the values I was looking for.
i'm guessing that rx is receiver 1 or 2 and that channel is 1 through 6. since there's no way to return an error indication, if we get rx 10, channel 9, we'll just return the first channel from the first receiver.

Code:
unsigned char GetRXInput (unsigned char rx, unsigned char channel) {
  unsigned char bar;

  switch (rx * 6 + channel) {
    default:
    case 1 : bar = PWM_in1;  break;
    case 2 : bar = PWM_in2;  break;
    case 3 : bar = PWM_in3;  break;
    case 4 : bar = PWM_in4;  break;
    case 5 : bar = PWM_in5;  break;
    case 6 : bar = PWM_in6;  break;
    case 7 : bar = PWM_in7;  break;
    case 8 : bar = PWM_in8;  break;
    case 9 : bar = PWM_in9;  break;
    case 10 : bar = PWM_in10;  break;
    case 11 : bar = PWM_in11;  break;
    case 12 : bar = PWM_in12;  break;
  }
  return bar;
}
don't forget to include ifialiases.h.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-06-2006, 16:33
Vexguy365 Vexguy365 is offline
Registered User
FRC #0365
 
Join Date: May 2006
Location: Delaware
Posts: 4
Vexguy365 is an unknown quantity at this point
Re: Vex Library and Sample Code

I have tried writing the code in MPLab but have yielded disatsrous results. I have EasyC v.1 but lost my CD after unisntalling it . Can anyone e-mail me the install file on the CD? I still have all of my other info such as installation key etc. but need the install file one the CD to reinstall it. e-mail me at beattieboy@comcast.net. Thanks - VEXguy365
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
Vex Sensor Sample Code nonother FIRST Tech Challenge 2 08-05-2006 16:49
Is there a sample code? The Stargazer Programming 3 17-02-2005 19:22
sample limit switch code??? tml240 Programming 5 17-02-2004 17:13
Sample Code (Line travel) cgav Programming 1 21-01-2004 09:37
ADC problems with C library and new code Larry Barello Programming 1 09-01-2004 22:31


All times are GMT -5. The time now is 00:59.

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