tsic.h


1
/*
2
  Library for TSIC digital Temperature Sensor Type 206/306 and may more.
3
  using ZACwire™ Communication Protocol for the TSic™
4
  Manufatorer:    IST AG, Hygrosens, ZMD
5
  Original Code:  http://www.mikrocontroller.net/topic/82087
6
  rewritten by:    Rolf W.
7
  Date:        2010.03.06
8
  Temperature-sensor uses 2 Pins, one for VCC and the second for Signal (= ZACwire Protocol).
9
  With call of the Function ".....getTSicTemp();" the Senor will get power measure and will be turned OFF.
10
  In that case it uses only energy while measuring. There is another method with Interrupts, measuring
11
  at an constant rate, which is not implemented jet.
12
*/
13
#ifndef tsic_H
14
#define tsic_H
15
#include <inttypes.h>
16
#include "Main.h"
17
18
/******************************************************************************/
19
// TSIC Signal-Pin
20
#define TSIC_PORT             PORTA  // Port to use
21
#define TSIC_PIN              PINA
22
#define TSIC_PORT_DDR         DDRA
23
#define TSIC_SIGNAL_PIN       (1<<PIN1)
24
25
// TSIC VCC
26
#define TSIC_PORT_Power       PORTE
27
#define TSIC_PORT_DDR_Power   DDRE
28
#define TSCI_POWER_PIN        (1<<PIN6)
29
/******************************************************************************/
30
31
#define TSIC_ON()             TSIC_PORT_Power |=  TSCI_POWER_PIN    // Power up the TSIC-Sensor
32
#define TSIC_OFF()            TSIC_PORT_Power &= ~TSCI_POWER_PIN    // Power down the TSIC-Sensor
33
#define TSIC_SIGNAL_HIGH         TSIC_PIN & TSIC_SIGNAL_PIN        // High Signal of the TSIC-Sensor
34
#define TSIC_SIGNAL_LOW       !( TSIC_PIN & TSIC_SIGNAL_PIN)      //  Low Signal of the TSIC-Sensor
35
36
void TSIC_INIT(void);
37
uint8_t getTSicTemp (uint16_t *temp_value16);
38
39
#endif