/*********************************** * Micro-GT Versatile IDE * * modulo L298 * * pilotaggio motore passo/passo * * prof. Gottardo Marco * * aprile 2010 * ***********************************/ /*****lista delle attribuzioni****** CW RA0 ACW RA1 mot_A RB0 mot_B RB1 mot_C RB2 mot_D RB3 ***********************************/ #include #include #include "setting16F877.h" void Full_CW(){ while(ruotaCW==1) //doppio uguale per confrontare { //implementa la matrice di passo intero 10,6,5,9 PORTB=10; DelayMs(200); PORTB=6; DelayMs(200); PORTB=5; DelayMs(200); PORTB=9; DelayMs(200); } } void Full_ACW(){ while(ruotaACW==1) //doppio uguale per confrontare { //implementa la matrice di passo intero 9,5,6,10 inversa PORTB=9; DelayMs(200); PORTB=5; DelayMs(200); PORTB=6; DelayMs(200); PORTB=10; DelayMs(200); } } void main(void){ settings(); while(1){ if (CW==1){ DelayMs(100); //antirimbalzo if (CW==1){ Full_CW(); } } if (ACW==1){ DelayMs(100); //antirimbalzo if (CW==1){ Full_ACW(); } } } }