uso de motor stepper con teclado matricial

Páginas: 2 (323 palabras) Publicado: 24 de agosto de 2015
Uso del motor stepper
Con microc para pic 16f877a


unsigned short kp,cnt,a = 0; //declarando variables

char keypadPort at PORTD; //activando el puerto para el uso del teclado
//activacion dela pantalla lcd
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISB0_bit;sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
void main()
{cnt = 0;
Keypad_Init();//iniciando el teclado
Lcd_Init(); //iniciando la pantalla
lcd_out(1,1, "uso de stepper");
trisc= 0 ; //declarando el puerto para el uso del motor stepper
do
{kp = 0;
do //esperando una tecla
kp = Keypad_Key_Click();// //Lee el número de la tecla y lo guarda en kp.
while (!kp);
switch (kp)
{
case 3: //tecla 1{
lcd_cmd(_lcd_clear);
lcd_out(1,1, "Tecla 1");
lcd_out(2,1, "tec.1 1 vuelta");
portc= 0b0001;
delay_ms(200);
portc= 0b0010;delay_ms(200);
portc= 0b0100;
delay_ms(200);
portc=0b1000;
break;
}
case 5: //tecla 8
{lcd_cmd(_lcd_clear);
lcd_out(1,1, "Tecla 8");
lcd_out(2,1, "tec.8 1/2 paso");
portc= 0b0001;
delay_ms(200);
portc= 0b0011;
delay_ms(200);portc= 0b0010;
delay_ms(200);
portc= 0b0110;portc= 0b0011;
delay_ms(200);
portc= 0b0100;
delay_ms(200);portc= 0b1100;
delay_ms(200);
portc= 0b1000;
delay_ms(200);
portc= 0b1001;
break;
}
case 6://tecla 5
{...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Controlar Un Motor Paso A Paso Mediante Un Teclado Matricial
  • Teclado matricial
  • Teclado Matricial
  • Teclado matricial
  • Teclado matricial
  • Teclado Matricial
  • Motor Stepper
  • Teclado Matricial

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS