Escolar Documentos
Profissional Documentos
Cultura Documentos
TESIS DE GRADO
INGENIERO EN ELECTRICIDAD
Presentado por:
GUAYAQUIL ECUADOR
AO 2008
AGRADECIMIENTO
A Dios.
A los amigos.
en dos tarjetas.
por conectores que podrn ser usados para diferentes aplicaciones y sern
RESUMEN ..................................................................................................... VI
INTRODUCCIN ............................................................................................ 1
................................................................................................... 91
....................................................................................................... 119
....................................................................................................... 133
5.2.1 Curvas de operacin del ciclo de trabajo de los motores ......... 147
................................................................................................. 150
................................................................................................. 153
servomotor ........................................................................................ 60
motor ................................................................................................ 64
dsPIC30F4011 .................................................................................. 66
......................................................................................................... 72
Figura 2.18 Diagrama del PCB de la tarjeta de entrenamiento con dsPIC ........ 83
visualizacin ..................................................................................... 99
Figura 4.1 Panel frontal para interfaz del control de motor ............... 142
Figura 4.2 Diagrama de bloques para interfaz del control de motor .. 143
Figura 5.7 Voltaje y corriente del motor de imn permanente ............ 150
....................................................................................................... 151
Figura 5.11 Respuesta del motor al controlador kp=2 y ki=5 ............. 152
dsPIC30F4011 .................................................................................. 93
dsPIC30F4011 .................................................................................. 94
Tabla 3.15 Configuracin para el manejo de los motores DC y paso ........ 104
Tabla 3.16 Conectores para encoder, motores dc, paso, y servo motores ........... 104
control PI.
1.1 Antecedentes
sencilla.
Plataforma de Desarrollo.
MCU comunes.
funcin.
entrenamiento.
anteriormente descritos.
salidas digitales.
8
Programacin
Bootloader UART Banco de Interruptores
Banco Interruptor
VUSB (4.5-5V)
Seales digitales
Vin (6 12 VDC) Botn de reset Diodo, Bocina, Rel
Encoder
Puentes 3:1 Servomotores
FUENTE: Personal
13
computador completo.
Diagnsticos de imgenes.
Medicina Electrocardiogramas
Presentacin de Imgenes Mdicas
Radar, Sonar
Militar Seguridad de comunicacin
Ordenes Guiadas
Adquisicin de datos
Ingeniera Anlisis Espectral
Simulacin y modelamiento
conocidos.
LINEAS
UART
CAN
CONTROL A/D 12-BIT
SPI
E/S
DISPOSITIVO I2C
MOTORES 500Ksps
INTERFAZ
SALIDAS
CODEC
SPI
I2C
DISPOSITIVO MODO UART LINEAS E/S
A/D 12-BIT
COMPARADOR
100Ksps
dsPIC30F3011 2 8 canales 1 1 1 20
dsPIC30F3012 2 8 canales 1 1 1 20
dsPIC30F2012 2 10 canales 1 1 1 20
dsPIC30F3013 2 10 canales 2 1 1 20
esta funcin entre las que se encuentran: seis canales de PWM con salidas
simultneamente.
procesador:
1.4.2 Temporizadores
prioridad de la interrupcin).
entradas para la captura IC1, IC2, IC7, IC8, siendo muy usado
Aproximacin Sucesiva).
Maestro y Esclavo.
1.5.1 Generalidades
dispone de salidas externas (ver tabla 1.1), las cuales podrn ser
Valormedio
Anchodepulso
FUENTE: Personal
FUENTE: Personal
mercado.
'Declaraciones
'(globales, disponibles en todo el programa):
'Simbolos
symbol ...
'Variables
dim ...
'Constantes
const ...
'Procedimientos
sub procedure nombre_del_procedimiento(...)
...
end sub
'Funciones
sub function nombre_de_la_funcion(...)
<declaraciones locales>
end sub
'Programa principal:
main: 'Aqu escribimos nuestro cdigo
end.
40
Variables: Las variables son objetos cuyo valor puede cambiar con la
ajuste a las reglas definidas mas arriba para los identificadores. Deben
dim i, j, k as byte
proyecto en mikroBasic.
42
pantalla de la computadora.
mismo dispositivo dsPIC debe ser grabado una y otra vez para
micropulsadores.
programa.
50
teclado.
manejo de teclado matricial, que ofrece 2*n teclas por cada n bits.
los cuales son alimentacin (rojo y negro), que puede ir desde 4.8V
motores dc.
MUR8100 MUR8100
MUR8100 MUR8100
igual a la mitad del paso real, para ello se activan primero dos
la tabla 2.4 se indica los tiempos en alto y en bajo que debe de tener la
casi nula debido a que esta unida mediante un aislante por lo que
juntura.
Circuito Circuito
de de
control excitacin
(manejador)
Fuente: Personal
2.4 Esquemticos
al diseo.
implementarse.
impreso
electronics industries).
siguientes tablas.
Externa 0,2489 mm
ANCHO
Interna 1,0126 mm
2
Espesor del cobre 1 1 onza/pie
Temperatura mxima 35 35 C
Temperatura ambiente 25 25 C
ANCHO PISTA
una qued montada sobre una placa de fibra de vidrio de doble capa
FUENTE: Personal
0.7, 0.8, 1.0, 1.2, 1.5, 1.6, 2.0, 2.4, 3.2, 6.4 mm. (UNE 20-621-
o superior de la misma.
91
unidad de control.
impreso
FUENTE: Personal
92
REFERENCIA DESCRIPCIN
D1 Led indicador de energizacin de fuente de alimentacin de control
D3 Diodo 1N4007 de proteccin para fuente de alimentacin de control
FUENTE: Personal
94
CONECTOR/INTERRUPTOR SALIDA
Interruptor de energizacin APAGADO ENCENDIDO
Bornera de VNR 0 VDC 8-12 VDC
Bornera de VR 0 VDC 4,5 - 5,5 VDC
FUENTE: Personal
POSICIN: 123
LCD
LEDS
DISPLAY
FUENTE: Personal
respectivo funcionamiento.
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
POSICIN: 1 2 3
FUENTE: Personal
1: Positiva
2
3: Negativa
Lgica
FUENTE: Personal
Tabla 3.16 Conectores para encoder, motores dc, paso, y servo motores
MOTOR
CONECTOR
Cable Alimentacin
1 Vcc
Encoder 2 Gnd
3 Seal Z 5VDC
J20, J21 4 Fase A
5 Fase B
Bornera del motor DC 1 M(+)
MG1 (MOTOR DC 2 M(-) 6-24 VDC
+MT-)
1 Fase 1
2 Comn A
Bornera del 3 Fase 3
motor de paso M1 6-24 VDC
(MOTOR-PASO) 4 Fase 4
5 Comn B
6 Fase 2
Conectores de servo 1 Control
motores J22, J23, J24 2 Vcc 5VDC
(SERVO x 3) 3 Gnd
FUENTE: Personal
105
existen dos conectores DB9 hembra de los cuales uno esta destinado
FUENTE: Personal
protocolo RS-232, para lo cual se ha hecho uso del UART2 del dsPIC,
SSP (puerto serial sincrnico), muy til para comunicacin con otros
Los modos de operacin posibles del mdulo SSP son: SPI (interfase
circuitos integrados).
107
20.83 $/mes
Amortizacin del computador = * 450 h = $ 58.59
160 h/mes
FUENTE: Personal
FUENTE: Personal
166.67 $/mes
Amortizacin de herramienta de diseo = *180 h = $ 187.50
160 h/mes
FUENTE: Personal
de 250 $/mes, para este anlisis se considera que un mes tiene 160
112
horas hbiles entonces se obtiene los salarios por hora, para mayor
FUENTE: Personal
FUENTE: Personal
FUENTE: Personal
FUENTE: Personal
113
dsPIC30F4011 en el mercado.
costo total es la suma de los costos fijos con los costos variables.
CT = CF + CV = CF + CVUNIDAD * N UNIDADES
IT = PU * N UNIDADES CT
CF
N UNIDADES =
PU CV
115
4. PROGRAMACIN Y APLICACIONES
dsPICs
anexo A).
'==========================================================
'| TTULO : CONVERSIN ADC |
'| AUTORES : O.XAVIER BARCIA R. -- ROGER A. CALLE C. |
'| ESCUELA : ESCUELA SUPERIOR POLITCNICA DEL LITORAL |
'| FECHA : Julio/2008 |
'| VERSIN : 1.0 |
'==========================================================
'|CONFIGURACIONES DE LOS PUENTES |
'| - LCD |
'| - Potencimetro uno en RB7 |
'|ACCIONAMIENTO |
'| - Encender el interruptor de alimentacin del control |
'| - Setear el potencimetro en una determinada posicin |
'==========================================================
program ADC
'======================================================
'DECLARACIONES GLOBALES DISPONIBLE EN TODO EL PROGRAMA
'======================================================
'Declaracion de Symbols
'-------------------------------------------------
symbol DELAY_medS = Delay_ms(500) 'Delay de 500 ms
symbol DELAY1S = Delay_ms(1000) 'Delay de 500 ms
'Declaracion de Variables
'-------------------------------------------------
dim i as byte
121
'======================================================
'P R O G R A M A P R I N C I P A L
'======================================================
main:
'Variables locales
dim adcRes as word
dim txt,txthex as string[20]
dim ADCVolt as float
ADPCFG=$FF7F 'Todas Digitales, excepto RB7 como
' analgica
TRISB = $80 'Se configura el puerto B como salida
TRISC = 0 ' TRISB.7 = 1 seteado como entrada
TRISD = 0 ' necesario para trabajar como ADC
TRISE = 0
TRISF = 0
PORTB.8 = 1 'Salidas del puerto B8 en alto
DELAY_medS 'Delay_ms(500)
Lcd_Init(PORTD, 3,2,1,0, PORTC, 13,12,14)
Lcd_Cmd(LCD_CURSOR_OFF)
Lcd_Out(1, 2, "Parpadeando LED!")
FOR i = 1 to 4
Lcd_Out(2, 2, ". ")
PORTB.8 = %0
Delay_ms(100) 'Espera para la inicializacin
Lcd_Out(2, 2, ".. ") ' del teclado
PORTB.8 = %1
Delay_ms(100) 'Espera para la inicializacin
Lcd_Out(2, 2, "...") ' del teclado
Delay_ms(100)
NEXT i
Lcd_Cmd(LCD_CLEAR)
Lcd_Out(1, 1, "ADC ==>")
while true
adcRes = Adc_Read(7) 'Valores max=0x03FF = 5 Voltios
'min=0 voltios
Delay_ms(50)
ADCVolt= adcRes * 5/1023
'==========================================================
'| TTULO : USO DEL TECLADO PS/2 |
'| AUTORES : O.XAVIER BARCIA R. -- ROGER A. CALLE C. |
'| ESCUELA : ESCUELA SUPERIOR POLITCNICA DEL LITORAL |
'| FECHA : Julio/2008 |
'| VERSIN : 1.0 |
'==========================================================
'|CONFIGURACIONES |
'| - Configurar puestes para habilitar el Encoder |
'| - Conexin del encodes y motor en sus respectivas |
'| borneras |
'| - Configurar los interruptores en posicin MOTOR DC |
'| - Conectar el cable serial del pc a la tarjeta |
'|ACCIONAMIENTO |
'| - Encender el interruptor de alimentacin del motor |
'| y la del control. |
'| - Ejecutar la interfaz de LabVIEW, ingresando los |
'| parmetros de velocidad en RPM, Kp, Ki y presionar el |
'| botn de sentido de giro del motor |
'==========================================================
program TecladoPS2_LCD
'======================================================
'DECLARACIONES GLOBALES DISPONIBLE EN TODO EL PROGRAMA
'======================================================
'dim ? as short 'short : 8bit -> -127...128
'dim ? as word 'word :16bit -> 0...65535
'dim ? as integer 'integer :16bit -> -32768...32767
'longword,dword,longint
'dim ? as 'float :32bit -> 1,1754943x1038
...6,8056477x1038
dim i as byte 'bytes,char: 8bit-> 0...255
dim sw as byte
dim Key_capture, Key_valor, Key_especial, pressed as word
'======================================================
' DECLARACIONES DE PROCEDIMIENTOS Y FUNCIONES
'======================================================
sub procedure mostrar_caracter(dim Key_valor_p as word)
if (Key_valor_p=13) then
if sw=0 then
Lcd_Out(2, 1, "")
sw=1
123
else
Lcd_Cmd(LCD_CLEAR)
sw=0
end if
end if
if (Key_valor_p<>13) then
Lcd_Chr_Cp(Key_valor_p)
end if
end sub
'======================================================
' DECLARACIONES DE PROCEDIMIENTOS Y FUNCIONES
'======================================================
main:
'=> ADPCFG configura los pines del puerto como entrada
' analgicas o entradas/salidas digitales. Ejemplo:
' $00FF=%0000 0000 1111 1111
' ADPCFG=$00FF Analgico Rb15..RB8 Digital RB7...8;
'Configuraciones e inicializaciones
ADPCFG=$FFFF 'Digitales RB15...RB0
Key_valor = 0
Key_especial= 0
Pressed = 0
sw=0
'Ps2_Config(port,clkpin,datapin)
Ps2_Config(PORTF, 0, 1)
'Ps2_Init(PORTC)
Delay_ms(500) 'Espera inicializacin de teclado
'Lcd_Out(1, 3, "Hello!")
'Lcd_Cmd(LCD_CURSOR_OFF)
'Lcd_Cmd(LCD_FIRST_ROW)
'Lcd_Out(2, 6, "Elektronika")
124
'Delay_ms(1000)
'Lcd_Cmd(LCD_CLEAR)
'Lcd_Out(1, 6, "Elektronika")
'Press Enter to continue:
while(1)
if (Ps2_Key_Read(Key_valor, Key_especial, pressed))
then Key_capture=Key_valor
while (Ps2_Key_Read(Key_valor, Key_especial, pressed)=0)
PORTB.7 = 1
wend
mostrar_caracter(Key_capture)
PORTB.8 = 0
delay_ms(100) '100ms
end if
PORTB.8 = 1
Delay_ms(1) ' debounce
wend
end.
de la siguiente manera:
Kc t de(t )
u (t ) = K c * e(t ) +
Ti 0
e(t )dt + K C Td
dt
+ u0
t t
e(t )t Ts e(i)
0 0
K C TS t
K cTd [e(t ) e(t 1)]
u (t ) = K C * e(t ) +
Ti
e(i) +
i =0 TS
+ u0
t
u (t ) = K p * e(t ) + K i e(i ) + K d [e(t ) e(t 1)] + u 0
i =0
u (t ) = K p * e(t ) = K p [ y (t ) R(t )]
'==========================================================
'| TTULO : CONTROL PI PARA MOTOR DC USANDO LabVIEW |
'| AUTORES : O.XAVIER BARCIA R. -- ROGER A. CALLE C. |
'| ESCUELA : ESCUELA SUPERIOR POLITCNICA DEL LITORAL |
'| DESCRIPCIN: |
'| FECHA : Septiembre /2008 |
'| VERSIN : 1.0 |
'==========================================================
'|CONFIGURACIONES |
'| - Configurar puentes para habilitar el encoder |
'| - Conexin del encoder y motor en sus respectivas |
'| borneras |
'| - Cofigurar los interruptores en posicin del MOTOR DC |
'| - Conectar el cable serial del pc a la tarjeta |
'|ACCIONAMIENTO |
'| - Encender el interruptor de alimentacin del motor |
'| y la del control. |
'| - Ejecutar la interfaz de LabVIEW, ingresando los |
'| parmetros de velocidad en RPM, Kp, Ki y presionar el |
'| botn de sentido de giro del motor |
'==========================================================
127
'==========================================================
program Encoder_MotorDC
'==========================================================
symbol boton_derecha = PORTF.6
symbol boton_izquierda= PORTB.7 'PORTE.0
symbol boton_parar = PORTE.8
symbol Luz = PORTB.8
symbol Encender = 0
symbol Apagar = 1
symbol Frenando = Estado.0 'Frenando
symbol Detenido = Estado.1 'Detenido
symbol Izquierda = Estado.2 'Girando izquierda
symbol Derecha = Estado.3 'Girando derecha
symbol DatoListo = Estado.4 'Dato listo para enviar
'Muestreo a 500ms
symbol Desp2RPM = 5.859375 '60/1024*100 = 60/(2048/2)*100
'Muestreo a 250ms
'symbol Desp2RPM = 11.718750 '60/512*100 = 60/(2048/4)* 100
'Muestreo a 200ms
'symbol Desp2RPM = 14.648438 '60/409.6*100 = 60/(2048/5)*100
'Muestreo a 25ms
'symbol Desp2RPM = 117.1875 '60/409.6*100 = 60/(2048/5)*100
'symbol Kp = 2
symbol VelocidadRefrescar = 250
symbol TiempoEspera = 10000
end if
wend
'Esperamos el siguiente caracter
xUno = Uart2_Read_Char()
xRetardo = 0
while (Uart2_Data_Ready() = 0)
xRetardo = xRetardo + 1
if xRetardo > TiempoEspera then
exit
end if
wend 'Esperamos el siguiente caracter
xDos = Uart2_Read_Char()
xRetardo = 0
while (Uart2_Data_Ready() = 0)
xRetardo = xRetardo + 1
if xRetardo > TiempoEspera then
exit
end if
wend 'Esperamos el siguiente caracter
xTres = Uart2_Read_Char()
xRetardo = 0
while (Uart2_Data_Ready() = 0)
xRetardo = xRetardo + 1
if xRetardo > TiempoEspera then
exit
end if
wend 'Esperamos el siguiente caracter
xCuatro = Uart2_Read_Char()
ut = utAux / 100000
'Mostramos la correccin recibida
FloatToStr(ut, txtfloat)
Lcd_Out(2, 9,"ut : ")
Lcd_Out(2,13,txtfloat)
'control proporcional
'et = RPMRef - RPM 'Viene desde LabVIEW
'ut = Kp * et 'Viene desde LabVIEW
if Detenido = 0 then
iDuty_word = iDuty_word + ut
if Izquierda = 1 then
Pwm_Mc_Set_Duty(iDuty_word, 3)
end if
if Derecha = 1 then
130
Pwm_Mc_Set_Duty(iDuty_word, 2)
end if
end if
end sub
main:
'DESABILITACIN DE INTERRUPCIONES
IEC0 = 0 'Registro de control de habilitacin de
'interrupciones(IECx)
IEC1 = 0 'Desabilitacin de interrupciones
IEC2 = 0
'INICIALIZACION DE VARIABLES
Estado = 0
desplazamiento = 0
ut = 0
Derecha =0
Izquierda=0
Detenido = 1
'CONFIGURACIONES DE PUERTOS
'ADPCFG=$FFBF, todas digitales, excepto RB6 como analgica
ADPCFG=$FFFF
TRISB = $00F8 'C0 %010000000 'Salida: Led B8
'Entrada: potenciometro B6,
'IZQUIERDA B7
'TRISE = %100000000 'Entrada: botonera PARO E8
'TRISF = %001000000 'Entrada: botonera F6 DERECHA
PORTB.8 = 1
Delay_ms(100)
NEXT i
iDuty_word = 0
while true
'Comandos que recibe la tarjeta
if Uart2_Data_Ready() = 1 then
RecibirCaracter = Uart2_Read_Char()
select case RecibirCaracter
case "I" 'Comando Izquierda
Izquierda = 1
case "D" 'Comando Derecha
Derecha = 1
case "P" 'Comando parar
Detener()
case "Y" 'Comando reportar salida
Controlar()
case "N"
Uart2_Write_Text("N15")
end select
end if
'ciclo de refrescado
VelocidadRefrescarContador = VelocidadRefrescarContador + 1
if VelocidadRefrescarContador > VelocidadRefrescar then
'Mostramos el duty calculado
'FloatToStr(RPMRef, txtfloat)
'Lcd_Out(2, 9,"RPM: ")
'Lcd_Out(2,13,txtfloat)
'Mostramos el DutyActual
wordToStr(iDuty_word, txtfloat)
Lcd_Out(1, 2,txtfloat)
'Posicion actual
wordToStr(POSCNT, txtfloat)
Lcd_Out(1,8,txtfloat)
'Muestra la velocidad real en RPM
FloatToStr(RPM, txtfloat)
txtfloat[5] = 0
Lcd_Out(2, 1,txtfloat)
'Indicamos la direccion
if (QEICON and $0800) then
Lcd_Out(1, 1,"D")
else
Lcd_Out(1, 1,"I")
end if
end if
wend
end.
133
desarrollo
'==========================================================
'| TTULO : MANEJO DE MOTOR DE PASO UNIPOLAR |
'| AUTORES : O.XAVIER BARCIA R. -- ROGER A. CALLE C. |
'| ESCUELA : ESCUELA SUPERIOR POLITCNICA DEL LITORAL |
'| FECHA : Julio/2008 |
'| VERSIN : 1.0 |
'==========================================================
'|CONFIGURACIONES |
'| - No es necesario configura los puentes para en motor |
'| - Configurar los puentes para el teclado matricial y el |
'| LCD |
'|ACCIONAMIENTO |
'| - Encender el interruptor de alimentacin del motor |
'| y la del control. |
'| - Las teclas del 1 al 9 en el teclado matricial |
'| se usa para configurar la velocidad del motor |
'| - La tecla asterisco y numeral es para el giro del |
'| motor hacia la izquierda o derecha respectivamente |
'| - El pulsador de interrupcin es usado para el paro |
'| del motor |
'==========================================================
Program MotorPaso
'======================================================
'DECLARACIONES GLOBALES DISPONIBLE EN TODO EL PROGRAMA
'======================================================
'Declaracin de Symbols
'-------------------------------------------------
symbol nLED = PORTB.8
symbol Phase1 = PORTE.2
symbol Phase2 = PORTE.3
symbol Phase3 = PORTE.4
symbol Phase4 = PORTE.5
symbol MotorPaso = PORTE
'Declaracin de Variables
'-------------------------------------------------
dim SW_Derecha,SW_Izquierda as byte
dim SW_Velocidad,SW_Stop as byte
dim kp,Velocidad as word
134
'Declaracin de Constantes
'-------------------------------------------------
const Encender as byte = 1
const Apagar as byte = 0
const Npaso as byte =8
'Secuencia de MEDIO PASO 1 2 3 4 5 6 7 8
const paso as word [8]=
($0004,$000C,$0008,$0018,$0010,$0030,$0020,$0024)
'======================================================
' DECLARACIONES DE PROCEDIMIENTOS Y FUNCIONES
'======================================================
sub procedure nLed_blink ()
for i = 1 to 2
nLED = 0
delay_ms(500)
nLED = 1
delay_ms(500)
next i
end sub
Velocidad_motor(Velocidad)
end sub
'======================================================
'P R O G R A M A P R I N C I P A L
'======================================================
main:
ADPCFG= $FFFF 'Todas Digitales
TRISB = $000F 'Salida: nLed RB8 Entrada/salida:Teclado Hex <RB7:RB0>
TRISE = $0100 'Entrada: botn Int_Ext de parada
TRISF = $0040 'Entrada: botn de giro_derecha RF6
delay_ms(50)
nLED = 1
nLed_blink()
Delay_ms(50)
Config_ExtInt0()
Delay_ms(50)
Keypad_Init(PORTB)
Delay_ms(100)
Lcd_Init(PORTD, 3,2,1,0, PORTC, 13,12,14)
Lcd_Cmd(LCD_CURSOR_OFF)
SW_Derecha =0
SW_Izquierda=0
SW_Velocidad=0
SW_Stop=1
Keypad_Init(PORTB)
Delay_ms(100)
Lcd_Out(1, 2, "MOTOR DE PASO")
Lcd_Out(2, 5, "UNIPOLAR")
delay_ms(2000)
Lcd_Cmd(LCD_CLEAR)
Lcd_Out(1, 1, "VEL: ESTD:Stop")
Lcd_Out(2, 1, "#Pasos:")
kp = 0
cnt=0
cpaso=0
while true
if SW_Stop=1 then
SW_Stop=0
while (kp=0) or (kp=4) or (kp=8) or (kp>=12)
kp = Keypad_Key_Click()
delay_us(100)
wend
'WordToStr(kp, kps)
kps= keyPulse_string(kp)
Lcd_Out(1, 5, kps)
Velocidad= kp
kp=0
while (kp=0) or (kp<=12) or (kp=16)
kp = Keypad_Key_Click()
delay_us(100)
wend
137
select case kp
case 13
SW_Izquierda = 1
SW_Derecha = 0
Lcd_Out(1, 13, " Izq")
case 14
SW_pasoXpaso = 1
case 15
SW_Derecha = 1
SW_Izquierda = 0
Lcd_Out(1, 13, " Der")
end select
SW_Stop=0
end if
'==========================================================
'| TTULO : MANEJO DE SERVO MOTOR |
'| AUTORES : O.XAVIER BARCIA R. -- ROGER A. CALLE C. |
'| ESCUELA : ESCUELA SUPERIOR POLITCNICA DEL LITORAL |
'| DESCRIPCIN: |
'| FECHA : Julio/2008 |
'| VERSIN : 1.0 |
'==========================================================
'|CONFIGURACIONES DE LOS PUENTES |
'| - LCD |
'| - Teclado 4x3 |
'| - Conector del servo motor RE0 |
'| (no necesita confurar puente) |
'|ACCIONAMIENTO |
'| - Digitar tres dgitos a travs del teclado debe estar |
'| entre 0 a 180 grados seguidamente presionar el botn |
'| asterisco para ejecutar la accin, si necesitamos |
'| cambiar posicin debemos presionar la tecla numeral |
'==========================================================
program ServoMotor
'======================================================
'DECLARACIONES GLOBALES DISPONIBLE EN TODO EL PROGRAMA
'======================================================
'Declaracion de Symbols
'-------------------------------------------------
symbol nLED = PORTB.8
'Declaracion de Variables
'-------------------------------------------------
dim i, duty_50 as word
dim kp as word
dim kpi as integer
dim kpf,Direccion_f as float
dim kpf_MSB,kpf_ISB,kpf_LSB as float
dim kps_t as string[3]
dim txt as string[3]
dim grado_f as float
dim kps as string[2]
139
'======================================================
' DECLARACIONES DE PROCEDIMIENTOS Y FUNCIONES
'======================================================
sub procedure nLed_blink ()
for i = 1 to 2
nLED = 0
delay_ms(500)
nLED = 1
delay_ms(500)
next i
end sub
'======================================================
'P R O G R A M A P R I N C I P A L
'======================================================
main:
ADPCFG= $FFFF 'Todas Digitales RB
TRISB = $000F 'Salida: nLed RB8
'Entrada/salida:Teclado Hex <RB7:RB0>
delay_ms(50)
nLED = 1
nLed_blink()
Delay_ms(50)
Keypad_Init(PORTB)
Delay_ms(100)
PORTE=0
Lcd_Init(PORTD, 3,2,1,0, PORTC, 13,12,14)
Lcd_Cmd(LCD_CURSOR_OFF)
init_fpwm_50Hz()
kp = Keypad_Key_Click()
delay_us(100)
wend
keyPulse(kp)
kpf_LSB=kpf
Lcd_Out(2, 6, kps)
kp=0
kpi=0
while (kp=0) or (kp<=12) or (kp=14) or (kp=16)
kp = Keypad_Key_Click()
delay_us(100)
wend
if kp=13 then
Lcd_Out(1, 13, "Actv")
grado_f= (100*kpf_MSB) + (10*kpf_ISB) + (kpf_LSB)
Direccion_f= 500 + 1600 * grado_f/180
FloatToStr(Direccion_f, txt)
Lcd_Out(2, 11, txt)
Lcd_Out(2, 15,"us")
Pwm_Mc_Set_Duty(Direccion_f, 1)
end if
while (kp=0) or (kp<=14) or (kp=16)
kp = Keypad_Key_Click()
delay_us(100)
wend
Lcd_Out(1, 1, "S.MOTOR EST:Camb" )
Lcd_Out(2, 1, "Gr: Dty: ")
wend
end.
de tal manera que haciendo uso del conector DB9 disponible en las
mismo.
CAPTULO 5
5. DATOS EXPERIMENTALES
recibe el motor.
145
mencionada.
y apagado en Q1-Q4.
FUENTE: Personal
FUENTE: Personal
148
FUENTE: Personal
FUENTE: Personal
149
FUENTE: Personal
FUENTE: Personal
150
motores
FUENTE: Personal
FUENTE: Personal
151
constantes seleccionadas.
motores
corriente.
FUENTE: Personal
FUENTE: Personal
156
FUENTE: Personal
FUENTE: Personal
FUENTE: Personal
157
mencionada.
CONCLUSIONES Y
RECOMENDACIONES
160
Conclusiones
en el pas.
de programacin.
RECOMENDACIONES
SCADA.
ANEXOS
ANEXO A
Procedimiento para carga de programa de usuario a
travs de bootloader
dsPIC30F4011.
Deteccin del dsPIC y del firmware del bootloader
proceso.
entrenamiento.
Configuraciones para nuevo proyecto en mikroBasic
1/ K 3
Area =
(
I
)
[
= mils 2 ]
K1 * T
K2
donde:
Ancho =
Area
=
[
mils 2] = [ mils ]
L *1,378 [onz pie 2 ]
1
0 = 2 fi =
Li Ci
Usando la anterior ecuacin obtenemos el valor de inductancia
1 1
Li = = = 0.1879 uH
Ci (2 f i ) 110pF* (2 * 35 MHz)
2 2
Li 0 . 1879 uH
Z = = = 41 . 34 ohms
Ci 110 pF
Programa principal
Inicio
F
Cnt = 0
kp almacena valor * del F
teclado matricial
V
V
Sw_Stop = 1
Presentar Izquierda en LCD
Sw_Izquierda = 1 C
Sw_Derecha = 0
kp almacena valor # F
del teclado matricial
Sw_Izquierda = 0
Sw_Derecha = 1
Sw_Stop = 0
Sw_Derecha = 1 and F
Sw_Stop = 0
Giro Derecha
Sw_Izquierda = 1 and
Sw_Stop = 0
Giro Izquierda
1
Subrutinas
E.5 Manejo de motor de servomotor
Programa principal
Subrutinas
Retornar
Retornar
ANEXO F
Fotografas de las tarjetas de entrenamiento
Equipo de entrenamiento
basado en el procesador
dsPIC30F4011
MANUAL DE USUARIO V1.0
FACULTAD DE INGENIERIA EN
ELECRICIDAD Y COMPUTACIN
Esta tarjeta est pensada para ser usada como un sistema para el
control de dispositivos. Incluye un conector DB9 hembra, y otro
conector del tipo espadin. Ambos para la comunicacin tipo serial a
travs de RS-232. Los pines no utilizados del dsPIC (I/O digitales,
entradas analgicas y buses de comunicacin) son accesibles por
medio de borneras para expansin hardware y la conexin de otros
tipos de sensores.
4.1.- Microcontrolador.
Para encender cada led se debe poner un nivel alto (1), en los pines
antes mencionados.
4.6.- Micro-interruptores.
Los microinterruptores estn conectados a los pines RB2, EB3, RB4, y RB5.
4.7.- Micro-pulsadores.
La bobina del rle se activa cada vez que llegue a travs de RB2 la
seal de 1 lgico, ocasionando que el transistor asociado trabaje en
modo de saturacin. Una vez activada la bobina se produce el cambio
de estado del los contactos del rel.
Para disponer de las seales del bus SPI (SS, SDI, SDO, SCK), deben
configurarse como se indica a continuacin:
Para disponer de las seales del bus I2C (SDA, SCL), deben
configurarse como se indica a continuacin:
SDA, se accede directamente al pin RF2 sin ningn puente de
habilitacin.
SDO, se accede directamente al pin RF3 sin ningn puente de
habilitacin.
Las seales RE2, RE3, RE4, RE5, manejan a los optoacopladores los
cuales a su vez controlan la parte de fuerza formada por cuatro
transistores mosfet de canal N (IRF530) conectados en una
configuracin en puente H.
Configurar los puentes que habilitan las seales RB3, RB4, y RB5.
Cada puente debe ubicarse en las etiquetas ENCD, quedando
disponibles las seales INDEX, QEA, y QEB respectivamente.
http://www.ingenia-cat.com/
http://www.cib.espol.edu.ec
http://www.automatas.org/hardware/teoria_pid.htm
http://www.ipc.org/ContentPage.aspx?pageid=4.6
10. Hoja del fabricante para las especificaciones de los integrados
http://www.datasheetcatalog.com
http://www.microchip.com
http://isa.uniovi.es/~fernando/Programa_II_EUITI.htm
http://www.ni.com
http://www.mikroe.com
http://perso.wanadoo.es/chyryes/circuitos/pid.htm
http://www.electroavil-es.com/
http://www.uhu.es/manuel_sanchez/tutoriales/protel99/protel99.html
http://digital.ni.com/worldwide/
http://www.monografias.com/trabajos35/dibujo-electronico/dibujo-
electronico.shtml