0% found this document useful (0 votes)
23 views5 pages

Masaje Mariana

This document describes a massage program written for a PIC microcontroller. It allows selecting between a vibrator or heat function and adjusting the frequency and time. The program initializes ports and variables, displays an initial message, and enters a loop to check for button presses to select or adjust settings before activating the vibrator and heat for the set time.

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)
23 views5 pages

Masaje Mariana

This document describes a massage program written for a PIC microcontroller. It allows selecting between a vibrator or heat function and adjusting the frequency and time. The program initializes ports and variables, displays an initial message, and enters a loop to check for button presses to select or adjust settings before activating the vibrator and heat for the set time.

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/ 5

'_________________________'

'* Nombre : Masaje *'


'* Autor : Mariana Reyes*'
'* Fecha : 22/06/2015 *'
'_________________________'

Device = 16F877A 'Pic Utilizado


XTAL = 20 'Cristal utilizado 12 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

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

TV = 0 'Iniciando Variable Tiempo Vibrador


en 0
FF = 1 '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 = 21 Then
FF = 0
EndIf
FF = FF + 1
EndIf
EndIf
If V3 = 1 Then
DelayMS 120
If V3 = 1 Then
If FF = 0 Or FF = 1 Then
FF = 21
EndIf
FF = FF - 1
EndIf
EndIf
Print At 1,1, " FRECUENCIA "
Print At 2,6, Dec FF, " KHz "
Wend
Print At 1,1, " SELECCIONAR "
Print At 2,1, " TIEMPO "
DelayMS 1000
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 = 60 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 = 65
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
PORTC.2 = 0
FF = 0
TV = 0
GoTo INICIO
Wend

VIB:
VAR1 = 0
VAR2 = 1
VAR3 = 0
For X = 0 To TV*60
VAR1 = 100*VAR2 + 20*VAR3
If X < VAR1 Then
HPWM PORTC.1, 127, FF*1000
If LC = 1 Then
PORTC.0 = 1
Else
PORTC.0 = 0
EndIf
EndIf
If X > VAR1 Then
HPWM PORTC.1, 127, FF*1000
PORTC.0 = 0
EndIf
If X = 120*VAR2 Then
VAR2 = VAR2 + 1
VAR3 = VAR3 + 1
EndIf
X1 = X1 + 1
If X1 <= 16 Then
Print At 2,X1, 255
Else
X1 = 0
Print At 2,1," "
EndIf
Print At 1,1, "RESTAN: ", Dec TV*60 - X, " MIN "
DelayMS 1000
Next X
HPWM PORTC.1, 0, 0
PORTC.0 = 0
Return

End

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
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
1 24
5V MCLR/Vpp/THV RC5/SDO 25V
25
RC6/TX/CK
26
RC7/RX/DT

25V
19
RD0/PSP0 V1
20
RD1/PSP1 V2 P1 A
21
RD2/PSP2 V3
22
RD3/PSP3 C1 P2 B
27
RD4/PSP4
28
RD5/PSP5 C M1
29
RD6/PSP6 LV
RD7/PSP7
30
LC D 25V
D6
LED-RED
PIC16F877A

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

M3
RC1
D3
25V LED-RED

RC RL1
12V
RC1

25V

GND M4

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