Fecha de publicación: Feb 23, 2016 1:57:37 AM
Este es un diseño personal de una bobinadora programable, que genera tonos audibles a modo de avisos y posee tambien control de velocidad; No esta incluido la etapa de sensado (ver donde esta el pulsador NA que dice "PULSO GIRO") y los semiconductores para el control del motor, deben de ser seleccionados segun carga. Adjunto diagrama de simulación (Isis Proteus) y HEX del microcontrolador.
Veamos algunas lineas de nuestro proyecto...Arranquemos con el control de velocidad del motor y la forma en que cuento los pulsos y decremento una unidad...
INTCON=%10100001
TMR0=0
T2CON = %00000110
PR2=124
DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2
CMCON=7
TRISA=255
TRISB=%11111111
TRISC=%11111000
TRISD=%00000000
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 20
...
...
LCDOut $FE, 64, REP $0\8
LCDOut $0, REP $10\6,$0
LCDOut $0, REP $14\6,$0
LCDOut $0, REP $15\6,$0
...
...
arranque:
ADCIN 0,ADC1
MEDIDA = ADC1
MEDIDA = (MEDIDA */ 250) >> 2
barval = (MEDIDA / 9) + 1
GoSub BARRA
LCDOut $FE,$80,"MOTOR=",REP $3\fullbars, partbar, REP " "\pad
LCDOut $FE,$C0,"Espiras=",dec4 auxw
high relay
gosub PWM_ON
If sensor=0 Then
dig_vuelta=dig_vuelta-1
auxw = auxw - 1
endif
if auxw =20 then
SOUND SONIDO,[127,2]
endif
if auxw =15 then
SOUND SONIDO,[127,2]
endif
if auxw =10 then
SOUND SONIDO,[127,2]
endif
if auxw =5 then
SOUND SONIDO,[127,2]
endif
If auxw =0 Then GoTo FIN
pause 150
goto arranque
PWM_ON:
DUTY=ADC1/4
HPWM 1,DUTY,600
;CCP1CON.2=1
;CCP1CON.3=1
RETURN
PWM_OFF:
HPWM 1,0,0
;CCP1CON.2=0
;CCP1CON.3=0
RETURN