Mesa posicionadora
// Programa da MESA POSICIONADORA - 3º Periodo de Mecatrônica
//
//**************************************************************************************************
#include // microcontrolador usado
#use delay(clock=20000000) // freq do cristal que esta sendo utilizado
#use rs232(baud = 9600, parity = N, xmit = pin_c6, rcv = pin_c7, bits = 8)
// diretivas de config da serial
#fuses HS, NOWDT,PUT,NOBROWNOUT,NOLVP
#include
//**************************************************************************************************
// Área de definições de pinos de entradas
//**************************************************************************************************
#define EncB pin_b1 //canal b do encorder
#define sensor_0 pin_a4 //
#define sensor_1 pin_a5
#define sensor_2 pin_e0
#define sensor_3 pin_e1
//**************************************************************************************************
// Área de definições de pinos de Saída
//**************************************************************************************************
#define led pin_A0
#define freio pin_C1
//**************************************************************************************************
// Definição da variável global
//**************************************************************************************************
signed long posicao; short Sentido_X; long valor_PWM; char Tecla,PWM[5],s_Resolucao_X[4],X[10]; float f_Resolucao_X = 0, f_Angulo_X = 0, f_Linear_X = 0, f_X=0;
//**************************************************************************************************
// Interrupção externa por borda de descida em rb0
//**************************************************************************************************
#int_ext // Tratamento da interrupcao externa void Trata_RB0(void)
{
if(input(EncB)) { posicao++;