/* * mmtest1.c * * Motor Mind Driver library Test * * Test one: turn the motor on and off * * Motor Mind module is conected to PORTA * FM pin on MM is connected to RA1 pin 18 * LED on RB4 via 1K resistor * * Mark Crosbie 10/31/98 mark@mastincrosbie.com */ #define MOTOR 0x5 #define MMPIN 1 #define LED 4 void main(void) { set_bit(STATUS, RP0); /* select the register bank 1 */ clear_bit(TRISA, MMPIN); /* Port A.1 is output to motor */ clear_bit(TRISB, LED); /* Port RB.4 is output LED*/ clear_bit(STATUS, RP0); while(1) { /* start the motor at half speed */ mm_start(MOTOR, MMPIN, 128); delay_s(2); /* stop it */ mm_stop(MOTOR, MMPIN); /* flash the LED once */ set_bit(PORTB, LED); delay_s(1); clear_bit(PORTB, LED); delay_s(1); } }