Quote:
|
Originally Posted by dcbrown
Ok, don't get me wrong - we like EasyC, but...
I'm finding that we're using "User Code" more and more within all the routines being written. So I thought I'd start a wish list for EasyC.
1. Defines with arguments and these showing up in the user functions list.
For example:
#define SetLeftWheel( _pwm ) SetPWM(2, _pwm)
Yeah, we could code a routine called SetLeftWheel() that simply calls SetPWM(), but the call stack isn't that large and we could end up wasting a lot of its stack entries on simple redirection. The define just makes it easier for us to forget which ports/pins/interrupts go together to make up a specific feature on our robot. A feature for Pro mode only maybe?
|
If you are asking if the defines can show up as user functions, then that would be a nice feature and isn't currently available. If you're asking if you can have defines with parameters, then you can do that by opening the globals window and adding the defines there. You have to put the argument list in the Value column of the Program Globals/Define dialog box. Effectively you do this:
Code:
#define SetLeftWheel (speed)SetPWM(3,speed)
then it works.
The "functions" would have to be hand entered in user code blocks or in assignment blocks (or any other place an expressions is allowed).
Quote:
|
Originally Posted by dcbrown
2. Storage classes/qualifiers for variables.
static rom near int lookup[42]={0,8,8,8}; for example.
Another Pro only feature?
|
Yup, that would be nice. And so...
The next version of EasyC that should be available soon will let you create external functions in MPLab and add them to the linked image. There is already an option to add a header file (.h) so you might try creating those tables in MPLab, then creating a function in the same MPLab module with the "rom" storage class identifier that returns the result to the EasyC program.
It sounds like you know how to do this, but if not, post something and we can try to help you out.
Quote:
|
Originally Posted by dcbrown
3. Global "User Code".
Currently we need to define a lookup table that is created readonly in program memory. We're using user code to do this and then initializing the array within a routine. The routine then must be called to access an array member. We'd like to be able to put some user code into a global area so the array can be used by more than one routine easily.
|
See above.
Quote:
|
Originally Posted by dcbrown
4. Cut & Paste support
In input boxes and being able to copy out the source lines from the source view window. Or an export function that exports the source lines into a straight text C file.
|
It turns out that you can copy out of those source file windows on the "Project" tab in EasyC. To do it you need to select the text and then right-click on the selected area. A menu with "copy" as an option pops up. You probably tried to use ctrl-C to do the copy, and that isn't yet implemented.
Quote:
|
Originally Posted by dcbrown
5. PrintToScreen()
We're using hyperterminal so we can save our debug output to a file easier. It needs \r\n at the end of prints to get to the start of a new line. Unfortunately we can enter "Data is %d mgs\r\n" - we'd like to add the %d format character ourselves and then select the variable. Maybe a check to see if a format selection is already present and then just add the variable to the end of the line? Because we can't output multiple variables per PrintToScreen() call, we've been using the following:
PrintToScreen( "Data1, Data1, Data3\r\n");
user code[ PrintToScreen( "%d, ", data1 ); ]
user code[ PrintToScreen( "%d, ", data2 ); ]
user code[ PrintToScreen( "%d\r\n", data3);]
Maybe if there was a selection box to enable/disable adding the newline at the end. We print out the data this way so it can be pulled into an excel spreadsheet and charted easily.
|
I'd suggest calling the printf function from the C library. It is what print to screen does internally. You can do that in a user code block from EasyC. You should also do an include of "stdio.h" using the "File Inclusion" from the Options menu. It has the definition of printf.
Quote:
|
Originally Posted by dcbrown
6. The ability to use the Ctrl key to add to and accumulate sets of code to
cut/delete etc. Select an line item, hold down the Ctrl key and select
another line item, etc.
|
EasyC lets you select contiguous sets of blocks at the same level with Shift-Select. If one of those blocks is a compound statement, like an IF statement, then all the stuff inside the IF will be selected too. After you select, right-click on the set of blocks and select "Copy". You can then paste them somewhere else in the current function or another function.
EasyC does not let you select non-contiguous blocks - for that case you need to do multiple select-copy-paste operations.
Quote:
|
Originally Posted by dcbrown
7. A defined upgrade path from EasyC to MPLab.
As programmers become more adept and comfortable with programming. They should be able to easily grow from EasyC to MPLab and carry their work with them.
DCBrown
|
It turns out that the runtime system of EasyC is called WPILib and you can use it with MPLab. WPILib stand-alone has all the functions that EasyC has plue more. What this means for you is this: you can write parts of your program with EasyC and other parts with MPLab (using WPILIb) or you can write the whole program with WPILib.
Check out the
WPILib forum for more information on how to get it and how to use it. There is a 57 page document that describes its use.