Introduccion sensor de temperatura con control maximo minimo
Enviado por narbeth • 10 de Diciembre de 2015 • Tutorial • 569 Palabras (3 Páginas) • 217 Visitas
Introducción sensor de temperatura con control máximo mínimo
TRISA = %11111111
PORTA = %00000000
TRISB = 0x00
PORTB = 0x00
TRISC = %00001001
PORTC = 0x00
TRISD = 0x00
PORTD = 0x00
Define LCD_BITS = 8 'comentar
Define LCD_DREG = PORTB 'comentar
Define LCD_DBIT = 0 'comentar
Define LCD_RSREG = PORTD 'comentar
Define LCD_RSBIT = 7 'comentar
Define LCD_EREG = PORTD 'comentar
Define LCD_EBIT = 6 'comentar
Define LCD_RWREG = PORTD 'comentar
Define LCD_RWBIT = 5 'comentar
Lcdinit LcdCurBlink 'comentar
PWMon 1, 9
Dim sensor As Word
Dim min As Word
Dim max As Word
Dim maxs As Word
Dim mins As Word
Dim lo As Word
Dim celsius As Word
Dim fahrenheit As Word
Dim time As Word
Dim data As Byte
Dim duty As Byte
'Define word_decimal_places = 1
time = 1
main:
'Toggle RD1 'comentar
'Gosub pwm'comentar
'Goto main'comentar
'Gosub senddata'comentar
Adcin 0, sensor
Adcin 1, min
Adcin 2, max
maxs = max / 6
mins = min / 6
celsius = sensor / 6 '3.333 '*0.48875
fahrenheit = 2 * celsius + 32
'Gosub display 'comentar
If sensor > max Then 'Si el pulsador esta activado enciende el led
RC7 = 1
WaitMs 1
Gosub bajar
Else
RC7 = 0 'Si el pulsador no esta activado el led no enciende Low PORTB.4 'Tambien podemos ut
WaitMs 1
Endif
If sensor < min Then
RC7 = 1
WaitMs 1
Gosub subir
Else
RC7 = 0
WaitMs 1
Endif
'Gosub bt
Gosub displayc
Goto main
End
'display: 'comentar
'Lcdcmdout LcdClear 'comentar
'Lcdcmdout LcdLine1Home 'comentar
'Lcdout #celsius, "°C" 'comentar
'Lcdcmdout LcdLine2Home 'comentar
'Lcdout #fahrenheit, "°F" 'comentar
'WaitMs 1 'comentar
Return 'comentar
...