Control de temperatura con un avr dragon

Solo disponible en BuenasTareas
  • Páginas : 3 (502 palabras )
  • Descarga(s) : 0
  • Publicado : 8 de marzo de 2011
Leer documento completo
Vista previa del texto
#include <mega168.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <delay.h>

// 1 Wire Bus functions
#asm
.equ __w1_port=0x08 ;PORTC.equ __w1_bit=1
#endasm
#include <1wire.h>

// DS1820 Temperature Sensor functions
#include <ds1820.h>
#include <ds18b20.h>

// Alphanumeric LCD Module functions
#asm.equ __lcd_port=0x05 ;PORTB
#endasm
#include <lcd.h>

// Declare your global variables here

void main(void)
{
// Declare your local variables here
float temp;
char cad[16];
//Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_ p. 17
#pragma optsize+
#endif

// Input/Output Portsinitialization
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;DDRB=0x00;

// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;// Port D initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTD=0x00;DDRD=0xFF;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0A output: Disconnected
// OC0B output: DisconnectedTCCR0A=0x00;
TCCR0B=0x00;
TCNT0=0x00;
OCR0A=0x00; p. 18
OCR0B=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normaltop=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A...
tracking img