heat control  r71
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
comm.h File Reference
#include "types.h"
Include dependency graph for comm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DATABIT   (PINB & _BV(PCINT8))
 
#define NUM_DB   8
 
#define USI_CNTRNG   16
 
#define SEQ_BUF_SIZE   9
 
#define SEQ_STA   0x02
 
#define SEQ_END   0x03
 
#define TEMP_CH1_VAL_H_ID   1
 
#define TEMP_CH1_VAL_L_ID   2
 
#define TEMP_CH2_VAL_H_ID   3
 
#define TEMP_CH2_VAL_L_ID   4
 
#define SUP_VOLT_VAL_H_ID   5
 
#define SUP_VOLT_VAL_L_ID   6
 
#define CRC_OVER_ALL   7
 
#define MAX_ABS_INNER_TEMP   32500
 
#define MIN_ABS_INNER_TEMP   11900
 
#define MAX_ABS_OUTER_TEMP   32500
 
#define MIN_ABS_OUTER_TEMP   (INVALID_VAL_U16 - ((UINT)-15000))
 
#define MAX_DEL_INNER_TEMP   400
 
#define MAX_DEL_OUTER_TEMP   500
 

Functions

void CommInit (void)
 init as defined in "doc4300.pdf": figure 12. Initialization of the Receive Driver More...
 
void EnablePcint8 (void)
 enable pin change interrupt PCINT8 More...
 
void DisablePcint8 (void)
 disable pin change interrupt PCINT8 More...
 
void DisableUsi (void)
 disable USI module, there's no specific flag to do so -> disabling what can be done More...
 
void EnableUsi (void)
 enable USI module for proper comm More...
 
UCHAR GetSenderValues (UINT *innerTemp, UINT *outerTemp)
 establish decimal temperature values form raw stream in sequence More...
 
UCHAR PlausibilityCheck (UINT innerTemp, UINT outerTemp)
 check plausibility of recently received temperatures against specific limits More...
 
UCHAR CalcCrc (void)
 

Macro Definition Documentation

#define CRC_OVER_ALL   7

checksum over both temperatures and supply voltage positioning

Definition at line 64 of file comm.h.

Referenced by CalcCrc().

#define DATABIT   (PINB & _BV(PCINT8))

receiver pin from which to get the data bytes coming in

Definition at line 16 of file comm.h.

Referenced by ISR().

#define MAX_ABS_INNER_TEMP   32500

maximum allowed absolute inner temperature

Definition at line 70 of file comm.h.

#define MAX_ABS_OUTER_TEMP   32500

maximum allowed absolute outer temperature

Definition at line 78 of file comm.h.

#define MAX_DEL_INNER_TEMP   400

maximum allowed inner delta temperature between two measurements

Definition at line 86 of file comm.h.

Referenced by PlausibilityCheck().

#define MAX_DEL_OUTER_TEMP   500

minimum allowed outer delta temperature between two measurements

Definition at line 90 of file comm.h.

Referenced by DoControl(), and PlausibilityCheck().

#define MIN_ABS_INNER_TEMP   11900

minimum allowed absolute inner temperature

Definition at line 74 of file comm.h.

Referenced by PlausibilityCheck().

#define MIN_ABS_OUTER_TEMP   (INVALID_VAL_U16 - ((UINT)-15000))

minimum allowed absolute outer temperature

Definition at line 82 of file comm.h.

Referenced by PlausibilityCheck().

#define NUM_DB   8

number of data bits in serial frame (asynchronous parameter)

Definition at line 20 of file comm.h.

Referenced by EnableUsi().

#define SEQ_BUF_SIZE   9

size of sequence, the composition of multiple serial frames

Definition at line 28 of file comm.h.

Referenced by ISR().

#define SEQ_END   0x03

end of sequence identifier

Definition at line 36 of file comm.h.

Referenced by ISR().

#define SEQ_STA   0x02

start of sequence identifier

Definition at line 32 of file comm.h.

Referenced by ISR().

#define SUP_VOLT_VAL_H_ID   5

