0% found this document useful (0 votes)
15 views6 pages

MASAJE

The document describes a massage program written for a PIC microcontroller. It defines I/O pins for an LCD display, vibration motors, heat element, and analog temperature sensor. The program allows selecting vibration or heat and setting the frequency, time, and reads the temperature during operation.

Uploaded by

JesusRivero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

MASAJE

The document describes a massage program written for a PIC microcontroller. It defines I/O pins for an LCD display, vibration motors, heat element, and analog temperature sensor. The program allows selecting vibration or heat and setting the frequency, time, and reads the temperature during operation.

Uploaded by

JesusRivero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

'_________________________'

'* Nombre : Masaje *'


'* Autor : Mariana Reyes*'
'* Fecha : 31/07/2015 *'
'_________________________'

Device = 16F877A 'Pic Utilizado


XTAL = 8 'Cristal utilizado 4 Mhz

Declare LCD_TYPE 0
Declare LCD_INTERFACE 4
Declare LCD_DTPIN PORTB.4 'Pin de datos (D4-D7) Conectados (RB4-RB7)
Declare LCD_RSPIN PORTB.2 'Pin RS conectado a RB2
Declare LCD_ENPIN PORTB.3 'Pin E Conectado a RB3
LCD_LINES 2 'Cantidad de Lineas que Tiene el LCD
ALL_DIGITAL 1 'Seleccion del Tipo Digital

Declare CCP2_PIN PORTC.1


Declare CCP1_PIN PORTC.2

Declare ADIN_RES = 10 ; 10 bits de resolución


Declare ADIN_TAD = FRC ; Seleccionar RC OSC
Declare ADIN_STIME = 25 ; 50uS para tiempo de muestreo

ADCON1 = %10000000
TRISA = %11111111
TRISD = %00001111
PORTD = %00000000

TRISC = %00000000
PORTC = %00000000

Symbol V1 = PORTD.0 'asignando nombres a los puertos V1 Seleccionar


Vibrador
Symbol V2 = PORTD.1 'asignando nombres a los puertos V2 Subir
Symbol V3 = PORTD.2 'asignando nombres a los puertos V3 Bajar
Symbol C1 = PORTD.3 'asignando nombres a los puertos C1 Seleccionar
Calor
Symbol C2 = PORTD.4 'asignando nombres a los puertos C2 Subir
Symbol C3 = PORTD.5 'asignando nombres a los puertos C3 Bajar
Symbol LV = PORTD.6
Symbol LC = PORTD.7

Dim QQ As Byte 'Variables de los Ciclos While


Dim FF As DWord 'Variables de Frecuencia
Dim TV As Byte 'Variables de tiempo
Dim I As Byte
Dim X As Word 'Variable de los Ciclos For
Dim VAR1 As Word
Dim VAR2 As Word
Dim VAR3 As Word
Dim X1 As Word

Dim ADC_Value As Word ; Variable que contendrá el valor leído por el ADC
Dim Temper As Word ; Variable que contendrá el resultado de la temperatura

TV = 5 'Iniciando Variable Tiempo Vibrador en 0


FF = 0 'Iniciando Variable Frecuencia de trabajo en 0
QQ = 0
X1 = 0
INICIO:

Print At 1,1, " M A S A J E "


Print At 2,1, " L U M B A R "
DelayMS 1000

While QQ = 0
If V1 = 1 Then
DelayMS 120
If V1 = 1 And LV = 0 Then
LV = 1
Print At 1,1, "V I B R A D O R "
Print At 2,1, " ENCENDIDO "
DelayMS 1000
EndIf
If V1 = 1 And LV = 1 Then
LV = 0
Print At 1,1, "V I B R A D O R "
Print At 2,1, " APAGADO "
DelayMS 1000
EndIf
EndIf
If C1 = 1 Then
DelayMS 120
If C1 = 1 And LC = 0 Then
LC = 1
Print At 1,1, " C A L O R "
Print At 2,1, " ENCENDIDO "
DelayMS 1000
EndIf
If C1 = 1 And LC = 1 Then
LC = 0
Print At 1,1, " C A L O R "
Print At 2,1, " APAGADO "
DelayMS 1000
EndIf
EndIf
If V2 = 1 Or V3 = 1 Then
DelayMS 120
If V2 = 1 Or V3 = 1 Then
QQ = 1
Cls
EndIf
EndIf
Wend

If LV = 1 And LC = 1 Then
QQ = 3
EndIf
If LV = 1 And LC = 0 Then
QQ = 3
EndIf
If LC = 0 And LC = 1 Then
QQ = 4
EndIf
If LV = 0 And LC = 0 Then
Print At 1,1, " NO SELECCIONO "
Print At 2,1, " NINGUNA ACCION "
DelayMS 2000
QQ = 0
GoTo INICIO
EndIf

