The RC firmware update innovation-FIRST posted doesn't affect this problem. That had to do with initializing PWM & RELAY values when changing modes.
Nothing looks bad in your code and the failure to typecast in this one case shouldn’t be noticable, so lets go deeper.
I’ve attached an entire FRC project from the default code with two analog read statements added to Process_Data_From_Master_uP() for no other reason than that routine was handy (I posted just that routine below-those are the only changes made to the default code). Test with the whole project to eliminate the chance that something elsewhere in your code is causing the problem as Eric says.
You'll see one statement reads from analog input 1, the other from analog input 16. I tested with our gyro on input 1 and with a potentiometer on input 16. You don’t need to have a pot handy. The Get_Analog_Input will return “1023” if nothing is attached to the input pins, and if you connect the “SIG” and “BLK” pins with a paperclip you’ll get a reading of zero.
Try testing with this. You can just IFI_Load the .hex file or recompile the whole project if you like.
Code:
void Process_Data_From_Master_uP(void)
{
long CurrentGyro=0;
int pot=0;
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
Default_Routine(); /* Optional. See below. */
/* Add your own code here. */
CurrentGyro = (long)Get_Analog_Value(rc_ana_in01);
printf("Gyro= %d", (int)CurrentGyro);
pot = Get_Analog_Value(rc_ana_in16);
printf("pot= %d", pot);
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT CHANGE! */
}
Quote:
|
Originally Posted by 527Paranoia
What could possible be wrong other then our FRC hates me and is broken in some way....
|
You’re looking for three things.
1) If both analog inputs = 0 no matter what, even disconnected, that means bad FRC analog inputs, ergo the FRC hates you.
2) If the pot works, but the gyro doesn’t then the gyro hates you.
3) If they both work then something else in the code hates you.
P.S. Friday afternoons are good for me. Clear it with your advisor first then PM me directions both to the school and where I find the team at school. I'll be coming south on the SOB