-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGSR_prog.c
71 lines (57 loc) · 2.57 KB
/
GSR_prog.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/****************************************************/
/* */
/* Author : Hassan Askar */
/* Date : 08/04/2019 */
/* Version : 1.0 V */
/* Description : GSR_Program */
/* */
/****************************************************/
/****************************************************************/
/*********************** STD LIB DIRECTIVES *********************/
/****************************************************************/
#include "STD_Types.h"
#include "Bit_Math.h"
#include "LBTY_int.h"
/****************************************************************/
/*********************** Component DIRECTIVES *******************/
/****************************************************************/
#include "ADC_int.h"
#include "GSR_config.h"
#include "GSR_init.h"
#include "GSR_private.h"
/****************************************************************/
/*********************** Function Implementation ***************/
/****************************************************************/
/****************************************************************/
/* Description : This function used to initialize GSR */
/* Inputs : void */
/* return : void */
/****************************************************************/
void GSR_voidInit(void)
{
ADC_voidInit(GSR_CHANNEL_NUMBER);
ADC_voidEnable();
}
/****************************************************************/
/* Description : This function used to calc GSR & */
/* transmit the result */
/* Inputs : void */
/* Return : vois */
/****************************************************************/
/* Pre_condition : this function must be used after GSR */
/* initialized */
/****************************************************************/
void GSR_voidCalcAndTransmit(void)
{
u8 *s ;
u16 i=0,Human_Resistance;
i=ADC_u16ReadADC();
i-=30;
Human_Resistance = (((2*i)+1024)*10)/(512-i);
USART_TransmitString(itoa(Human_Resistance,s,10));
USART_TransmitString(" Kohm\n");
delnms(50);
}
/***********************************************************************************************/
/************************************* END OF PROGRAM ******************************************/
/***********************************************************************************************/