final nnnn

Dependencies:   mbed

Este proyecto es un Piccolo en el cual se envía comandos para la realización de un dibujo en especifico. El programa va a controlar servos y motores paso a paso teniendo libertad de movimiento en los ejes X,Y,Z; En el programa se utiliza Comunicacion Serial (TX,RX) y para leer el dato fue necesario concatenarlo debido a que recibe 8 Bits pero tenemos que recibir 4 paquetes de 8 Bits para llegar a 32 Bits y poder asi leerlo.

Se estan implementando algunas librerias para su ejecucion como la #include "memory.h" que es de memoria, #include memory_array_h, tambien definimos la memoria #define mm_size 10 de tipo Type Uint32_t, la libreria de operaciones #include "math.h" y la libreria para los motores #include "stepmotor.h".

Para su ejecucion se crearon variables de ejecucion:

CM_DRAWING 0XFF: Se ejecuta siempre y cuando exista datos validos para leer de memoria y nos muestra por medio de un mensaje que se esta ejecutando el dibujo

CM_SAVING 0XFE: Inicia el comando de guardar

CM_VERTEX2D 0XFD: Se encarga de dar las coordenadas a los servomotores en X,Y.

CM_DRAW 0XFC: Se encarga de mover nuestro motor en Z

CM_NODRAW 0XFB: Su funcion es volver a la posicion inicial el motor en el eje Z

CM_MOTOR 0XF9: Se encarga de mover los motores paso a paso para llegar a la ubicacion asignada ingresando el Numero de cuadrantes y su sentido de giro.

Committer:
ANTONIO_VARGAS
Date:
Wed Apr 11 02:19:13 2018 +0000
Revision:
0:0119b611fc51
Child:
1:6ed951d975cc
nnhjk

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ANTONIO_VARGAS 0:0119b611fc51 1 #ifndef MAIN_H
ANTONIO_VARGAS 0:0119b611fc51 2 #define MAIN_H
ANTONIO_VARGAS 0:0119b611fc51 3
ANTONIO_VARGAS 0:0119b611fc51 4
ANTONIO_VARGAS 0:0119b611fc51 5 #include "draw.h"
ANTONIO_VARGAS 0:0119b611fc51 6 #include "memory.h"
ANTONIO_VARGAS 0:0119b611fc51 7 //******************************************************************************
ANTONIO_VARGAS 0:0119b611fc51 8 // Desarrollado por ferney beltran fbeltran@ecci.edu.co
ANTONIO_VARGAS 0:0119b611fc51 9 //******************************************************************************
ANTONIO_VARGAS 0:0119b611fc51 10
ANTONIO_VARGAS 0:0119b611fc51 11 //*****************************************************************************
ANTONIO_VARGAS 0:0119b611fc51 12 // COMANDOS
ANTONIO_VARGAS 0:0119b611fc51 13 // |POS_0|POS_1|POS_2| POS_3 |
ANTONIO_VARGAS 0:0119b611fc51 14 // | #C | a | b | c |
ANTONIO_VARGAS 0:0119b611fc51 15 //
ANTONIO_VARGAS 0:0119b611fc51 16 // #C -> Indica el comando FF, FE, ...
ANTONIO_VARGAS 0:0119b611fc51 17 // a -> es el fin de comando F0 en otros casos es el valor de la coord X
ANTONIO_VARGAS 0:0119b611fc51 18 //b -> Coordenada Y
ANTONIO_VARGAS 0:0119b611fc51 19 // c -> fin de comando F0
ANTONIO_VARGAS 0:0119b611fc51 20
ANTONIO_VARGAS 0:0119b611fc51 21 // Nota: El fin de comando no se almacena
ANTONIO_VARGAS 0:0119b611fc51 22 //******************************************************************************
ANTONIO_VARGAS 0:0119b611fc51 23
ANTONIO_VARGAS 0:0119b611fc51 24 /*
ANTONIO_VARGAS 0:0119b611fc51 25 prueba 1
ANTONIO_VARGAS 0:0119b611fc51 26 ff f0
ANTONIO_VARGAS 0:0119b611fc51 27
ANTONIO_VARGAS 0:0119b611fc51 28 prueba 2
ANTONIO_VARGAS 0:0119b611fc51 29 fe f0 fd 00 00 f0 fc f0 fd 00 32 f0 fd 32 32 f0 fd 32 00 f0 fd 00 00 f0 fb f0 fa f0
ANTONIO_VARGAS 0:0119b611fc51 30 ff f0
ANTONIO_VARGAS 0:0119b611fc51 31
ANTONIO_VARGAS 0:0119b611fc51 32 prueba 3
ANTONIO_VARGAS 0:0119b611fc51 33 fe f0 fd 00 00 f0 fc f0 fd 00 0A f0 fd 32 0A f0 fd 32 14 f0 fd 00 14 f0 fd 00 1E f0 fd 32 1E f0 fd 32 28 f0 fd 00 28 f0 fa f0
ANTONIO_VARGAS 0:0119b611fc51 34 ff f0
ANTONIO_VARGAS 0:0119b611fc51 35
ANTONIO_VARGAS 0:0119b611fc51 36
ANTONIO_VARGAS 0:0119b611fc51 37
ANTONIO_VARGAS 0:0119b611fc51 38 */
ANTONIO_VARGAS 0:0119b611fc51 39
ANTONIO_VARGAS 0:0119b611fc51 40 #define DEBUG 1
ANTONIO_VARGAS 0:0119b611fc51 41
ANTONIO_VARGAS 0:0119b611fc51 42
ANTONIO_VARGAS 0:0119b611fc51 43 void debug_m(char *s , ... );
ANTONIO_VARGAS 0:0119b611fc51 44 uint32_t read_command();
ANTONIO_VARGAS 0:0119b611fc51 45 void init_serial();
ANTONIO_VARGAS 0:0119b611fc51 46 void drawing();
ANTONIO_VARGAS 0:0119b611fc51 47 void saving();
ANTONIO_VARGAS 0:0119b611fc51 48
ANTONIO_VARGAS 0:0119b611fc51 49
ANTONIO_VARGAS 0:0119b611fc51 50 /********************* PARAMETROS PARA DEFINIR EL COMMANDO ******************/
ANTONIO_VARGAS 0:0119b611fc51 51 #define CM_DRAWING 0xff
ANTONIO_VARGAS 0:0119b611fc51 52 #define CM_SAVING 0xfe
ANTONIO_VARGAS 0:0119b611fc51 53 #define CM_VERTEX2D 0xfd
ANTONIO_VARGAS 0:0119b611fc51 54 #define CM_DRAW 0xfc
ANTONIO_VARGAS 0:0119b611fc51 55 #define CM_NODRAW 0xfb
ANTONIO_VARGAS 0:0119b611fc51 56 #define CM_STOP 0xfa
ANTONIO_VARGAS 0:0119b611fc51 57 #define CM_END 0xf0
ANTONIO_VARGAS 0:0119b611fc51 58
ANTONIO_VARGAS 0:0119b611fc51 59 #endif // MAIN_H