![]() |
Re: Mixing WPILib with default MPLAB code
Quote:
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. |
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 |
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 |
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. |
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.
|
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 |
Re: Welcome to the WPILib forum
is there a way to program another camera instead of using the cmu cam?
|
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