This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint16_t data16bit; | |
uint8_t data8bit[2]; | |
// data8bit[0] | |
// data bagian atas / HIGH | |
// data8bit[1] | |
// data bagian bawah / LOW | |
data16bit = ((data8bit[0] << 8) & 0xFF00) | data8bit[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Persamaan dari excel | |
y = 0,0009x2 + 0,9856x + 0,2964 | |
x ==> data dari sensor | |
y ==> data keluaran kalibrasi | |
Persamaan di Bahasa C | |
y = 0.0009*x*x + 0.9856*x + 0.2964; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************* | |
This program was created by the CodeWizardAVR V3.36 | |
Automatic Program Generator | |
© Copyright 1998-2019 Pavel Haiduc, HP InfoTech s.r.l. | |
http://www.hpinfotech.com | |
Project : LCD 16x2 | |
Version : | |
Date : 17/05/2019 | |
Author : Robotik Indonesia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int dataInteger=10; | |
char buff[33]; | |
// untuk menghapus semua tampilan | |
lcd_clear(); | |
// untuk memilih koordinat awal tulisan | |
lcd_gotoxy(0,0); | |
// untuk menampilkan string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clock Value = Clock Source / Pre Scaler | |
TCNT = Max Counter-(Clock Value/ (1 / timer yang diinginkan)-1) | |
Max Counter ==> Tergantung bit | |
8 bit ==> 255 | |
16 bit ==> 65535 | |
Timer yang diinginkan dalam satuan Second |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Timer 0 overflow interrupt service routine | |
interrupt [TIM0_OVF] void timer0_ovf_isr(void) | |
{ | |
// Place your code here | |
TCNT0=0x64; | |
} | |
dan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// enable TIM4 | |
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); | |
// mengatur timer 40ms = 0,04s (25Hz) | |
// clock / (prescale +1) | |
// 72.000.000/ (7199+1) = 10.000 | |
// Periode = (10.000 / 25 )-1=400-1=399 | |
TIM_TimeBaseInitTypeDef ST; | |
ST.TIM_Prescaler = 7199; | |
ST.TIM_Period = 399; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mengatur timer 40ms = 0,04s (25Hz) | |
clock / (prescale +1) | |
72.000.000/ (7199+1) = 10.000 | |
Periode = (10.000 / 25 )-1=400-1=399 | |
==> nilai timer yang diinginkan dijadikan dalam satuan frekuensi (Hz) | |
==> nilai prescaler kita tentuin sendiri, terserah. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stm32f10x.h" | |
#include "stm32f10x_tim.h" | |
int hitung=0; | |
void TIM4_IRQHandler(){ | |
if(TIM_GetITStatus(TIM4, TIM_IT_Update)){ | |
hitung++; | |
// taruh sini koding untuk sampling data | |
TIM_ClearITPendingBit(TIM4, TIM_IT_Update); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************* | |
This program was created by the CodeWizardAVR V3.36 | |
Automatic Program Generator | |
© Copyright 1998-2019 Pavel Haiduc, HP InfoTech s.r.l. | |
http://www.hpinfotech.com | |
Project : | |
Version : | |
Date : 13/06/2019 | |
Author : Robotik Indonesia |
OlderNewer