-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcitanie_ROM.c
115 lines (99 loc) · 2.02 KB
/
citanie_ROM.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<<<<<<< HEAD
void read_rom()
{
volatile unsigned char info[8];
int i;
int j;
disableInterrupts();
therm_reset();
therm_write_byte(THERM_CMD_READROM);
for(i=0;i<8;i++)
{
info[i]=therm_read_byte();
}
enableInterrupts();
//i=0;
LCD_CLEAR_DISPLAY();
for(j=0;j<8;j++)
{
for(i=0;i<8;i++)
{
if((info[j])& 1<<(7-i))
LCD_printchar('1');
else
LCD_printchar('0');
}
Delay_ms(3000);
LCD_CLEAR_DISPLAY();
//i=0;
}
}
//---------------------
unsigned temp;
char sernum;
int i;
int colona;
char *sernum_hex[8];
/ Format and display result on Lcd
Display_Temperature(temp);
Ow_Reset(&PORTE, 2); // Onewire reset signal
Ow_Write(&PORTE, 2, 0x33); // Read ROM
Delay_us(120);
colona = 17;
for(i = 0; i <= 7; i++)
{
colona = colona - 2;
sernum = Ow_Read(&PORTE, 2);
bytetohex(sernum, sernum_hex);
Lcd_Out(1, colona, sernum_hex);
}
=======
void read_rom()
{
volatile unsigned char info[8];
int i;
int j;
disableInterrupts();
therm_reset();
therm_write_byte(THERM_CMD_READROM);
for(i=0;i<8;i++)
{
info[i]=therm_read_byte();
}
enableInterrupts();
//i=0;
LCD_CLEAR_DISPLAY();
for(j=0;j<8;j++)
{
for(i=0;i<8;i++)
{
if((info[j])& 1<<(7-i))
LCD_printchar('1');
else
LCD_printchar('0');
}
Delay_ms(3000);
LCD_CLEAR_DISPLAY();
//i=0;
}
}
//---------------------
unsigned temp;
char sernum;
int i;
int colona;
char *sernum_hex[8];
/ Format and display result on Lcd
Display_Temperature(temp);
Ow_Reset(&PORTE, 2); // Onewire reset signal
Ow_Write(&PORTE, 2, 0x33); // Read ROM
Delay_us(120);
colona = 17;
for(i = 0; i <= 7; i++)
{
colona = colona - 2;
sernum = Ow_Read(&PORTE, 2);
bytetohex(sernum, sernum_hex);
Lcd_Out(1, colona, sernum_hex);
}
>>>>>>> origin/master