Go to Post Pessimism and optimism are both contagious. - Taylor [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
  #1   Spotlight this post!  
Unread 10-05-2006, 01:44 AM
Kurt Jensen Kurt Jensen is offline
Registered User
FRC #1861
Team Role: Mentor
 
Join Date: Oct 2006
Rookie Year: 2007
Location: Aurora, Colorado
Posts: 1
Kurt Jensen is an unknown quantity at this point
WPIlib beta for VEX

Hi,
I downloaded the Beta version of WPILIB for vex found at
http://users.wpi.edu/~bamiller/WPILib/WPILib060719.zip
during early October 2006. I got it to only sort of work.

Using a mingw makefile and calling the microchip compiler that comes with easyc 1.1 and the vanilla vex programming kit, along with the version of the
makefile that Jeff Garbers had posted awhile back, I managed to get his example to compile, link, download and run motors- so far so good.

I then modified that makefile to point to a directory with the contents of WPILib060719.zip as follows:

#
# makefile to build manually-edited VeX C code using tools from easyC
#
# Originally hacked together by Jeff Garbers (jgarbers@mindspring.com)
# Attempted tweak for use with WPILib for Vex by Kurt Jensen
#


# Project name - this MUST be the name of your primary .C file. If you only
# have one C source module, this should be the only thing you'll need to edit
# to customize this makefile.

PROJ = cvexsample

# Desired project object files - add additional names of source modules here
# if you have split your project into multiple .c files.
#
# Example:
#
# PROJOBJS = $(PROJ).o our_subs.o control_stuff.o

PROJOBJS = $(PROJ).o

# Extra files generated by the compiler; we delete these on a "clean".

BYPRODUCTS = $(PROJ).cod $(PROJ).lst $(PROJ)

# Tool locations. Edit as necessary per your installation; theoretically the
# first one (root directory for easyC installation) should be all you'd need
# to change.
#
# NOTE use of the short pathname "progra~1" instead of "Program Files"
# to avoid problems with spaces and quotes.

EC = c:/progra~1/Intelitek/easyC

MCC18 = $(EC)/mcc18
CXX= $(MCC18)/bin/mcc18.exe
MPLINK= $(MCC18)/bin/mplink.exe
ILOADER= $(EC)/loader/iLoader.exe

# Directories where we look for libraries, header files, and such. Again, unless
# you've moved things around here these definitions should work for you.

MCC18LIB = $(MCC18)/lib
MCC18H = $(MCC18)/h

#VEX = $(EC)/VeX
#VEXOBJ = $(VEX)/Object
#VEXLIB = $(VEX)/Library


# We use the double-backslashes here because MP3LINK doesn't like the forward slashes
# in the link script name, and the linker script lives here...

WPILIB= C:\\Projects\\Vex\\WPIlib

# VeX-stock object files and library as included by easyC.

VEXOBJS = ifi_startup.o ifi_utilities.o printf_lib.o Start.o user_routines.o \
interrupts.o user_routines_fast.o user_api.o
VEXLIBS = Vex_alltimers.lib

WPILIBS = Vex_library.lib WPILibVex.lib

# Compiler flags

CXXFLAGS = -p18F8520 -i$(MCC18H) -i$(WPILIB) -i$(VEX)/UserAPI/ -Oi+

# Linker flags and script

LINKFLAGS = -l$(MCC18LIB) -l$(WPILIB) -o$(PROJ)
LINKSCRIPT = $(WPILIB)\\18f8520.lkr

# Target definition.

TARGET = $(PROJ).hex

# --------------------------------------------------------------------
# Rules start here
# --------------------------------------------------------------------

.c.o:
$(CXX) $(CXXFLAGS) $<

all: $(TARGET)

dl: $(TARGET)
$(ILOADER) /D=$(TARGET) /H /T

clean :
rm -f $(TARGET) $(PROJOBJS) $(BYPRODUCTS)


$(TARGET) : $(PROJOBJS)
$(MPLINK) $(LINKFLAGS) $(LINKSCRIPT) $(PROJOBJS) $(WPILIBS)

This has allowed me to compile and link with no complaints from the microchip compiler. I believe the linker is no longer looking at the libraries originally from vex, but only at the WPIlib libraries and object files. I then compile this code, and download it to the vex controller:

#define _VEX_BOARD
#undef _FRC_BOARD
#include "BuiltIns.h"

void main ( void )
{

TwoWheelDrive(3, 2); // initialize 2 wheel drive
PrintToScreen("Let's Go!\n");
while ( 1 )
{
Drive(50,0);
PrintToScreen("SetPWM\n");
}
}
It runs, and the text output can be seen in the serial terminal window in the downloader application, just as you would expect from the code. However, the motors just do not get any power. I tried calling SetPWM() in a similar fashion with no luck there either.

As a pot-shot, I tried adding this to the c source:

void IO_Initialization(void)
{
DefineControllerIO ( 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ) ;
}
There are 17 parameters in this call, and it compiles in Jeff Garber's example. The WPIlib prototype for this function seems to takes 18 parameters. I added another 0 into the parameter list, recompiled and downloaded, and got the same result - good serial communications back to the downloader window, but no motors.

I must just be missing something here, but I'm not sure what. Any advice regarding what I might be doing wrong would be appreciated.

Thanks to you guys putting this stuff out for guys like me to use. Your efforts are appreciated!

-Kurt
 


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 Announcement: FIRST Vex Challenge Extended for 2006-2007 KathieK FIRST Tech Challenge 14 07-30-2006 11:42 PM
WPILib - Library for robot programming BradAMiller Programming 7 06-21-2006 03:12 AM
Using WPILib on a Vex robot koenig3456 Programming 2 05-02-2006 02:56 PM
STAMP version 1.0 (NOT BETA) is out for week 1! Ethulin Scouting 5 03-01-2006 06:50 PM
Gmail Now Beta For Blogger.Com Users Joe Matt Chit-Chat 3 04-26-2004 05:10 PM


All times are GMT -5. The time now is 10:39 AM.

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