#include #include #define UPPERLIMIT 27 #define LOWERLIMIT 43 #define LEFTLIMIT 25 #define RIGHTLIMIT 55 #define GRIPOPEN 40 #define GRIPCLOSED 55 #define CYCLETIME 150 #define DELAYCYCLES 100 void main() { int done; int count; PORTC = 0x00; DDRC = 0x00; PORTD = 0x00; DDRD = 0xFF; done = 0; while(!done){ count = 0; while(count < DELAYCYCLES) { PORTCbits.RC0 = 1; /* start elevation pulse */ Delay100TCYx(UPPERLIMIT); PORTCbits.RC0 = 0; PORTCbits.RC1 = 1; /* start rotation pulse */ Delay100TCYx(LEFTLIMIT); PORTCbits.RC1 = 0; PORTCbits.RC2 = 1; /* start grip pulse */ Delay100TCYx(GRIPOPEN); PORTCbits.RC2 = 0; Delay100TCYx(CYCLETIME); /* delay before restarting pulse generation */ count = count + 1; } count = 0; while(count < DELAYCYCLES) { PORTCbits.RC0 = 1; /* start elevation pulse */ Delay100TCYx(LOWERLIMIT); PORTCbits.RC0 = 0; PORTCbits.RC1 = 1; /* start rotation pulse */ Delay100TCYx(RIGHTLIMIT); PORTCbits.RC1 = 0; PORTCbits.RC2 = 1; /* start grip pulse */ Delay100TCYx(GRIPCLOSED); PORTCbits.RC2 = 0; Delay100TCYx(CYCLETIME); count = count + 1; } } } /* end main */