View Full Version : EasyC Wish List
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?
2. Storage classes/qualifiers for variables.
static rom near int lookup[42]={0,8,8,8}; for example.
Another Pro only feature?
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.
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.
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.
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.
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. This would promote quick prototyping in EasyC but support programmers growth to using MPLab. At the moment the transition is abrupt and you have to start again in MPLab. Maybe an Export Project to MPLab function to create the sources/includes and a template MPLab project or instructions for using the new sources and WPI lib from MPLab. (Ok, I admit it - I tried hacking apart the BDS file to do this but didn't get anywhere other than being able to do some fundamental record breakdown/breakout).
I'm sure there might be others. But these are the ones we have at the moment.
DCBrown
BradAMiller
24-01-2006, 08:39
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:
#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).
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.
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.
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.
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.
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.
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 (http://www.chiefdelphi.com/forums/forumdisplay.php?f=157) for more information on how to get it and how to use it. There is a 57 page document that describes its use.
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.
I'm still having problems. I might not fully understand what you are suggesting.
I created a .h file of:
#ifndef LOOKUP_H
int mytable[4] = {1,2,3,4};
#endif
#ifdef LOOKUP_H
extern int mytable[];
#endif
#define LOOKUP_H
and did a file inclusion. The problem I've run across is that it must be compiled multiple times into the project. The project won't link, I get multiple defines at link time. If I put an error into the include file I get seven syntax errors. I don't know if that means it is compiled into 7 different modules or not. I could make the table static and that does link cleanly, but that means mytable[] is replicated multiple times in the system.
Our real lookup table could be a couple kbytes in size, having this replicated in the system a bunch of times might not be a good thing.
Looking for additional guidance.
Thanks,
DCBrown
BradAMiller
25-01-2006, 08:03
Our real lookup table could be a couple kbytes in size, having this replicated in the system a bunch of times might not be a good thing.
Looking for additional guidance.
Thanks,
DCBrown
My explanation was kind of unclear. You're right, that each time the include file with the variable definition is listed, it will be included in your output file.
There is a new version of EasyC that will be availble shortly (by next week, I'd think) that will let you link your programs with an external object file. Then the idea is to create a C source file in MPLab with your table, compile it, and add that object file into the build in EasyC (next version). The table will only be allocated once, since the definition of the table only appears in that object file.
Then make your include file only contain an extern for that table and whatever types you need to make it work. That file won't generate any memory since there is only an extern declaration and not the table itself.
Thanks! The new methodology available in the next release sounds a lot cleaner as well as having a lot more applicability including creating a possible migration path between EasyC and MPLab environments for team code.
Can't wait to try out the new version!
Regards,
DCBrown
Intellitec may may be on the way to robot programming Nirvana if the can have a full expansion path that will take care of the newbies and at the same time allow extensions that will satisfy the experienced programmer. Not there yet but, there is a path.
Is there a way in EasyC to get the rc_main_batt and rc_backup_batt? These are the field names in the rx data packet under MPLab/ifi default code. I read WPILib and EasyC help but couldn't find anything.
Regards,
DCBrown
P1h3r1e3d13
20-02-2006, 19:18
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?Depending on exactly what you are trying to accomplish, you might try what I've done:
I defined global constants such as R_DRIVE_PWM and LIMIT_SW_1_INPUT as numbers (3 and 1, in this case). Then I use PWM Control and Limit Switch blocks and select the corresponding constants from the dropdown. It ends up like so:
SetPWM (R_DRIVE_PWM, speed)andsw1 = GetDigitalInput (LIMIT_SW_1_INPUT)
This allows me to modify almost everything I need to tweak right from the Macros and Constants dialog without having to search through all my code and change each place I set my drive speed, for example. It also makes the code easier for a non-programmer or a newcomer to understand.
Kingofl337
22-02-2006, 10:28
Is there a way in EasyC to get the rc_main_batt and rc_backup_batt? These are the field names in the rx data packet under MPLab/ifi default code. I read WPILib and EasyC help but couldn't find anything.
Regards,
DCBrown
var = GetBackupBattery()
var2 = GetMainBattery()
gabrielse
03-03-2006, 15:51
We make new folders to save working versions of our code. However, if we try to create a folder while saving it is automatically named New Folder and can't be renamed from within EasyC. Please fix this for next year.
Kingofl337
06-03-2006, 08:41
We make new folders to save working versions of our code. However, if we try to create a folder while saving it is automatically named New Folder and can't be renamed from within EasyC. Please fix this for next year.
Will do. :)
P1h3r1e3d13
16-03-2006, 00:55
More support for pointers. They can't be initialized like regular variables.
I'd like to be able to grab PWM/relay/digital output values to variables, and I assume pointers would somehow be the way do do so. Is that at all possible now?
intelitek_Chris
16-03-2006, 08:23
Sorry, its not possible. Pointers were intentionally not supported this year because we were trying to keep things as simple as possible for the user. The only occurrence of pointers is the in the camera capture code and was necessitated by the complexity of the camera.
But it doesn't hurt to write it on the wish list and keep your fingers crossed! Santa might be kind next year.
On the other hand, if you are looking to get your PWM, Relay, and output values into variables, that is very easy. Instead of trying to get the values out of Tank2() or OIToRelay(), use the OI Digital Input and OI Analog Input blocks from the RC group. Those get the values directly from your controls and joysticks. The only thing you can't do, is get the 'post mixed' values being sent to your drive motors from the Arcade2() and Arcade4() functions.
I would love to be able to "click into" the code and manuly type in things(for quick logical oops fixing)
P1h3r1e3d13
21-03-2006, 23:04
1. User-friendlier printing:
I would like to be able to select from a list (perhaps with check boxes) which parts of the program to print (variables, constants, specific functions, header files, etc.) and also have options to automatically select everything, or all user functions, or all included files, or entire libraries, or all variables, or everything that's called from a certain function; you get the idea.
I'd also like the "Select and Print Flow Chart" feature to (optionally) print everything I select at a certain scale and automatically break it up into pages, instead of squeezing the whole thing onto a single page in electron-microscope-size font or me having to select individual areas and print them one at a time.
2. The options in the Window menu to view only blocks, only code, etc. should apply either to all windows or to the window I'm in when I select the option. I'm assuming it's a bug rather than a design flaw, but now it only applies to Main, at least when in a competition project.
3. I know the debugging ability of the compiler is only supposed to be rudimentary, but it seems buggy. Sometimes it lists all instances of the same error, but sometimes it only lists one. Sometimes it doesn't notice that I'm using variables and constants that I haven't defined or initialized. Once it insisted on a syntax error on line 31 of a function, no matter what was on that line. I don't know what causes the problems, but please fix them.
4. The ability to comment out a block of code, such as everything inside a While loop or an entire If/Else structure. Also, there should be an option to ignore errors in blocks that have been commented out, as they have no bearing on the compiled code.
5. The ability to select multiple, nonsequential, blocks with Ctrl and Shift. (I know someone mentioned this, but it's a big deal.)
Kingofl337
22-03-2006, 13:34
Thanks for the feed back keep it coming!
On #4 request you can use a user code block and do
/*
--YOUR CODE--
*/
and it comment out everthing in the middle.
Is it possible to write to any of the other User Bytes [besides User_Byte1 using the SetUserDisplay() function] that are sent back to the OI from the RC using EasyC? Thanks in advance.
Kingofl337
05-04-2006, 11:27
Is it possible to write to any of the other User Bytes [besides User_Byte1 using the SetUserDisplay() function] that are sent back to the OI from the RC using EasyC? Thanks in advance.
You can write any number 0-999 to the OI Display
You can also turn on or off the LED's
My biggest wish for Easy-C has nothing to do with the IDE. It's the painfully slow down load that irritated us last Thurs. and Fri. while we working on the ball feeder code. I thought it might be the serial-USB driver but its the same with different chip and drivers. It took a matter of seconds to change the parameters, add a block and move stuff around. It really proved the advantage of a graphic IDE. We could have gotten things debugged much sooner if it wasn't so slow on the down load. Over all I say that Easy-C really did make the programming part of the season easy. Much better than watching the students battle MPLAB all season last year. Thanks intelliteck and First for putting A visual IDE in the kit this year.
BradAMiller
11-04-2006, 07:32
My biggest wish for Easy-C has nothing to do with the IDE. It's the painfully slow down load that irritated us last Thurs. and Fri. while we working on the ball feeder code. I thought it might be the serial-USB driver but its the same with different chip and drivers. It took a matter of seconds to change the parameters, add a block and move stuff around. It really proved the advantage of a graphic IDE. We could have gotten things debugged much sooner if it wasn't so slow on the down load. Over all I say that Easy-C really did make the programming part of the season easy. Much better than watching the students battle MPLAB all season last year. Thanks intelliteck and First for putting A visual IDE in the kit this year.
If you have a laptop with a serial port on it, the downloads go about 3X faster than through the USB adapter. I have an older laptop that I'm keeping around for exactly that reason.
P1h3r1e3d13
12-04-2006, 00:35
Is it possible to write to any of the other User Bytes [besides User_Byte1 using the SetUserDisplay() function] that are sent back to the OI from the RC using EasyC? Thanks in advance.It took me a while to get the following figured out, so here's what (I think) I know about your question:
I do not think there is anything called User_Byte1 that exists by default in EasyC.
Nor am I aware of any User Bytes other than the one that shows up as uXXX on the OI.
The "hard" C default code includes code that controls the OI LEDs based on joystick and button inputs (and maybe it controls the User Byte - I don't remember). An EasyC project, by default, does not send anything to the UB or the OI LEDs. All you can do is essentially the same as you can do in "hard" C: add OILED() and SetUserByte() commands. You can, of course, set them to variables.
If this doesn't address your question, perhaps a little more detail on what you are trying to do might help me/us.
BradAMiller
18-04-2006, 05:14
Is it possible to write to any of the other User Bytes [besides User_Byte1 using the SetUserDisplay() function] that are sent back to the OI from the RC using EasyC? Thanks in advance.
As delivered you can write write values to the LEDs or the numeric display. EasyC looks at the setting of the display mode switch on the OI and either sends whatever you set for the single bit (LEDs) display or it sends the value you set for the numeric user display. So if you press the display select button on the OI and cycle to the U - user display setting, you'll see the number that you put in the SetUserDisplay function. If you set it to anything else, you'll see the LEDs have the values set with the SETOILED function.
Now, if you want to get more data back to the OI, you can connect a laptop to the dashboard port, then you can send lots of data back. We built a display with an image of a car dashboard and rendered dials for the tach and speedometer. The dials indicated the robot speed and ball pitcher speed. And there were a bunch of other indicators for low battery, etc.
gabrielse
26-04-2006, 07:48
I wish the next version of EasyC has a built in implementation of a switch statement.
Our student programmer this year had a hard time following a mess of nested if statements.
She learned how to make state diagrams and to implement them using switch statements. She had a much easier time debugging and writing code with switch statements.
We are training new programmers with EasyC. A "non-user code" switch statement would really help. Thanks.
Kingofl337
02-05-2006, 21:46
Good call on switch. Would have been helpful for our team as well.
P1h3r1e3d13
04-05-2006, 00:02
How about more help on the use of libraries? I never did figure out how to use "math."
Chris_Elston
04-05-2006, 18:08
I wish in the next version we could "record" all the varibles in our program for some many CPU loops. Like define 100 loops. Then hit record.....
Let the CPU loop 100 times, and store all the varibles in our project into a database. Then for DEBUG MODE, we can hit "play" and step though each CPU loop, pausing and stepping through our code like a cpu pointer, only when we hover over the varible, it will display the value of that varible, and type of varible during play back mode.....
In other words, I know we probablly can't have online debugging, pausing, stepping, but the ability to record so many CPU cycles, then play back would be really SWEET....of course, any If statements would excute correctly based on the value of that varible pulled from the recorded session.
and please do fix the project printing....It would be nice to print out ALL the functions like in a project print, instead of each one....
-
P1h3r1e3d13
05-05-2006, 02:35
That would be really, really cool.
As a (poor) substitute (and you probably already figured as much anyway), I did something like that by putting a PrintScreen for each variable (or a printf for several) at the end of the loop (or after each time you change the variable), and incrementing a counter variable each loop. Then change your main While(1) loop to While(counter <=100) (or just make it a For() loop).
gabrielse
31-05-2006, 10:02
EasyC is great. I'm using it to teach some students programming for next year. They are learning to debug. However, they aren't at the "user code" phase of their programming development yet. I have three suggestions that I believe would make that process easier.
1. In order to debug it really helps to print out multiple variables on a single line so the output is real-time readable. It is possible to use usercode to make PrintToScreen print two variables on the same line. It would be more convenient if it wasn't necessary to use usercode.
Earlier in this thread it was suggested that the newline character was made optional. That would do the trick, or an option to add multiple variables would work.
2. The ability to comment out an entire if statement. It is possible to comment out the contents of an if statement, but it would be more convenient if you could comment out an if statement and all its contents at the same time.
3. The ability to easily cut & paste a function from one EasyC program to another. This step is a precurser to creating a library. If this already possible, please let me know how to do it.
Thanks!
tacman1123
31-05-2006, 10:34
It would be nice if the UserCode block were not just a single, 60 character line, but rather a larger, multi-line input window, that preserved the formatting.
The ability to type directly into the C program would be even better, but I realize that's more difficult to do.
Tac
gabrielse
13-06-2006, 08:53
3. The ability to easily cut & paste a function from one EasyC program to another. This step is a precurser to creating a library. If this already possible, please let me know how to do it.
Go to: Options --> Add Existing Function
Sorry, I didn't know how to do this before.
P1h3r1e3d13
13-06-2006, 13:49
Go to: Options --> Add Existing Function
That's still a bit more complex than cut-and-paste. It's not a big priority because it functions as-is, but straight cut-and-paste would be much easier.
a random number function, i have found that i almost needed one.... (i was making some new search code for the camara... then i found out that the tracking will auto search....) or a visual reprersentation of the first OI (where you can see a labeled diagram of what comes out where.... cheak your code to your robot, even if its not labeled well...(like the manuel control they have now but more visual to a point) but then who dosent have a perfectly labeled and easy to understand robot.... :D)
Kingofl337
14-08-2006, 09:24
a random number function, i have found that i almost needed one.... (i was making some new search code for the camara... then i found out that the tracking will auto search....) or a visual reprersentation of the first OI (where you can see a labeled diagram of what comes out where.... cheak your code to your robot, even if its not labeled well...(like the manuel control they have now but more visual to a point) but then who dosent have a perfectly labeled and easy to understand robot.... :D)
Thank You for your ideas. We are always looking to improve easyC to make it the best it can be.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.