![]() |
Programming FAQ
It seems like we get a lot of the same questions here. So, here's a repository of some of the most common ones. Feel free to post your own with answers.
If you have a question that is not answered here, please search first. I can almost guarantee that someone has asked a similar question before. Q. MPLAB says that it can't find "xxx.h". What's up? A. if it's a standard header (eg, #include <adc.h>) then odds are that MPLAB is misconfigured. Either set the include directory manually, or reinstall MCC18 and checking the check boxes. |
Re: Programming FAQ
|
Re: Programming FAQ
This one got me for a while when I first started using the RC.
Q: My robot isnt responding to controllers, wont download a new program, and is stuck in disabled mode. What do I do? A: 1)hold down both the program and reset buttons. 2)Then, let go of the reset button. (The power light will be blinking green. ) 3)Wait until the green light is solid. 4)Let go of the program button. or see here |
Re: Programming FAQ
Q. I get an error when i try to compile:
Quote:
A. Don't put the code on the Desktop or My Documents. Here's why: MCC18, the compiler, can only handle paths that are less than 62 characters long. Here is a few paths to the Desktop and My Documents (with the first 62 in green and everything else in red):
|
Re: Programming FAQ
Similar to Tom's:
Q: My programming is running the way it should! A: Amazingly, about a quarter of the time it isn't really your fault. Try pressing the reset button on the robot controller, then re-download. Sometimes things just get a little corrupted. If it still doesn't work, then start debugging your code... |
Re: Programming FAQ
Quote:
A. See above. But when it is running the way it should, about a quarter of the time it still isn't your fault ;) |
Re: Programming FAQ
Quote:
That being said, I am using MPLAB 7 (which you can download at www.microchip.com), so it may not be possible to disable this in MPLAB 6.x. I know a vast majority of you will be using 6.x because it was distributed with the C18 software last year... someone please correct me if this option isn't available in MPLAB 6.x. If you're using the C18 tools by the command line, then just add option /w and it shouldn't generate the file also... which, you can edit the command line in MPLAB 6.x, so you can just add the /w switch to the MPLINK command and not have a problem. Here's the workaround for MPLAB 7. In the MPLAB menu: Project-> Build Options -> Project Click on the tab "MPLINK Linker", and check the option "Supress COD-file generation". Now it won't generate this file, and you can use a path as big as you would like to use. Well, within reason... :D [edit] Apparently, the C-Bot CD that has the licensed version of C18 does not have the correct linker in its c:\mcc18\ directory... so if you use the /w option you will get "invalid option" and still have the problem. However, if you tell MPLAB to use the linker that it came with (located in c:\program files\Microchip\MPASM Suite\mplink.exe), then it should work with no problem With all that said, if you don't feel like dealing with any problems, don't touch anything, use the default stuff, and make sure your path is under 62 characters :) [/edit] |
Re: Programming FAQ
Question: What OS is on the robot? If there is none or its horrible can I put embedded Linux on it? I only run Linux myself, is it possible to program this robot on Linux? Is there some sort of emulator I can get so I don't have to be with the robot, or it dose not have to be fully built for me to test?
Or basically I am a rookie, where do I start, I want to learn about the robot controller. Answer: OK first, yes you can program this robot using Linux. Visit http://kevin.org/frc/ and you should find some more information. For starting off, I highly recommend the documents on http://www.innovationfirst.com/FIRS...cumentation.htm And then if you are advanced enough you can look at this page, but only if you are a really core programmer. Otherwise innovation FIRST is the best place to start. To answer another part of you question, there is no OS on the robot controller. It is a microchip which understands C and assembler. Search, Read documents and get a feel of what our robot controller(microchip product) is. Its might not be such a good idea to try to go as far and put Linux on there or something, Search, Read documents you can find and you will get a feel. -Bharat |
Re: Programming FAQ
Question: Does everyone use the C18 compiler? Or do some of you use the Visual Studio C compiler?
If you use the Visual Studio C complier, how would you download the code to the RC? |
Re: Programming FAQ
Quote:
Matt |
Re: Programming FAQ
Q: Where can I find all this cool stuff that was talked about in the (2005) kickoff?
A: The Camera stuff, default code, (eventually) the new firmware (master code), and technical docs are on http://ifirobotics.com. The link to the new IDE and MCC18 compiler are on FIRST's website (http://www.usfirst.org/). Q: I CAN'T FIND THE COMPILER!!! THE LINK IS MESSED UP!!! HELP!!! A: Yes, we know you can't download the compiler right now. Asking again won't help. Just try again later (like tomarrow) and hope it works. We can't do anything about it no matter how much you pester us. |
Re: Programming FAQ
Q. Why won't my program link? (Generic Linking problems)
A. If you have any kind of linking problems, the first thing you should do is to tell it to Build All (Ctrl+F10, or Project > Build All). If this doesn't help, keep digging here. |
Re: Programming FAQ
Quote:
I believe another thread on this forum is porting RTOS to the microcontroller. |
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Right now for my team I am the only ""programmer"" so we are using the same code from last year to run the new one, but the computer that held it crashed and our back up is sitting on a college freshmen's desk.
Q. is there anyway to "uncompile" the code directly from the controller? or do i have to start from scratch? |
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Quote:
Once the code is compiled (which is the state the downloaded code is in), it's stuck that way. There are few ways to decompile it back to the original C code it was compiled from. I'm afraid you're stuck. |
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
I just have a quick question. How do you load a program into an old robot controller that does not have the "prog"ram button? :confused:
|
Re: Programming FAQ
Quote:
Those were programmed in PBasic from Parallax not C and used an entirely different editor/compiler/downloader. It worked without the need for a "program" download button. Let me find some references for you... Most of what you need can be found here: http://www.ifirobotics.com/first-legacy.shtml under Documentation for 2001 - 2003 The default code with drive capability and the Editor that also downloads the code is available there, as well as documentation that describes what you need to know to get started. Another useful site is: http://www.parallax.com In particular: http://www.parallax.com/html_pages/...basic_stamp.asp for the latest Editor and http://www.parallax.com/html_pages/...basic_stamp.asp for in-depth PBasic user guides. __________________ |
Re: Programming FAQ
Thank you very much. I will try those links and see what I can get.
|
Re: Programming FAQ
Isn't asm the same thing as machine code? The only difference is your mov or w/e is replaced with a number.
|
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Our team tried to load code from last years robot it doesn't work for some reason. One of leaders thought he saw something about not being able to use previous code on the 2007 controller. Anyone seen that rule/had problems/ideas?
|
Re: Programming FAQ
Quote:
For debugging purposes, the 2006 code can be loaded into the 2007 controller. However, <R76> prohibits you from reusing code from 2006 in your 2007 competition robot. Regards, Mike |
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
hi
i need help on getting started on the drive code, i was on the team last but wasn't in charge of drive code and im a little lost on how to design it.Our main programmer and mentors have been busy recently and unable to help me. if some one could give me some help on at least some sort of outline of the code i should be able to figure it out from there i dont need anything crazy just so the robot can move and turn thanks confused programmer |
Re: Programming FAQ
Try going through the default code description in the Programming Reference Guide . It's from 2004 but everything still holds true.
|
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Here's one that i've been seeing a lot recently:
Q. How do i add kevin's [insert extra hardware name(e.g. camera, encoder, etc.)] code? A. Look at the readme in the files that come with it. they tell you exactly how to do it. |
Re: Programming FAQ
do i need to learn unix before i learn C? my mom has been telling me to do this before i attempt to learn c although i have gone through some of the tutorials and it does not seem to get mentioned anywhere.
|
Re: Programming FAQ
Quote:
|
Re: Programming FAQ
Where can I find the default code for MPLabs?
The Link: http://innovationfirst.com/FIRSTRobo...umentation.htm seems to be broken (or at least it won't load for me). Can I get the code anywhere else? |
Re: Programming FAQ
im have a bit of a problem, i've loaded the 2007 default code and now the controller moves the moters in reverse. did something happen to the program?
|
Re: Programming FAQ
Your motors are probably wired in reverse. Without additional sensors, your robot has no way of knowing which way the motors are actually turning (and even if it did, it doesn't know what you want as forward and backward until you add that). Try doing something like this:
Code:
pwm02 = 254 - p2_y;Code:
pwm02 = p2_y; |
Re: Programming FAQ
ok, thanks. now i have another question. is there a manual or a guide that teaches you how to program the hybrid mode?
|
Re: Programming FAQ
Quote:
It says autonomous mode, but hybrid is the same thing (just with IR inputs). |
How do I program to buttons?
I am new to C programming, and I was wondering if it is possible to program to buttons instead of joystick. I learned a lot in the short time I was programming and i hope to learn more.
|
Re: How do I program to buttons?
Quote:
|
Re: How do I program to buttons?
Quote:
|
Well the claw is sopposed to pick up pvc rings, the strategy we used is the claw goes in the middle of the ring and opens up to put pressure on the sides of the ring to pick it up. The problem is, I dont know how to make a code to use the buttons instead of joysticks to make that happen. ( it is a 2 pronged gripper that opens and closes using a servo module)
|
Re: Programming FAQ
Is this for the VEX platform?
And do you want to use the buttons on the back of the VEX transmitter? |
Yes this is ofr the VEX platform and I would like to use the buttons of the back of the transmitter
|
Re: Programming FAQ
If you are using EasyC what version are you using? V2, EasyC Pro?
The function calls are different between the versions. If you are using MPLAB to program, the default VEX code has an example of using the buttons. The following is a variation on that. The two buttons on one side are seen in the code as PWM_in5 and the two buttons on the other side arrive as PWM_in6. This code starts the claw in the middle (joystick rest) and moves it to one extreme when the down button is pushed and the other way when the up button is pushed. It holds the last position after a button is pressed. Code:
// Claw servo |
Re: Programming FAQ
Q: What is the main difference between robotc and MPLAB? We have used MPLAB in the past but I thought I'd try robotc on our new programing computer.
|
Re: Programming FAQ
Q. Using MPLAB, I keep getting:
Quote:
I thought it was defined in ifi_aliases.h: Quote:
yet it still reads "undefined" anyone have a fix for this? |
Re: Programming FAQ
Actually,
Code:
#define SIXTEEN_ANALOG ADC_16ANA /* All analog */I have Code:
#include <adc.h> |
Re: Programming FAQ
MCC 18/h/adc exist and I have
Quote:
But I still get Quote:
edit: I'm using MPLAB C18 v3.16 |
Re: Programming FAQ
Quote:
|
| All times are GMT -5. The time now is 08:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi