ArmandoCircuitos
Inicio
Electronica
Programacion
Diagrama
Codigo
//Constantes con la secuencia de pasos. const unsigned short PASOS[4] = { 0b00000001, 0b00000010, 0b00000100, 0b00001000 }; void main() { unsigned short PASO = 0; OPTION_REG.F7 = 0; TRISD = 0xF0; PORTD = 0; while(1){ if (PORTB.F0 == 0){ PASO++; if( PASO == 4 ) PASO=0; PORTD = PASOS[PASO]; } if (PORTB.F3 == 0){ PASO--; if( PASO == 255 ) PASO=3; PORTD = PASOS[PASO]; } Delay_ms(100); } }
Descarga del archivo
Descargar archivo