50 likes | 191 Vues
/* * Function record * This function will record the input from the joystick to memory * */ void record(void) { int i; i=0; asm_main(); // call the assembly function for(;;) { DELAY_100ms(); path [i]= (PTAD & 0x0F);
E N D
/* * Function record * This function will record the input from the joystick to memory * */ void record(void) { int i; i=0; asm_main(); // call the assembly function for(;;) { DELAY_100ms(); path [i]= (PTAD & 0x0F); if (i == 500) { path[i]=0x00; // stores all zeros to memory break; //breaks out after 50 seconds of looping } i++; } // waits until the switch button is neutral DUMPROUTINE(); Record
/* * Function playback * This function will playback the information recorded in memory * */ void playback(void) { int i; i=0; // call the assembly function // allows us to write to the whole port T DDRAD = 0x0F; RDRAD = 0x0F; for(;;) { if (path[i] == 0x00) break;//checks to see if byte is all zeros if so exits out PTAD = path[i]; // stores memory location in port T i++; DELAY_100ms() ; // waits 100ms } DUMPROUTINE(); DDRAD = 0; //add to wait until switch is recentered return; } Play Back
Dump Bucket • ; ---------------------------------------- • ; Subroutine DUMPROUTINE: • ; ---------------------------------------- • DUMPROUTINE: • BSET PTT,P1_DUMPMOTORBIT ;changes direction of motor • BCLR PTT, E1_DUMPMOTORBIT ;turn dump motor on • LDX #50000 ;delay for 5 second • JSR DELAY_X100 • BSET PTT,E1_DUMPMOTORBIT ;turn off dump motor • LDX #50000 ;delay for 5 second • JSR DELAY_X100US • BCLR PTT,P1_DUMPMOTORBIT ;changes direction of motor • BCLR PTT, E1_DUMPMOTORBIT ;turn on dump motor • LDX #50000 ;delay for 5 second • JSR DELAY_X100US • BSET PTT,E1_DUMPMOTORBIT ;turn off dump motor • RTS