Pantografo

OBJECTIVE:

The objective this project is apply the know acquired on micro controllers and have knows of others concepts in electronic, general physic and mechanic basic for that it can run the protect.

DESCRIPTION:

The project has particular factor in where the micro controller can receive and emit the signal for can controller the motor's turns, and show in the LCD screen in the three axes of Cartesian plane, in where it can travel to forward, behind, left, right, up and down according with the button pushed per user.

The code:

This code has a configuration of the turns of motors, the LCD screen, and the entrance of the signal in where it will indicate the direction and sense of turn of the motors:

#define F_CPU 1000L
#include <avr/io.h>
#include <avr/delay.h>
#include <util/lcd.h>
 
int main(void)
{
    MCUCSR=0b10000000;
    MCUCSR=0b10000000;
    DDRA=0x00;
    DDRC=0xFF;
 
    LCD_init();
    LCD_write("Bienvenidos");
    LCD_linea();
    LCD_write("Pantografo");
    LCD_linea();
 
    while(1)
    {
        _delay_ms(20);
 
        if(PINA==0b00000000) 
            {
                PORTC=0b00000000;
            }
 
        if(PINA==0b00111111)
            {            
                PORTC=0b00000000;
            }
        if(PINA==0b00000001) // MOTOR EJE Z
            {    
                LCD_write("Motor Z girando");
                LCD_linea();
                LCD_write("Z+: Arriba");
                LCD_linea();
                PORTC=0b00000001;
                while(PINA==0b00000001){}
            }
        if(PINA==0b00000010)
            {
                LCD_write("Motor Z girando");
                LCD_linea();
                LCD_write("Z-: Abajo");
                LCD_linea();
                PORTC=0b00000010;
                while(PINA==0b00000010){}
            }
 
        if(PINA==0b00000100) // Motor Eje Y
            {
                LCD_write("Motor Y girando");
                LCD_linea();
                LCD_write("Y+: Adelante");
                LCD_linea();
                PORTC=0b00000100;
                while(PINA==0b00000100){}
            }
        if(PINA==0b00001000)
            {
                LCD_write("Motor Y girando");
                LCD_linea();
                LCD_write("Y-: Atras");
                LCD_linea();
                PORTC=0b00001000;
                while(PINA==0b00001000){}
            }
 
        if(PINA==0b00010000) //Motor axe X
            {
                LCD_write("Motor X girando");
                LCD_linea();
                LCD_write("X+: Derecha");
                LCD_linea();
                PORTC=0b00010000;    
                while(PINA==0b00010000){}
            }
        if(PINA==0b00100000)
            {
                LCD_write("Motor X girando");
                LCD_linea();
                LCD_write("X-: Izquierda");
                LCD_linea();
                PORTC=0b00100000;
                while(PINA==0b00100000){}
            }     
 
        }
}
proyecto.jpg

This follow image is the simulation in Proteus

simulacion.jpg
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License