supply voltage high byte positioning ch2

Definition at line 56 of file comm.h.

Referenced by CalcCrc().

#define SUP_VOLT_VAL_L_ID   6

supply voltage low byte positioning ch2

Definition at line 60 of file comm.h.

Referenced by CalcCrc().

#define TEMP_CH1_VAL_H_ID   1

temperature high byte positioning ch1

Definition at line 40 of file comm.h.

Referenced by CalcCrc(), and GetSenderValues().

#define TEMP_CH1_VAL_L_ID   2

temperature low byte positioning ch1

Definition at line 44 of file comm.h.

Referenced by CalcCrc(), and GetSenderValues().

#define TEMP_CH2_VAL_H_ID   3

temperature high byte positioning ch2

Definition at line 48 of file comm.h.

Referenced by CalcCrc(), and GetSenderValues().

#define TEMP_CH2_VAL_L_ID   4

temperature low byte positioning ch2

Definition at line 52 of file comm.h.

Referenced by CalcCrc(), and GetSenderValues().

#define USI_CNTRNG   16

usi counter range

Definition at line 24 of file comm.h.

Referenced by EnableUsi().

Function Documentation

UCHAR CalcCrc ( void  )

Definition at line 180 of file comm.c.

References CRC_OVER_ALL, g_seq, SUP_VOLT_VAL_H_ID, SUP_VOLT_VAL_L_ID, TEMP_CH1_VAL_H_ID, TEMP_CH1_VAL_L_ID, TEMP_CH2_VAL_H_ID, TEMP_CH2_VAL_L_ID, and UCHAR.

Referenced by GetSenderValues().

Here is the caller graph for this function:

void CommInit ( void  )

init as defined in "doc4300.pdf": figure 12. Initialization of the Receive Driver

Definition at line 27 of file comm.c.

References DisableUsi(), and EnablePcint8().

Referenced by Init().

Here is the call graph for this function:

Here is the caller graph for this function:

void DisablePcint8 ( void  )

disable pin change interrupt PCINT8

Definition at line 69 of file comm.c.

Referenced by ISR().

Here is the caller graph for this function:

void DisableUsi ( void  )

disable USI module, there's no specific flag to do so -> disabling what can be done

Definition at line 76 of file comm.c.

Referenced by CommInit(), and ISR().

Here is the caller graph for this function:

void EnablePcint8 ( void  )

enable pin change interrupt PCINT8

Definition at line 60 of file comm.c.

Referenced by CommInit(), and ISR().

Here is the caller graph for this function:

void EnableUsi ( void  )

enable USI module for proper comm

Definition at line 84 of file comm.c.

References NUM_DB, T0_INC20, TCN_T0, and USI_CNTRNG.

Referenced by ISR().

Here is the caller graph for this function:

UCHAR GetSenderValues ( UINT innerTemp,
UINT outerTemp 
)

establish decimal temperature values form raw stream in sequence

Parameters
innerTempbuffer to inner temperature
outerTempbuffer to outer temperature
Returns
TRUE if both temperatures were valid, FALSE otherwise

Definition at line 133 of file comm.c.

References CalcCrc(), FALSE, g_seq, g_seqReady, INVALID_VAL_U16, TEMP_CH1_VAL_H_ID, TEMP_CH1_VAL_L_ID, TEMP_CH2_VAL_H_ID, TEMP_CH2_VAL_L_ID, TRUE, and UCHAR.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

UCHAR PlausibilityCheck ( UINT  innerTemp,
UINT  outerTemp 
)

check plausibility of recently received temperatures against specific limits

Parameters
innerTempinner temperature
outerTempouter temperature
Returns
TRUE if both are plausible, FALSE otherwise

Definition at line 162 of file comm.c.

References FALSE, INVALID_VAL_U16, MAX_DEL_INNER_TEMP, MAX_DEL_OUTER_TEMP, MIN_ABS_INNER_TEMP, MIN_ABS_OUTER_TEMP, TRUE, UCHAR, and UINT.