Depok Instruments

We Present Technologies As Arts

UPDATE!

[20/01/2012] Produk Baru: DI-Smart RTC.1307

[15/11/2011] Program: Source Code BASCOM for SHT11

[02/11/2011] Datasheet: Sensirion SHT11 (Temperature & Humidity Sensor)

[02/11/2011] Datasheet: RTC DS1307

[31/10/2011] Program: Source Code CVAVR for RTC DS1307

 

Juli 26, 2011 Posted by | Uncategorized | Tinggalkan sebuah Komentar

Jajak Pendapat

Agustus 6, 2011 Posted by | Uncategorized | 2 Komentar

DI-Smart RTC.1307

Deskripsi:

DI-Smart RTC.1307 adalah modul RTC (real time clock), yaitu rangkaian elektronika yang memberikan informasi waktu yang sesuai dengan standar internasional (1 detik = tepat 1 detik).

Gambar 1. Layout DI-Smart RTC.1307

Aplikasi:

Sebagai basis perhitungan waktu yang tepat sesuai dengan standar waktu internasional.

Spesifikasi:

  • Menggunakan IC RTC DS-1307
  • Memiliki fitur-fitur waktu: detik, menit, jam, tanggal, bulan, tahun, dan hari.
  • Menggunakan I2C sebagai jalur komunikasinya.
  • Memiliki fitur output gelombang kotak yang dapat diprogram.
  • Dapat langsung dihubungkan dengan DI-Smart AVR(16) System atau DI-Super Smart AVR(16)

Contoh Program: http://depokinstruments.com/2011/10/31/source-code-cvavr-for-rtc-ds1307/

Januari 20, 2012 Posted by | 3.2 Modul Elektronika | , , | Tinggalkan sebuah Komentar

Source Code BASCOM-AVR for SHT11

$regfile = “m8535.dat”

$crystal = 11059200

‘$lib “lcd4busy.lib”

$baud = 9600

‘Const _lcdport = Porta

‘Const _lcdddr = Ddra

‘Const _lcdin = Pina

‘Const _lcd_e = 2

‘Const _lcd_rw = 1

‘Const _lcd_rs = 0

Ddrc = 255

Portc = 255

Ddra = 255

Porta = 255

‘Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.2 , Rs = Portc.3

‘Config Lcd = 16 * 2

‘Config Adc = Single , Prescaler = Auto , Reference = Avcc

‘Start Adc

Dim Ctr As Byte

Dim Dataword As Word

Dim Command As Byte

Dim Dis As String * 20

Dim Calc As Single

Dim Calc2 As Single

Dim Rhlinear As Single

Dim Rhlintemp As Single

Dim Tempc As Single

Dim Tempf As Single

Dim A As Word , I As Integer

‘Deflcdchar 0 , 14 , 17 , 17 , 17 , 14 , 32 , 32 , 32

‘Deflcdchar 1 , 18 , 13 , 7 , 4 , 4 , 4 , 8 , 16

‘Deflcdchar 2 , 4 , 14 , 31 , 32 , 32 , 32 , 32 , 32

Sck Alias Portc.0

Dataout Alias Portc.1

Datain Alias Pinc.1

‘Redled Alias Portb.2

Declare Sub Getit()

Declare Sub Connectionreset

Call Connectionreset

Const C1 = -4

Const C2 = 0.0405

Const C3 = -0.0000028

Const T1c = 0.01

Const T2 = 0.00008

‘Const T1f = .018

Do

‘Cls

