|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
|||
|
|||
|
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. |
|
#17
|
|||
|
|||
|
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 |
|
#18
|
||||
|
||||
|
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 |
|
#19
|
||||
|
||||
|
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. |
|
#20
|
||||
|
||||
|
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.
|
|
#21
|
|||
|
|||
|
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
|
|
#22
|
|||
|
|||
|
Re: Welcome to the WPILib forum
is there a way to program another camera instead of using the cmu cam?
|
|
#23
|
|||
|
|||
|
Re: Welcome to the WPILib forum
how does wpilib and easyc differ? which ones better?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| National Instruments LabVIEW and Data Acquisition Forum | Danny Diaz | National Instruments LabVIEW and Data Acquisition | 1 | 16-01-2006 13:20 |
| moderators for Q&A forum | Ken Leung | CD Forum Support | 25 | 03-01-2003 18:15 |