Prac 2

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Device = 16F877a

All_Digital = true
Xtal = 20
Declare Keypad_Port PORTB
PortB_Pullups = true
Declare LCD_RSPin PORTD.0
Declare LCD_ENPin PORTD.1
Declare LCD_DTPin PORTD.4
Declare LCD_Interface 4
PORTD.1 = 1
dim w as byte
dim x as byte
dim v[5] as word
dim z as byte
dim i as byte
dim t as byte
i=0
low porte.0
inicio:
cls
print at 1,5,"Ingrese"
print at 2,1,"Pulsos=",$2A," W=",$2A,$2A,$2A,"ms"
delayms 300
GOSUB TECLADO
v[0]=w
print at 2,8,dec w
delayms 200
for i=0 to 2
gosub teclado
v[I+1]=w
print at 2,i+12,dec w
delayms 200
next
v[4]=v[1]*100+v[2]*10+v[3]
DELAYMS 500
PRINT $fe,64,$00,$00,$0e,$0a,$0a,$0a,$0a,$1b
cls
t=v[0]-1
v[4]=v[4]*500
for I=0 TO t
gosub generar
delayms 200
pulsout porte.0,v[4],low
delayms 100
next i
cls
print at 1,3, "Finalizado"
delayms 4000
GOTO inicio
generar:
if i=0 then
print at 1,1,"Generando",$00
endif
if i=1 then
print at 1,1,"Generando"," ",$00
endif
if i=2 then
print at 1,1,"Generando"," ",$00
endif
return
teclado:
w=21
while w=21

x=inkey
w=lookupl x,[7,8,9,"a",4,5,6,"b",1,2,3,"c","*",0,"#","d"]

delayms 300
wend
return

You might also like