Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Welcome to the WPILib forum (http://www.chiefdelphi.com/forums/showthread.php?t=42036)

BradAMiller 05-02-2007 10:09

Re: Mixing WPILib with default MPLAB code
 
Quote:

Originally Posted by michael714 (Post 571615)
Dear Brad,
I've been trying to do it myself. I added the 2k5 files including API.h, UserAPI.h, and WPILIb2k5.lib to Kevin Watson's edu_camera code and the compiler was able to do everything with no errors or warnings except from the Linker at the end and it looked like this:

Error - section 'InterruptVectorLow' type is non-overlay and absolute but occurs in more than one input file.

Yeah, that's the crux of the problem. You are seeing that the default code and WPILib each want to control the interrupt vectors. It's pretty easy to write some code that tracks the green target using WPILib, but I think it would be some work to modify Kevin's project to be compatible. You would probably want to use the WPILib camera driver and have it deliver t-packets to his higher level code. It's kind of like trying to run LINUX and Windows on the same computer.

If you are interested in trying to port the code, I'd be happy to help in any way that I can.

WPILib (and easyC) have a different philosophy of device support from the default code, and Kevin's work is based on the default code. In WPILib all the interrupt handling and timing are handled from a single kernel much like an operating system. When other devices want to get interrupt support, either interrupt pins, serial ports, or timers, they just make calls to the kernel to register their "interest". Then when the interrupts happen, the kernal calls the interrupt service routines in the device driver. The reason it works this way is that the device drivers are completely independent of each other. So you could write your own camera driver while leaving everything else unchanged and you wouldn't have to change your application at all.

The default code doesn't work this way - it's a monolithic application that runs on the hardware. To add devices, changes mut be made to quite a few files, rather than just installing a new driver.

Peter Randall 24-10-2007 10:45

Re: Welcome to the WPILib forum
 
Brad,

I have a student who is trying to add a Parallax GPS to an FRC projectin Easy C. We are having difficulty understanding how to read and write to the TTL serial port. Can you provide guidance on how to do this?

Thanks

PGR

mluckham 27-11-2007 23:11

Re: Welcome to the WPILib forum
 
We want to read the serial port with EasyC also. I think WPILIB functions can be called directly in EasyC, not just with the icon blocks supplied, using a User Code block ... that is yet to be confirmed.

Page 46 of the WPILIB manual (9 January 2007 version) covers the Serial Port functions OpenSerialPortOne(), ReadSerialPortOne(), WriteSerialPortOne().

If I find out how to do this, I'll post here.

mike

mluckham 30-11-2007 09:12

Re: Welcome to the WPILib forum
 
Simplicity itself - I just used:

unsigned char inchar;

inchar = ReadSerialPortOne();

if (inchar != 0)
{
// valid character is available
}

No need to open the port (#1) as the FRC runtime environment had already opened it at 115200 baud.

For output to the port use the standard EasyC print block.

slavik262 03-12-2007 19:39

Re: Welcome to the WPILib forum
 
WPILib is an amazing contribution. My team is working on creating code based almost entirely on WPILib and a few extra #defines, due to its simplicity. This makes the code easy to debug and extremely fast to write. I'm surprised more people aren't using this.

dcbrown 12-02-2008 11:12

Re: Welcome to the WPILib forum
 
I noticed what I thought was a bug last year in serial_ports.h and its changed slightly this year but is still there?

The following is an except from a .map file from MPLAB when using WPILIB. It appears rx2Framing_Errors is defined as static storage within serial_ports.h rather than as an extern so every inclusion of this file allocates new storage for this variable. It may be that this is not shared across files, but the rx1 equivalent variables are only defined once in serial_ports.c. A similar set of variables are defined for rx2 in serial_ports.c... but then serial_ports.h defines possibly the same variable but with an underscore.

The results appears that just some extra storage is allocated but never used. Since these appear to be static defines in serial_ports.c, I wonder if there is any need at all for them in serial_ports.h.

Anyway, just an observation.

Code:

        rx1FramingErrors  0x0005b6      data    static C:\..\serial_ports.c
        rx1OverrunErrors  0x0005b4      data    static C:\..\serial_ports.c

      rx2FramingErrors  0x0005b7      data    static C:\..\serial_ports.c
        rx2Framing_Errors  0x000300      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x00061a      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x0005d1      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x0004fd      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x000638      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x0004eb      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x000622      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x0002cb      data    static C:\..serial_ports.h
        rx2Framing_Errors  0x000609      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x0003b2      data    static C:\..\serial_ports.h
        rx2Framing_Errors  0x000636      data    static C:\..\serial_ports.h

        rx2OverrunErrors  0x0005b5      data    static C:\..\serial_ports.c
        rx2Overrun_Errors  0x0004ec      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x000301      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x0005d2      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x00061b      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x0004fe      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x000639      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x00060a      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x000623      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x0003b3      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x000637      data    static C:\..\serial_ports.h
        rx2Overrun_Errors  0x0002cc      data    static C:\..\serial_ports.h


starsROBOTICS 24-03-2008 21:01

Re: Welcome to the WPILib forum
 
is there a way to program another camera instead of using the cmu cam?

starsROBOTICS 25-03-2008 22:44

Re: Welcome to the WPILib forum
 
how does wpilib and easyc differ? which ones better?


All times are GMT -5. The time now is 23:36.

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