Quote:
|
Originally Posted by Alan Anderson
The call to Getdata() will change the value of autonomous_mode to reflect the state of the pin on the competition port. Without a dongle connected, the while loop in User_Autonomous_Code() will execute once and exit. Your main loop will end up calling Process_Data_From_Master_uP(), then User_Autonomous_Code(), repeatedly.
|
Remove the statement autonomous_mode = 1;. There are 2 ways to test autonomous code
1.You could test your code using a dongle (build instructions
here ).
2. The quick and dirty solution is to your team number to 0000 by setting the dip switches on the OI to 0000 and tethering it to the Robot Controller. Warning: This will ALWAYS run autonomous. Run it on blocks so the robot doesn’t get away from you. Don’t leave the team number at 0000 because some unsuspecting team member may turn it on and the robot will attack them.
Quote:
|
Originally Posted by RedBarons
// Make sure we still enforce a 50ms loop
TMR1L = 0xF4;
TMR1H = 0x24;
|
Quote:
|
Originally Posted by PIC18F8722 manual pg169
A write to the high byte of Timer1 must also take place
through the TMR1H Buffer register. The Timer1 high
byte is updated with the contents of TMR1H when a
write occurs to TMR1L. This allows a user to write all
16 bits to both the high and low bytes of Timer1 at once.
|
I don't think this keeps a 50ms timer. TMR1H is a buffer register and only writes to the actual high byte of the register when TMR1L is written. I think you need to write to TMR1H first and TMR1L second.
It would be far easier to just increment a counter in the 26.2 ms area of the Autonomous loop like so:
Code:
static int auto_counter=0;
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
auto_counter++;
2 counts will give you ~50 ms and it will be synchronized to the rest of your autocode (timer interrupts are not synchronized to the 26.2ms auto loop)
If you still have this problem or any other problems, I will be at the Pittsburgh Regional which is your first regional (I assume you are on Team 63 Red Barons). I should be working at the Robot Inspection table.