LAMPIRAN
66
Lampiran 1. Tabel jadwal penelitian Bulan Kegiatan
Agustus
September
1 2 3 4 1 2
3
Oktober 4
November
1 2 3 4 1 2 3 4 1
Desember 2
3
Januari 4
1
2
3
4
Tinjauan pustaka Pembuatan proposal Pembuatan alat Pengambil an data Pengolaha n data Pelaporan
67
Lampiran 2. Spesifikasi soil penetrometer SR-2
DIK-5502 Soil Penetrometer, SR-2 Type This penetrometer is used to predict the trafficability of agricultural machinery that travels on the ground, and the resistance of working machinery. By measuring a penetrating resistance a rectangular board sinkage, a shear resistance and a friction resistance, the sinkage and the traction fo traveling area and the resistance of working machinery can be calculated. Measuring range
211-2452kPaA 0 - 60cm
Spring
490N / 50mm
Cone
Top angle 30, sectional area 2cm2 & 6cm2
Spindle
0 - 60cm (graduated per 5cm)
Recording system Rectangular plate A Rectangular plate B
Pen recording on rotating drum 50 x 100 x 10mm 25 x 100 x 10mm
Shear ring
I.D.60 x O.D.100mm with projection
Friction ring
I.D.60 x O.D.100mm without projection
Torque wrench
3`23N/m
Outside dimensions
W250 x D110 x H1250mm
Total weight
Approx. 5 kg
68
Lampiran 3. Tabel spesifikasi mikrokontroler ATmega 8535
Spesifikasi ATmega 8535 - Dua 8-bit Timer/Counter, satu 16-bit Timer/Counter, dan Real Time Counter - 4 channel PWM - Two-wire Serial Interface - Programmable Serial USART (Universal Synchronous and Asynchronous serial Receiver and Transmitter) - Master/Slave SPI Serial Interface - Programmable Watchdog Timer - On-chip Analog Comparator - Internal Calibrated RC Oscillator - Mendukung varian AVR® 40 pin antara lain: AT90S8535, ATmega8535L, ATmega16(L), ATmega8515(L), AT90S8515, dan ATmega162(L) (Seri AVR® yang tidak memiliki ADC membutuhkan converter socket) - Memiliki fasilitas In-System Programming untuk IC yang mendukung, dilengkapi LED Programming Indicator - Memiliki hingga 35 pin jalur input/output - Lengkap dengan osilator 4 MHZ dan memiliki kemampuan komunikasi Serial UART RS-232 yang sudah disempurnakan - Lengkap dengan rangkaian reset, tombol manual reset, dan brownout detector - Menggunakan tegangan input 9 - 12 VDC dan memiliki tegangan output 5 VDC
69
Lampiran 4. Tabel Nilai gaya penyanggah dan indeks kerucut tanah
No
1 2 3 4 5 6 7
vulkanis,
Lembab, Iseki
1.300
Index kerucut kecil (Ci), kg/cm2, pada kedalaman 20 cm 14.83
vulkanis,
Lembab, Iseki
0.673
7.20
vulkanis,
Basah, Iseki
0.324
6.38
1.133
11.693
vulkanis,
Kering, Ford 4000 Lembab, catt D6 Lembab, Zetor 25 Lembab, Ford 4000
0.357 0.783
4.277 7.070
0.769
4.720
Jenis tanah
Regosol abu pundong Regosol abu kelasan Regosol abu kalasan Latosol, ungaran Alluvial, jatiroto Regosol abu pundong Latosol, ungaran.
Keterangan
Gaya penyanggaan (Bp)terhitung kg/cm2
70
Lampiran 5. Spesifikasi teknis DT-I/O Grafik LCD GM24644 Spesifikasi Teknis DT-I/O Graphic LCD GM24644 Dimensi: 15,1 cm (P) x 5,7 cm (L) x 3 cm (T) -Berbasis Data Image GM24644 Graphic LCD tanpa backlight (second/bekas) -240 x 64 pixel, 149 x 56 x 9,5 mm -2 Font Size Settings -Contrast Control -Slide Preview up to 4 frames - Monochrome BMP to ASM converter - Demo program - Sample pictures
71
Lampiran 6. Tabel spesifikasi material
72
Lampiran 7. Tabel perhitungan ketepatan dan ketelitian jarak pada penetrometer Beban G Cm
Tampilan di layar LCD
S1
S2
Ketepatan (S1/r) %
Ketelitian (S2/g) %
1
2
3
R
60
59.3
60
59.8
59.7
0.3
0
0.50
0.00
55
54.1
54.5
54.8
54.5
0.3
0.2
0.61
0.36
50
49.2
49.6
49.3
49.4
0.2
0.4
0.47
0.80
45
44.5
44.6
44.1
44.4
0.2
0.4
0.45
0.89
40
39.5
39.7
39.4
39.5
0.2
0.3
0.42
0.75
35
34.2
34.6
34.5
34.4
0.1
0.4
0.29
1.14
30
29.3
29.4
29.4
29.4
0.0
0.6
0.11
2.00
25
24.5
25
24.5
24.7
0.3
0
1.35
0.00
20
19.1
20
19.7
19.6
0.4
0
2.04
0.00
15
14.7
14.6
14.5
14.6
0.1
0.3
0.68
2.00
10
9.7
9.5
9.6
9.6
0.1
0.3
1.04
3.00
5
4.9
4.7
4.8
4.8
0.1
0.1
2.08
2.00
r = nilai rata-rata S1 =simpangan pengukuran terjauh dari nialai rata-rata S2 = simpangan pengukuran terjauh dari nilai asli
73
Lampiran 8. Tabel perhitungan ketepatan dan ketelitian gaya tekan penetrometer Beban g
Tampilan di layar LCD
kg
S1
S2
Ketepatan (S1/r) %
R
Ketelitian (S2/g) %
1
2
3
5
5
6
4
5
1
1
20.00
20.00
10
10
11
12
11
1
2
9.09
20.00
15
15
14
17
15.33
1.67
2
10.89
13.33
20
20
20
22
20.67
1.33
2
6.43
10.00
25
25
26
24
25
1
1
4.00
4.00
30
30
31
32
31
1
2
3.23
6.67
74
Lampiran 9. Tabel spesifikasi stainless steel Unit Satuan SI Satuan British Tensil strength ultimate 505 MPa 73200psi Tensile strength, yield 215 MPa 31200 psi Elongation at break 70 % Modulus of elasticity 193-200 GPa 28000-29000 ksi Shear Modulus 86 GPa 12500 ksi Sumber: http://asm.matweb.com/search/SpecificMaterial.asp?bassnum=MQ304A
75
Lampiran 10. Perhitungan penentuan diameter cincin tranduser
Diketahui:
=0.001
b = 15 mm
F = 100 kg x 9.8 m/s
t = 4m
9
E= 200x10 Pa Ditanya: Nilai r ? Jawabannya:
1.09
Fr Ebt2
980xr 200 x10^9 X 0.015x0.004^ 2 r 0.044m 4.4cm
0.001 1.09
Jadi jari-jari yang di gunakan adalah 4.4 cm
76
Lampiran 11. Perhitungan beban bending pada handle Diketahui:
=250x109 Pa F= 50 kgf L=70 cm
Ditanya: d ? Jawabannya:
Mc I M F .L c 0.25d I d3 d3 d
d4 64 FxLx0.5 x64 x 50 x9.8 x0.24 x0.5 x64 250 x10 6 x 24mm
Jadi diameter minimal bending adalah 24 mm Sedangkan perhitungan gaya maksimal yang dapat diterima oleh batang penetrometer
2
EI L2
P
2
E 1
4 L2
p 2
200x10 9 1
p p
R4
4
x0.006 4
0.7 2 4100N
77
Lampiran 12. Perhitungan diameter minimum untuk menahan beban 100 kg pada batang penetrometer
Diketahui: P= 100 kg x 9.8 m/s2= 980 E= 200x109 Pa L=70 cm Ditanya: nilai R ? Jawabannya:
2
P
2 EI E 0.25 R 4 L2 L2 pxL2 x 4 R4 E 980 x0.7 2 x 4 R4 3 x 200 x10 9 R 0.0041m 4.1mm
Jadi jari-jari minimum untuk dapat menahan beban 100 kg adalah 4.1 mm
78
Lampiran 13. Perhitungan panjang minimum terjadinya buckling
Diketahui : E = 200x109 Pa R = 6 mm =215x106 Pa Ditanya: L ? Jawabannya: 2
L
E 2
r
r
I A
r
1 x6 2
215x10 6 L2 L
1
R4 4 R2
1 R 2
3 3.14 2 x 200x10 9 L/r
2
200x10 9 x3 2 3.14 2` x 215x10 6 53.245 2.87m
Jadi minium agar terjadinya buckling adalah 2.87 m
79
Lampiran 14. Tabel hasil pengukuran sensor ultrasonik pada sore hari dengan suhu 29 oC Jarak dipenggaris (cm)
Keluaran ADC
Tampilan LCD (cm)
60
2965
59.3
55
2705
54.1
50
2460
49.2
45
2225
44.5
40
1975
39.5
35
1710
34.2
30
1465
29.3
25
1225
24.5
20
955
19.1
15
735
14.7
10
485
9.7
5
245
4.9
80
Lampiran 15. Tabel hasil pengukuran sensor ultrasonik pada pagi hari dengan suhu 27 oC Jarak dipenggaris (cm)
Keluaran mikron (ms)
Tampilan LCD
60
3000
60
55
2725
54.5
50
2480
49.6
45
2230
44.6
40
1985
39.7
35
1730
34.6
30
1470
29.4
25
1250
25
20
1000
20
15
730
14.6
10
475
9.5
5
235
4.7
81
Lampiran 16.Tabel hasil pengukuran sensor ultrasonik pada siang hari dengan suhu 35 oC Jarak dipenggaris (cm)
Keluaran mikron
Tampilan LCD (cm)
60
2990
59.8
55
2740
54.8
50
2465
49.3
45
2205
44.1
40
1970
39.4
35
1725
34.5
30
1470
29.4
25
1225
24.5
20
985
19.7
15
725
14.5
10
480
9.6
5
240
4.8
82
Lampiran 17. Tabel kalibrasi sensor suhu LM35 Suhu Termometer (oC) 29 30 31 32 33 34 35
Output LM35 (Milivolt) 290 300 310 320 330 340 350
Tampilan LCD (oC) 29 30 31 32 33 34 35
83
Lampiran 18. Tabel kalibrasi penguat pada strain gage Data pembacaan (milivolt)
No 1 1
2
3
4
2
Rataan
Interval
3
3180
3170
-
3175
7
3080
3070
-
3075
100
2970
2980
-
2975
100
2870
2880
-
2875
100
2760
2770
-
2765
110
2660
2670
-
2665
100
2560
2570
-
2565
100
2460
2470
-
2465
100
2350
2360
-
2355
110
2240
2250
-
2245
110
2130
2140
-
2135
110
3160
3170
-
3165
7
3040
3050
3060
3050
115
2960
2950
2940
2950
100
2840
2850
2860
2850
100
2730
2740
2750
2740
110
2620
2630
2640
2630
105
2510
2520
-
2515
110
2410
2420
-
2415
100
2310
2320
-
2315
100
2200
2210
-
2205
110
2090
2100
-
2095
110
3160
3170
-
3165
7
3040
3050
-
3045
120
2940
2950
-
2945
100
2830
2840
-
2835
110
2730
2720
-
2725
110
2620
2610
-
2615
110
2520
2510
-
2515
100
2410
2400
-
2405
110
2300
2290
-
2295
110
2200
2190
-
2195
100
2090
2080
-
2085
110
3160
3170
-
3165
7
3080
3090
-
3085
80
2940
2950
-
2945
140 84
5
6
7
2860
2850
-
2855
90
2730
2740
-
2735
120
2630
2640
-
2635
100
2500
2510
-
2505
130
2380
2390
-
2385
120
2270
2280
-
2275
110
2180
2190
-
2185
90
2060
2070
-
2065
120
3160
3170
-
3165
7
3040
3050
3060
3050
115
2940
2950
-
2945
105
2840
2850
-
2845
100
2730
2740
-
2735
110
2620
2630
2640
2630
105
2510
2520
-
2515
115
2410
2420
-
2415
100
2310
2320
-
2315
100
2210
2220
-
2215
100
2110
2120
-
2115
100
3150
3160
-
3155
7
3040
3030
-
3035
120
2950
2940
-
2945
90
2840
2850
-
2845
100
2730
2740
-
2735
110
2640
2650
-
2645
90
2540
2550
-
2545
100
2430
2440
-
2435
110
2330
2340
-
2335
100
2230
2240
-
2235
100
2120
2130
-
2125
110
3170
3160
-
3165
7
3060
3070
3080
3070
95
2960
2970
-
2965
105
2840
2850
-
2845
120
2730
2740
-
2735
110
2620
2630
-
2625
110
2500
2510
-
2505
120
2395
2405
-
2400
105
2295
2305
-
2300
100
2190
2200
-
2195
105
2080
2090
-
2085
110 85
8
3180
3170
-
3175
7
3030
3040
3050
3040
135
2930
2920
2910
2920
120
2810
2820
-
2815
105
2720
2710
-
2715
100
2620
2610
-
2615
100
2500
2490
-
2495
120
2380
2390
2400
2390
105
2270
2280
-
2280
110
2170
2180
-
2180
100
2060
2070
-
2070
110
86
Lampiran 19. Tabel kalibrasi keluaran ADC
Volt
keluaran ADC
0.41
60
0.46
69
0.51
80
0.56
89
0.61
100
0.66
111
0.71
121
0.76
131
0.81
142
0.86
152
0.91
162
1.01
183
1.11
204
1.20
222
1.30
244
1.40
265
1.50
284
1.60
304
1.70
326
1.80
347
2.00
387
2.20
427
2.40
467
2.60
507
2.80
547
3.00
587
3.20
630
3.40
670
3.60
711
3.80
751
4.00
793
4.76
947
87
Lampiran 20. Gambar kalibrasi suhu
88
Lampiran 21. Gambar kalibrasi strain gage
89
Lampiran 22. Gambar kalibrasi jarak pada ultrasonik
90
Lampiran 23. Gambar prototipe penetrometer digital
91
Lampiran 24. Pemrograman pembacaan sensor kedalaman ultrasonik pada mikrokontroler lcd_init(16); lcd_gotoxy(0,0); lcd_putsf("program penetrometer"); delay_ms (3000); lcd_clear(); while (1) { SIG_dir = 1; // set SIG pin as output SIG_out = 0; // delay_us(50); // send start pulse SIG_out = 1; // SIG_dir = 0; // set SIG pin as input TCNT1=0; counter= 0; while (SIG_in && counter<300) jadi=counter;// wait for return pulse jadi++; TCCR1B=0x02; // start timer (timer period = 2uS) while ((!SIG_in) && !(TIFR&0x80)); //TIFRx80 :bit overflow:bit ini tidak selalu sama letaknya di setiap UC AVR TCCR1B=0x00; // stop timer us= TCNT1; // save timer value to variable US us= us/5; us=us/10; // convert to milimeters ftoa(us,1,temp1);//mengubah tipe data float ke tipe data array yg akan ditampilkan di LCD lcd_gotoxy(0,0); lcd_puts("H"); lcd_gotoxy(0,1); lcd_puts(temp1); delay_ms(50);
//
92
Lampiran 25. Program kalibrasi data ADC lcd_gotoxy(0,0); lcd_putsf("program kalibrasi ADC"); delay(3000); lcd_clear(); while (1) { kalibrasi=read_adc(0); //pembacaan ADC pin A.0 ftoa(kalibrasi,1,nilai2); // mengubah data string menjadi array lcd_gotoxy(0,0); // penentuan lokasi pencetakan LCD lcd_putsf(nilai2); // lambaang massa
Lampiran 26. Program kalibrasi suhu IC LM35 lcd_gotoxy(0,0); lcd_putsf("program kalibrasi suhu"); delay(3000); lcd_clear(); while (1) { suhu= read_adc(2); //pembacaan ADC itoa(suhu, nilai); //mengubah data string menjadi array lcd_gotoxy(0,0); //lokasi pencetakan ke LCD lcd_putsf(nilai); //pencetakan ke LCD } } while (1) { lcd_gotoxy(0,0); //lokasi penampilan lcd pada kolom 0 baris ke 0 lcd_putsf(“test1”); lcd_gotoxy(0,1);//lokasi penampilan lcd pada kolom 0 baris ke1 lcd_putsf(“test2”)
93
Lampiran 27. Pemrograman penetrometer digital ke mikrokontroler #include <mega8535.h> #include <delay.h> #include <stdio.h> #include
#include <stdlib.h> #define ADC_VREF_TYPE 0x00 #define SIG_out PORTB.2 #define SIG_in PINB.2 #define SIG_dir DDRB.2 #define ready PINB.3 #define cs PORTB.0 #define sck PORTB.1 #define mosi PORTB.3 #define miso PINB.4 #define rst PORTB.5 eeprom unsigned int save; eeprom unsigned int save1; eeprom unsigned int save2;
float us, counter, jadi; unsigned int us1, tekanan1, detik; unsigned char us_msb, us_lsb, suhu_msb, suhu_lsb, tekanan_lsb, tekanan_msb, s1=0,s=0;; unsigned char cnt_1Hz=0; // Read the 8 most significant bits // of the AD conversion result interrupt [EXT_INT0] void ext_int0_isr(void) { // Place your code here s++; } unsigned char read_adc(unsigned char adc_input) { ADMUX=adc_input | (ADC_VREF_TYPE & 0xff); // Delay needed for the stabilization of the ADC input voltage delay_us(300); // Start the AD conversion ADCSRA|=0x40; // Wait for the AD conversion to complete while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; return ADCW; } #define delay_spi 10 //1us unsigned int spi(unsigned int data){ unsigned char i,temp; for(i=0x80;i!=0;i>>=1){ 94
temp<<=1; if(data&i){ mosi=1; } else{ mosi=0; } delay_us(delay_spi); sck=1; delay_us(delay_spi); if(miso==1){ temp+=1; } delay_us(delay_spi); sck=0; delay_us(delay_spi); } return temp; } unsigned char status_register_read(void){ unsigned char temp; cs=0; delay_us(delay_spi); spi(0x57); delay_us(delay_spi); sck=1; delay_us(delay_spi); sck=0; delay_us(delay_spi); temp=spi(0); delay_us(delay_spi); cs=1; delay_us(delay_spi); return temp; } void wait_for_busy(void){ while((status_register_read()&0xBC)!=0x9C); } void init(void){ cs=1; sck=0; rst=1; miso=1; mosi=0; } void reset(void){ cs=0; delay_us(200); rst=0; delay_us(200); cs=1; delay_us(200); rst=1; delay_us(200); 95
wait_for_busy(); } unsigned int buffer_1_read(unsigned int address){ unsigned char temp; cs=0; spi(0x54); spi(0); spi((address>>8)&0x01); spi(address&0xff); spi(0); sck=1; sck=0; temp=spi(0); cs=1; return temp; } void buffer_1_write_open(unsigned int address){ cs=0; spi(0x84); spi(0); spi((address>>8)&0x01); spi(address&0xff); } void buffer_1_write_close(void){ cs=1; wait_for_busy(); } void buffer_1_to_main_Memory_with_erase(unsigned int page){ unsigned int temp; cs=0; spi(0x83); temp=page; temp>>=7; temp=temp&0xf; spi((int)temp); //char temp=page; temp<<=1; spi((int)temp); // spi(0); cs=1; wait_for_busy(); } void buffer_2_write_open(unsigned int address){ cs=0; spi(0x87); spi(0); spi((address>>8)&0x01); spi(address&0xff); } void buffer_2_write_close(void){ cs=1; wait_for_busy(); } void buffer_2_to_main_Memory_with_erase(unsigned int page){ 96
unsigned int temp; cs=0; spi(0x86); temp=page; temp>>=7; temp=temp&0xf; spi((int)temp); temp=page; temp<<=1; spi((int)temp); spi(0); cs=1; wait_for_busy(); } void main_Memory_to_buffer_1_transfer(unsigned int page){ unsigned int temp; cs=0; spi(0x53); temp=page; temp>>=7; //7 temp=temp&0xf; spi((char)temp); // temp=page; temp<<=1; spi((char)temp); // spi(0); cs=1; wait_for_busy(); } // Declare your global variables here interrupt [TIM0_OVF] void timer0_ovf_isr(void) { // Reinitialize Timer 0 value TCNT0=0x05; cnt_1Hz++; // Place your code here if(cnt_1Hz==250){ cnt_1Hz=0; detik++; } } void main(void) { unsigned int mainpage,page,i=0,i_akhir,mainpage_akhir,update=0; unsigned int baca1,baca2,baca3,baca4,baca5,baca6,baca7, baca8, k=0; int suhu; float tekanan; char nilai2[8]; char temp1[8]; char temp[8]; float suhu1; DDRC=0xff; PORTC.3=0; 97
DDRB.0=1; DDRB.1=1; DDRB.3=1; PORTB.4=1; DDRB.5=1; DDRD=0x34; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: 62.500 kHz // Mode: Normal top=0xFF // OC0 output: Disconnected TCCR0=0x03; TCNT0=0x05; OCR0=0x00;
// External Interrupt(s) initialization // INT0: On // INT0 Mode: Falling Edge // INT1: Off // INT2: Off GICR|=0x40; MCUCR=0x02; MCUCSR=0x00; GIFR=0x40; TIMSK=0x01; // USART initialization // Communication Parameters: 8 Data, 1 Stop, No Parity // USART Receiver: On // USART Transmitter: On // USART Mode: Asynchronous // USART Baud Rate: 9600 UCSRA=0x00; UCSRB=0x18; UCSRC=0x86; UBRRH=0x00; UBRRL=0x19;
// ADC initialization // ADC Clock frequency: 1000,000 kHz // ADC Voltage Reference: AREF pin ACSR=0x80; SFIOR=0x00; // ADC High Speed Mode: Off // ADC Auto Trigger Source: ADC Stopped // Only the 8 most significant bits of 98
// the AD conversion result are used ADMUX=ADC_VREF_TYPE & 0xff; ADCSRA=0x82; SFIOR&=0xEF; SFIOR|=0x10; lcd_init(16); init(); reset(); lcd_gotoxy(0,0); lcd_putsf("PENETROMETER"); delay_ms (1000); lcd_clear(); lcd_gotoxy(0,0); lcd_putsf("Press Button..."); lcd_gotoxy(0,1); lcd_putsf("To Copy Data"); lcd_clear(); #asm("sei") while(detik<=4){ if(s!=s1){ s1=s; update=save; mainpage_akhir=save1; i_akhir=save2; goto next1;} s1=s; } lcd_clear(); lcd_gotoxy(0,0); lcd_putsf("Data Record"); detik=0; cnt_1Hz=0; lcd_clear(); for (mainpage=0;mainpage<=2048;) {delay_ms(500); lcd_gotoxy(0,1); lcd_putsf(" "); SIG_dir = 1; // set SIG pin as output SIG_out = 0; // delay_us(50); // send start pulse SIG_out = 1; // SIG_dir = 0; // set SIG pin as input TCNT1=0; counter= 0; while (SIG_in && counter<300) jadi=counter;// wait for return pulse jadi++; TCCR1B=0x02; // start timer (timer period = 2uS) while ((!SIG_in) && !(TIFR&0x80)); //TIFRx80 // selalu sama letaknya di setiap UC AVR us=0; TCCR1B=0x00; // stop timer us= TCNT1; // save timer value to variable US
:bit
overflow:bit
ini
tidak
99
us1=(int)us; us= us/5; us=us/10; // convert to milimeters ftoa(us,1,temp1);//mengubah tipe data float ke tipe data array yg akan ditampilkan di LCD lcd_gotoxy(0,0); lcd_puts("H"); lcd_gotoxy(0,1); lcd_puts(temp1); us_msb = us1 & 0xFF; us_lsb = us1 >> 8; suhu = read_adc(7); suhu1=(float)suhu*500/1024; ftoa(suhu1,1,temp); lcd_gotoxy(6,0); lcd_putsf("Tmp"); lcd_gotoxy(6,1); lcd_puts(temp); suhu_msb=suhu & 0xFF; suhu_lsb=suhu >> 8; tekanan=read_adc(0); tekanan1== 0,0049*tekanan + 0,1133 tekanan = 28.133*tekanan1 – 3.8173 ftoa(tekanan,1,nilai2); lcd_gotoxy(11,0); lcd_putsf("Force"); lcd_gotoxy(11,1); lcd_puts(nilai2); tekanan_msb=tekanan1 & 0xFF; tekanan_lsb=tekanan1 >> 8; if(i==0){ if(k==0){buffer_1_write_open(0);} else{buffer_2_write_open(0);}} spi(us_lsb); spi(us_msb); spi(suhu_lsb); spi(suhu_msb); spi(tekanan_lsb); spi(tekanan_msb); spi(0); spi(0); i++; i_akhir=i; mainpage_akhir=mainpage; if(i==33){ page=0; page=mainpage; page*=256; page+=mainpage; if(k==0){ k=1; buffer_1_write_close(); buffer_1_to_main_Memory_with_erase(page); } 100
else{ k=0; buffer_2_write_close(); buffer_2_to_main_Memory_with_erase(page); } mainpage++; i=0; } if(s!=s1){ s1=s; goto next;} s1=s; }
next: if(i<33){ page=0; page=mainpage; page*=256; page+=mainpage; if(k==0){ buffer_1_write_close(); buffer_1_to_main_Memory_with_erase(page); } else{ buffer_2_write_close(); buffer_2_to_main_Memory_with_erase(page); } mainpage++; } update=mainpage; save=update; save1=mainpage_akhir; save2=i_akhir; lcd_gotoxy(0,0); lcd_clear(); lcd_gotoxy(0,0); lcd_putsf("Record Finish"); while(1){ if(s!=s1){ s1=s; goto next1;} s1=s; } next1: lcd_clear(); lcd_gotoxy(0,0); lcd_putsf("Transfer"); printf("Jarak(cm) Suhu(C) Tekanan(kgf) \n \r"); 101
for(mainpage=0;mainpage
102
Lampiran 28. Program pembacaan port
Private Sub background_Click(Index As Integer) If BackColor = vbYellow Then BackColor = vbGreen Else BackColor = vbYellow End If End Sub Private Sub command1_click() Dim port As Integer On Error GoTo errcode Select Case Combo1.ListIndex Case -1 port = 1 Case 0 port = 1 Case 1 port = 2 Case 2 port = 3 Case 3 port = 4 Case 4 port = 5 Case 5 port = 6 Case 6 port = 7 Case 7 103
port = 8 Case 8 port = 9 End Select If MSComm1.PortOpen = False Then MSComm1.CommPort = port MSComm1.RThreshold = 1 MSComm1.InputLen = 40 MSComm1.Settings = Combo2.List(Combo2.ListIndex) & ",N,8,1" MSComm1.PortOpen = True Command1.Enabled = False Command2.Enabled = True End If Exit Sub errcode: MsgBox "Port Salah !", vbOKOnly, "Peringatan" Combo1.SetFocus End Sub Private Sub command2_click() If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End If cmdConnect.Enabled = True cmdDisconnect.Enabled = False End Sub Private Sub command3_click() Dim tbx As Control For Each tbx In Me.Controls If TypeOf tbx Is TextBox Then tbx.Text = " " Next End Sub Private Sub Command4_Click() 104
Clipboard.SetText Text1.SelText Text1.SelText = Text1 Text1 = "" End Sub Private Sub exit_Click(Index As Integer) End End Sub Private Sub Form_Load() With Combo1 .AddItem "COM1" .AddItem "COM2" .AddItem "COM3" .AddItem "COM4" .AddItem "COM5" .AddItem "COM6" .AddItem "COM7" .AddItem "COM8" .AddItem "COM9" End With With Combo2 .AddItem "2400" .AddItem "4800" .AddItem "9600" .AddItem "19200" .AddItem "38400" .AddItem "56600" End With Command1.Enabled = True Command2.Enabled = False End Sub Private Sub MSComm1_OnComm() Dim buffer As String 105
Dim temp As String buffer = MSComm1.Input If buffer <> "" Then With Text1 .SelStart = Len(.Text) .SelText = buffer End With End If End Sub
106