Friday, May 29, 2015

Timer Time: Using Internal ATTiny13A Chip’s Timer “Normal” Mode


Chip’s Internal Timer in ’Normal' mode will count from 0 to 255, set the overflow flag TOV0 to 0 and count again from 0 to 255, set the flag to 0 and so on. 

As usual, I used LED as output indicator on Port B0

We used 1024 for pre-scaler/divider value. Set the TCCR0B to 0000 0101

Note that we have to reset the overflow flag to 1 after timer count reached 255 (and set the flag to 0). 

Oh, by the way, the register/variable/things that count from 0 to 255 is called TCNT0. We didn’t touch it in the code this time, maybe next. 

Pencerahan


Kadang datang secara tak disangka.
 
Tak hanya pencerahan relijius seperti Sakti dari Sheila on 7 yang tiba-tiba 'terbangun' saat baca buku "Menjemput Sakaratul Maut ...." di bandara dan majalah Mati Suri di rumah sakit. Kini dia bernama Salman Al Jugjawy.
 
Saya mengalami pencerahan secara musikal, beberapa kali.
 
Saya termasuk telat belajar alat musik. Memiliki gitar di akhir kelas satu SMP. Awalnya belajar lagu standart Koes Plus, Iwan Fals. Dangdut populer, belajar karena ikut ekstrakurikuler band musik, manggung di tempat-tempat yang menginginkan lagu dangdut. Tembang kenangan malam-malam di radio.

Saat SMU saya "Naik tingkat". Boomerang, Jamrud, Padi, Dewa19, Sheila On 7, Slank dan musik-musik populer di radio jadi sasaran.

Lagi,di akhir SMU mengenal underground music. Pernah sampai diusir yang punya "studio" karena "gak niat", "ngrusak drum", "bikin sakit kuping", "liriknya gak bisa didengarkan", "bahasa apa itu?". Cuma lagu Derek yang easy listening, yang kedua adalah Bendera Kuning (kayak gitu easy listening? Yup, dibanding yang lain, ;) )

Sound gitar suka yang berdistorsi full, masuk akal memang. Efek gitar lebih suka semacam Metal Zone. Semakin djent djent djent semakin keren. Sangat anti dengan efek Overdrive . Tone harus se-treble mungkin. Dan sering frustrasi karena tidak dapat distorsi seperti di fantasi. Paling sulit meniru Eros, ada distorsi tapi nada individual tetap terdengar.

Dan pencerahan itu datang.

Thursday, May 28, 2015

And Finally the Breathing LED is Here, :)


Jonathan Ive style, Old Macbook Pro sleep indicator LED.

Using interrupt, fast PWM on ATTiny13A.

Flip the Bit


Maybe it's just me, but I recently realized that we have a handy feature on ATTiny13A for flip the value of the bit.


so instead of

sbic PINB,0
cbi PINB,0
sbi PINB,0

we could just use

sbi PINB,0


Saving some clocks, :)

Wednesday, May 27, 2015

Blinking LED using Interrupt on ATTiny13A

Here's the template


.include "../tn13Adef.INC" 
.def a=r16
.org $0000              ; startup vector
    rjmp onReset
.org $0006              ; compare match vector
    rjmp Tim0CompA
onReset:
    sbi DDRB,0          ; port B0 as output
    
    ldi a, 0b10000011   ; pwm mode 3
    out TCCR0A, a
    
    ldi a, 0b00000101   ; divider /1024
    out TCCR0B,a
    
    ldi a, 0b0000100    ; enable compare interrupt
    out TIMSK0,a
    
    sei
main:
    rjmp main
        
Tim0CompA:
    in a, OCR0A
    inc a
    out OCR0A,a

    reti

Oscillating LED Blink Delay on ATTiny13A

Based on my ADC with PWM output program.

The expected result is the old school MacbookPro unibody sleep indicator LED;  Sir Jonathan Ive style, :)

The code below resulted on slow to fast to slow to fast... blinking LED

Tuesday, May 26, 2015

Gendhing dan Perkusi


P Rosyid menulis tentang langgam beberapa waktu lalu.   
 
Dan saya juga ingin menulis. Memang lain, ini tentang gendhing jawa. Betapa dulu ketika masih aktif nge-band sering kesulitan menirukan lagu-lagu jawa tertentu. Bukan lagu-lagu semacam Gambang Semarang atau langgam atau Bossanova Jawa; itu relatif mudah. 

Lagu-lagu yang memiliki gaya klasik. Lingsir Wengi, Kusumaning Ati,...

Dalam beberapa hal, musik jawa memang lain dibanding dengan musik “standar” saat ini.

Di musik selain jawa. Alat-alat musik ritmis/perkusi digunakan untuk menjaga irama, menghitung ketukan, menandai birama. Entah itu drum, bongo, ketipung, tambourine atau gendang. Mereka memiliki beat tertentu.

Timer on ATTiny13A using Interrupt


 It started with this

.include "../tn13Adef.inc" 
.org 0000 
rjmp reset 
.org 0003 
rjmp timer

reset:
sbi ddrb,0           
ldi r16,0b00000101    
out tccr0b,r16
ldi r16,0b00000010    
out timsk0,r16
sei

loop:
ldi r16,(1<<SE)
out mcucr,r16
sleep
rjmp loop

timer:
sbi   pinb,0       

reti


Monday, May 25, 2015

ATTiny13A Arduino

ATTiny is ... well, tiny. Not very suitable to programed it on arduino. Nevertheless, I decided to do it.



Create ‘hardware’ folder in Arduino sketch folder, unzip the file.
Download the Smeezekitty core, http://sourceforge.net/projects/ard-core13/files/latest/download

Android Studio on My OS X Yosemite


Well, a picture is worth thousand words.

So, here the millions words for you, :)




My FreeBSD Installation LeftOver


Didn't really remember the chronology. It use Parallel Desktop. It use VirtualBox too.