‘Do                                                          ‘continually read the tempfature and humidity

 Command = &B00000011

 Call Getit                                                 ‘Get the temperature, puts result in “dataword” for us

 ’Tempf = T1f * Dataword

 ’Tempf = Tempf – 40

 Tempc = T1c * Dataword                                     ’get celcius for later calculations and for “the rest of the world”

 Tempc = Tempc – 40

 Dis = Fusing(tempc , “###.##”)

 Print “Temp = ” ; Dis ; “C”

 ’Lcd “Temp  = ” ; Dis ; Chr(0) ; “C”

 ’Portc = Tempc

 ’Reset Portc.7

 ’Porta = Tempc

 ’Reset Porta.0

 Waitms 250

 ’Waitms 250

 Command = &B00000101

 Call Getit                                                 ‘get the humidity

 Calc = C2 * Dataword

 Calc2 = Dataword * Dataword                                ‘that “2″ in the datasheet sure looked like a footnote for a couple days, nope it means “squared”!

 Calc2 = C3 * Calc2

 Calc = Calc + C1

 Rhlinear = Calc + Calc2

 Dis = Fusing(rhlinear , “##.##”)

 Print “Humidity adjusted for linear = ” ; Dis

 Calc = T2 * Dataword

 Calc = Calc + T1c

 Calc2 = Tempc – 25

 Calc = Calc2 * Calc

 Rhlintemp = Calc + Rhlinear

 Dis = Fusing(rhlintemp , “##.##”)

 Print “Humidity adjusted for temperature = ” ; Dis

 Print

 ’Locate 2 , 1

 ’Lcd “Humi = ” ; Dis ; ” %”

 ’Portc = Rhlintemp

 ’Set Portc.7

 ’Porta = Rhlintemp

 ’Set Porta.7

 Waitms 250

 ’Waitms 250

 Cls

Loop

Sub Connectionreset()

Ddrc = &B11111111                                           ‘all port b are output

Config Pinc.0 = Output                                      ’sck

Config Pinc.1 = Output                                      ‘datain

Set Dataout

For Ctr = 1 To 10

 Set Sck

 Waitms 2

 Reset Sck

 Waitms 2

Next Ctr

 Set Sck

 Reset Dataout

 Reset Sck

 Set Sck

 Set Dataout

 Reset Sck

End Sub

Sub Getit()

 Local Datavalue As Word

 Local Databyte As Byte

 ’start with “transmission start”

 Set Sck

 Reset Dataout

 Reset Sck

 Set Sck

 Set Dataout

 Reset Sck

 ’now send the command

 Shiftout Dataout , Sck , Command , 1

 Ddrc = &B1111_1101                                         ‘datain is now input

 Config Pinc.1 = Input                                      ‘datain

 Set Sck                                                    ‘click one more off

 Reset Sck

 Waitus 10                                                  ’no idea why, but it doesn’t work without it!

 Bitwait Pinc.1 , Reset                                     ‘wait for the chip to have data ready

 Shiftin Datain , Sck , Databyte , 1                        ‘get the MSB

 Datavalue = Databyte

 Ddrc = &B1111_1111

 Config Pinc.1 = Output

 Reset Dataout                                              ‘this is the tricky part- Lot’s of hair pulling- have to tick the ack!

 Set Sck

 Reset Sck

 Ddrc = &B1111_1101                                         ‘datain is now input

 Config Pinc.1 = Input

 Shiftin Datain , Sck , Databyte , 1                        ‘get the LSB

 Shift Datavalue , Left , 8

 Datavalue = Datavalue Or Databyte

 ’don’t tick the clock or ack since we don’t need the CRC value, leave it hanging!

 Dataword = Datavalue

 Ddrc = &B1111_1111

 Config Pinc.1 = Output

 Reset Dataout

 Set Sck

 Reset Sck

 Ddrc = &B1111_1101                                         ‘datain is now input

 Config Pinc.1 = Input

 Shiftin Datain , Sck , Databyte , 1                        ‘not using the CRC value for now- can’t figure it out! Anybody know how to impliment?

 ’Print “CRC value was – ” ; Databyte

 Ddrc = &B1111_1111

 Config Pind.1 = Output

 Set Dataout

 Set Sck

 Reset Sck

End Sub

November 15, 2011 Posted by | 2.6 AVR [III], 3.3 Program | Tinggalkan sebuah Komentar

Datasheet SHT11 (Temperature & Humidity Sensor)

Datasheet Datasheet-humidity-sensor-SHT1x:

  1. Format PDF
  2. Besar File 323 KB
  3. Jumlah Halaman 11 Lembar
  4. Unduh di Sini

http://depokinstruments.files.wordpress.com/2011/11/rtc-ds1307.pdf

November 2, 2011 Posted by | 3.1 Datasheet | Tinggalkan sebuah Komentar

Datasheet DS1307 (RTC)

Datasheet DS1307 (RTC):

  1. Format PDF
  2. Besar File 168 KB
  3. Jumlah Halaman 11 Lembar
  4. Unduh di Sini

November 2, 2011 Posted by | 3.1 Datasheet | Tinggalkan sebuah Komentar

Source Code CVAVR for RTC DS1307

#include <mega8535.h>
#include <stdio.h>

// I2C Bus functions
#asm
.equ __i2c_port=0×12 ;PORTD
.equ __sda_bit=5
.equ __scl_bit=4
#endasm
#include <i2c.h>

// DS1307 Real Time Clock functions
#include <ds1307.h>

// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0×18 ;PORTB
#endasm
#include <lcd.h>

// Declare your global variables here
unsigned char jm, mn, dt, tg, bl, th, bstr[16];

void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0×00;
DDRA=0×00;

// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0×00;
DDRB=0×00;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0×00;
DDRC=0×00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0×00;
DDRD=0×00;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0×00;
TCNT0=0×00;
OCR0=0×00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0×00;
TCCR1B=0×00;
TCNT1H=0×00;
TCNT1L=0×00;
ICR1H=0×00;
ICR1L=0×00;
OCR1AH=0×00;
OCR1AL=0×00;
OCR1BH=0×00;
OCR1BL=0×00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0×00;
TCCR2=0×00;
TCNT2=0×00;
OCR2=0×00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0×00;
MCUCSR=0×00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0×00;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0×80;
SFIOR=0×00;

// I2C Bus initialization
i2c_init();

// DS1307 Real Time Clock initialization
// Square wave output on pin SQW/OUT: Off
// SQW/OUT pin state: 0
rtc_init(0,0,0);

// LCD module initialization
lcd_init(20);

/*****setup time and date*****/
jm=12;mn=11;dt=00;
rtc_set_time(jm,mn,dt);

tg=26;bl=10;th=11;
rtc_set_date(tg,bl,th);
/*****************************/

while (1)
{
// Place your code here
rtc_get_time(&jm,&mn,&dt);
rtc_get_date(&tg,&bl,&th);
sprintf(bstr,”Time %02d:%02d:%02d”,jm,mn,dt);
lcd_gotoxy(0,0);
lcd_puts(bstr);

sprintf(bstr,”Date %02d-%02d-%02d”,tg,bl,th);
lcd_gotoxy(0,1);
lcd_puts(bstr);
};
}

Oktober 31, 2011 Posted by | 2.6 AVR [III], 3.3 Program | Tinggalkan sebuah Komentar

Ikuti

Get every new post delivered to your Inbox.

Bergabunglah dengan 28 pengikut lainnya.