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:
Fri Apr 20 00:56:27 2018 +0000
Revision:
1:6ed951d975cc
Parent:
0:0119b611fc51
hjv

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 1:6ed951d975cc 7
ANTONIO_VARGAS 0:0119b611fc51 8 // COMANDOS
ANTONIO_VARGAS 0:0119b611fc51 9 // |POS_0|POS_1|POS_2| POS_3 |
ANTONIO_VARGAS 0:0119b611fc51 10 // | #C | a | b | c |
ANTONIO_VARGAS 0:0119b611fc51 11 //
ANTONIO_VARGAS 0:0119b611fc51 12 // #C -> Indica el comando FF, FE, ...
ANTONIO_VARGAS 0:0119b611fc51 13 // a -> es el fin de comando F0 en otros casos es el valor de la coord X
ANTONIO_VARGAS 0:0119b611fc51 14 //b -> Coordenada Y
ANTONIO_VARGAS 0:0119b611fc51 15 // c -> fin de comando F0
ANTONIO_VARGAS 0:0119b611fc51 16
ANTONIO_VARGAS 0:0119b611fc51 17 /*
ANTONIO_VARGAS 0:0119b611fc51 18 prueba 1
ANTONIO_VARGAS 0:0119b611fc51 19 ff f0
ANTONIO_VARGAS 0:0119b611fc51 20
ANTONIO_VARGAS 0:0119b611fc51 21 prueba 2
ANTONIO_VARGAS 0:0119b611fc51 22 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 23 ff f0
ANTONIO_VARGAS 0:0119b611fc51 24
ANTONIO_VARGAS 0:0119b611fc51 25 prueba 3
ANTONIO_VARGAS 0:0119b611fc51 26 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 27 ff f0
ANTONIO_VARGAS 0:0119b611fc51 28
ANTONIO_VARGAS 0:0119b611fc51 29
ANTONIO_VARGAS 0:0119b611fc51 30 */
ANTONIO_VARGAS 0:0119b611fc51 31
ANTONIO_VARGAS 0:0119b611fc51 32 #define DEBUG 1
ANTONIO_VARGAS 0:0119b611fc51 33
ANTONIO_VARGAS 0:0119b611fc51 34
ANTONIO_VARGAS 0:0119b611fc51 35 void debug_m(char *s , ... );
ANTONIO_VARGAS 0:0119b611fc51 36 uint32_t read_command();
ANTONIO_VARGAS 0:0119b611fc51 37 void init_serial();
ANTONIO_VARGAS 0:0119b611fc51 38 void drawing();
ANTONIO_VARGAS 0:0119b611fc51 39 void saving();
ANTONIO_VARGAS 0:0119b611fc51 40
ANTONIO_VARGAS 0:0119b611fc51 41
ANTONIO_VARGAS 0:0119b611fc51 42 /********************* PARAMETROS PARA DEFINIR EL COMMANDO ******************/
ANTONIO_VARGAS 0:0119b611fc51 43 #define CM_DRAWING 0xff
ANTONIO_VARGAS 0:0119b611fc51 44 #define CM_SAVING 0xfe
ANTONIO_VARGAS 0:0119b611fc51 45 #define CM_VERTEX2D 0xfd
ANTONIO_VARGAS 0:0119b611fc51 46 #define CM_DRAW 0xfc
ANTONIO_VARGAS 0:0119b611fc51 47 #define CM_NODRAW 0xfb
ANTONIO_VARGAS 0:0119b611fc51 48 #define CM_STOP 0xfa
ANTONIO_VARGAS 0:0119b611fc51 49 #define CM_END 0xf0
ANTONIO_VARGAS 1:6ed951d975cc 50 #define CM_MOTOR 0xf9
ANTONIO_VARGAS 0:0119b611fc51 51
ANTONIO_VARGAS 0:0119b611fc51 52 #endif // MAIN_H