View Full Version : Beacon Code on Full Size RC?
OK, strange question, but can the beacon code be quickly and easily transferred to the full size RC?
My team's mentor is going to be on a business trip for a few days, and we'd like to test the IR code using the edubot as a robot, and the RC as the beacon, but we're not sure if you can easily transfer the code.
And if someone already asked this, um, yeah, I'm just stupid then :p.
Mark McLeod
20-01-2004, 11:16
OK, strange question, but can the beacon code be quickly and easily transferred to the full size RC?
My team's mentor is going to be on a business trip for a few days, and we'd like to test the IR code using the edubot as a robot, and the RC as the beacon, but we're not sure if you can easily transfer the code.
And if someone already asked this, um, yeah, I'm just stupid then :p.
Yes, it looks pretty easy to do.
The biggest difference is you'll have to change the beacon code to use two of the PWMs 13-16 rather than the PWMs 1 & 2 used on the EDU controller.
Kevin Watson
20-01-2004, 11:46
OK, strange question, but can the beacon code be quickly and easily transferred to the full size RC?
My team's mentor is going to be on a business trip for a few days, and we'd like to test the IR code using the edubot as a robot, and the RC as the beacon, but we're not sure if you can easily transfer the code.
And if someone already asked this, um, yeah, I'm just stupid then :p.Yes, it should work just fine using these steps:
1) Drop a copy of beacon.c and beacon.h into a directory containing a fresh copy of the default EDU-RC code.
2) Use the project wizard to create a new project with the default code and beacon files.
3) Edit user_routines.c adding #include <beacon.h> in the #include area near the top and then a call to to Initialize_Beacon() in User_Initialization().
4) Change the call to Setup_PWM_Output_Type() to look like this: Setup_PWM_Output_Type(USER_CCP,USER_CCP,IFI_PWM,IF I_PWM);
5) You may also need to comment out the call to Generate_Pwms() in Process_Data_From_Master_uP().
6) While you're there, comment out the Default_Routine() and printf() calls in Process_Data_From_Master_uP().
7) Build and load the new .hex file.
8) Beacon type-0 should be on PWM13 and type-1 should be on PWM14.
Let us know if it works.
BTW, the tracking code works just fine on the EDU-RC. Here's a copy (http://kevin.org/frc/edu_tracker.zip) that'll get you started.
-Kevin
I'll try, but I didn't get a chance to grab the RC, so I'm not sure if I can do anything with this. Kind of frustrating, when you can't do anything for half a week... :-\
1) Drop a copy of beacon.c and beacon.h into a directory containing a fresh copy of the default EDU-RC code.
im assuming you mean the default FRC code here... we tried this, and it didnt work. running the program gives the error code "USER VIOLATION: Timeout on Packet Number (Infinite Loop or No call to PutData)" on the dashboard viewer. adding some debugging printf statements, we found that it initializes correctly and loops through the main loop several times, and then halts with that message. the odd thing is, it halts in the middle of the printf statement... i dont know if this is normal or what, but it gives the same error message with or without the printfs in there, so i dont think thats the problem. any ideas?
Kevin Watson
23-01-2004, 02:24
im assuming you mean the default FRC code here... we tried this, and it didnt work. running the program gives the error code "USER VIOLATION: Timeout on Packet Number (Infinite Loop or No call to PutData)" on the dashboard viewer. adding some debugging printf statements, we found that it initializes correctly and loops through the main loop several times, and then halts with that message. the odd thing is, it halts in the middle of the printf statement... i dont know if this is normal or what, but it gives the same error message with or without the printfs in there, so i dont think thats the problem. any ideas?Hmmm... I'll try to have a look at it tomorrow (Friday). BTW, did you try it with and without the call to Generate_Pwms()?
-Kevin
Hmmm... I'll try to have a look at it tomorrow (Friday). BTW, did you try it with and without the call to Generate_Pwms()?
-Kevin
i just tested it with
#define _FRC_BOARD
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
in Process_Data_From_Master_uP() and it gives the same error... should i have to #define that? if i dont, Generate_Pwms() requires 8 argument, and i dont know what the difference is.
something we just found out is that when we reset the rc, the program light starts flashing green and red alternately, the code error light on the oi goes off, the pwm1 and 2 lights turn on, and the error on the dashboard goes away, but the infrared beacon doesnt go on, and all i can see on the pwm outputs on an oscilloscope looks like just 60 hz noise, so i dont think anything is actually being outputted. ill do some more testing tomorrow, but advice would be greatly appreciated.
Astronouth7303
23-01-2004, 14:10
i just tested it with
#define _FRC_BOARD
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
in Process_Data_From_Master_uP() and it gives the same error... should i have to #define that? if i dont, Generate_Pwms() requires 8 argument, and i dont know what the difference is.
I don't think that's right. Ex:
const int SomeVal = 321;
#define SomeAlias SomeVal
void SomeSub(void)
{
if (SomeVal == SomeAlias)
Code_Allways_Executes();
if (SomeVal <> SomeAlias)
Code_Never_Executes;
}Which is compiled as:
const int SomeVal = 321;
void SomeSub(void)
{
if (SomeVal == SomeVal)
Code_Allways_Executes();
if (SomeVal <> SomeVal)
Code_Never_Executes;
}Get it?
Of course, I don't know all the ins and outs of C, so check the FRC default code.
no... this is in ifi_utilities.h:
#ifdef _FRC_BOARD
/* located in ifi_library.lib */
void Generate_Pwms(unsigned char pwm_13,unsigned char pwm_14,
unsigned char pwm_15,unsigned char pwm_16);
#else
/* located in ifi_library.lib */
void Generate_Pwms(unsigned char pwm_1,unsigned char pwm_2,
unsigned char pwm_3,unsigned char pwm_4,
unsigned char pwm_5,unsigned char pwm_6,
unsigned char pwm_7,unsigned char pwm_8);
#endif
so if _FRC_BOARD is defined, Generate_Pwms() takes 4 arguments, otherwise it takes 8. since the code initially had 4 arguments named pwm13, pwm14, pwm15, and pwm16, i assumed that the 4 argument call was the one that should be called, so i #defined _FRC_BOARD.
okay, we figured it out... in user_routines_fast.c we actually have to add the interrupt handler thats in the beacon project but not in the frc default code. it works now!
edit: well, it compiles and runs without errors, but the waveform isnt correct... ill keep working on it
edit: okay, well, no one ever told me the output would be on pwm13 and 14 for the frc... it works now(: this should be very helpful for us.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.