'----------------------------------------
Print At 1,1, " SELECCIONAR LA "
Print At 2,1, " FRECUENCIA "
DelayMS 1000
Cls
'SELECCION DE LA FRECUENCIA DE TRABAJO DE LOS VIBRADORES
While QQ = 3
If V1 = 1 Then
DelayMS 120
If V1 = 1 Then
QQ = 4
EndIf
EndIf
If V2 = 1 Then
DelayMS 120
If V2 = 1 Then
If FF = 2000 Then
FF = 0
EndIf
FF = FF + 10
EndIf
EndIf
If V3 = 1 Then
DelayMS 120
If V3 = 1 Then
If FF = 0 Or FF = 10 Then
FF = 2000
EndIf
FF = FF - 10
EndIf
EndIf
Print At 1,1, " FRECUENCIA "
Print At 2,6, Dec FF, " Hz "

Wend
Print At 1,1, " SELECCIONAR "
Print At 2,1, " TIEMPO "
DelayMS 500
Cls
'SELECCION DEL TIEMPO DE TRABAJO DE LOS VIBRADORES
While QQ = 4
If V1 = 1 Then
DelayMS 120
If V1 = 1 Then
QQ = 5
EndIf
EndIf
If V2 = 1 Then
DelayMS 120
If V2 = 1 Then
If TV = 120 Then
TV = 0
EndIf
TV = TV + 5
EndIf
EndIf
If V3 = 1 Then
DelayMS 120
If V3 = 1 Then
If TV = 0 Or TV = 5 Then
TV = 125
EndIf
TV = TV - 5

EndIf
EndIf
Print At 1,1, " TIEMPO "
Print At 2,6, Dec TV, " MIN "
Wend

Cls
Print At 1,1, "I N I CIA N D O "
For I = 1 To 16
DelayMS 250
Print At 2,I,255
Next
Cls

While QQ = 5
Call VIB
Print At 1,1, " F I N D E L "
Print At 2,1, " M A S A J E "
QQ = 0
LV = 0
LC = 0
FF = 1
TV = 5
X1 = 0
PORTC.2 = 0
GoTo INICIO
Wend

VIB:
VAR1 = 0
VAR2 = 1
VAR3 = 0
For X = 0 To TV*60
HPWM PORTC.1, 127, FF*10
Call TEMP
If Temper < 35 Then
PORTC.0 = 1
EndIf
If Temper > 45 Then
PORTC.0 = 0
EndIf
Print At 1,1, "RESTAN: ", Dec TV*60 - X, " SEG "
Print At 2,1, "TEMP : ", Dec Temper, "GRADOS "
DelayMS 1000
Next X
HPWM PORTC.1, 0, 0

Return

TEMP:
ADC_Value = ADIn 0
Temper = ADC_Value * 500/1023
Return

End
CIRCUITO

LC
LV
GND

GND
25V

LCD1
5V 25V D1 D2
R7 R8
GND
330 330
LED-RED
LED-RED

C1
V1

5V
SUBIR
U1

VDD
VSS

VEE
VIB CAL

RW
RS

D0
D1
D2
D3
D4
D5
D6
D7
E
13 33 R1 R4
OSC1/CLKIN RB0/INT 10k 10k
14 34
OSC2/CLKOUT RB1

1
2
3

4
5
6

7
8
9
10
11
12
13
14
35

V2

V3
RB2 RS
2 36
TEM RA0/AN0 RB3/PGM RE
3 37
RA1/AN1 RB4 D4
4 38 R2 R3
RA2/AN2/VREF-/CVREF RB5 D5 10k 10k
5 39

RS

RE
GND

GND

GND

GND

D4
D5
D6
D7
5V
RA3/AN3/VREF+ RB6/PGC D6
6 40
RA4/T0CKI/C1OUT RB7/PGD D7
7
RA5/AN4/SS/C2OUT
15
SUBIR BAJAR
RC0/T1OSO/T1CKI P1
8 16
RE0/AN5/RD RC1/T1OSI/CCP2 P2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA P1 A
1 24
5V MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK P2 B
26
RC7/RX/DT
C

25V
19
RD0/PSP0 V1
20
RD1/PSP1 V2 D
21
RD2/PSP2 V3
22
RD3/PSP3 C1
27
RD4/PSP4
28
RD5/PSP5
29

5V
RD6/PSP6 LV
RD7/PSP7
30
LC 25V 25V
D6
LED-RED
PIC16F877A

U2 1 U3
10
COM 25V
P2
1
1B 1C
18
M1
D5
2 17 LED-RED
P2 2B 2C M2 46.0
3 16
P1 3B 3C RC M1 M1
4 15
4B 4C
5 14 2
5B 5C VOUT TEM
6 13
6B 6C 25V 25V
7 12
7B 7C
8
8B 8C
11 D4
3 LM35 LED-RED
ULN2803

D3
GND

RC1 M2 M2
LED-RED

RC RL1
12V

RC1
25V

GND

MATERIALES

 PANTALLA LCD
 PIC 16F877A
 BOTONES
 FUENTE DE 5V Y 10V
 MOTORES
 LEDS
 LM35
 RESISTENCIAS 10K
 RELE 5V
 FAJA
 RESISTENCIA TERMICA

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy