Monday, February 16, 2009

Wonderful slow-motion stabilized video montage of New York

I'm not sure who Vincente Sachuc is, but he's certainly got a career in cinematography if he wants one. This makes me want to get back into creative film work rather than technical videos. He mentions this is captured with a Casio EX-F1 at 300 fps and edited at 24 fps. A skateboard and a Steadicam Merlin help with the smooth traveling shots. Of course, you could buy one of my Poor Man's Steadycams at 5% of the cost of a Merlin =o). Colorization done in Premiere and Photoshop.


New York 2008 from Vicente Sahuc on Vimeo.

Bermain dengan Timer 1 AVR


Yang namanya timer sering kali kita gunakan. Misal saat mau nampilin rpm, kita butuh timer sebagai acuan. Atau untuk menghidupkan device dengan interval tertentu.

AVR yang saya pakai sebagai contoh adalah ATmega 8535. AVR ini memilki 3 timer. Yaitu:

  1. TIMER 0 (8 bit)
  2. TIMER 1 (16 bit)
  3. TIMER 2 (8 bit)

Apa yang dimaksud timer 8 bit dan 16 bit?

timer 8 bit adalah timer yg bisa mencacah/menghitung sampai maksimal nilai 0xFF heksa (dalam biner = 1111 1111). Pada ATmega 8535 ada 2 timer jenis ini yaitu TIMER 0 dan 2

Klo yg 16 bit nilai maksimalnya 0xFFFF. Pada ATmega8535 timer jenis 16 bit adalah TIMER 1. Artikel kali ini akan membahas TIMER 1.

Dulu ak disaranin klo timer mau presisi harus memakai bahasa assembly. Hitung jumlah instruksi yg kita tulis. lalu hitung lama waktunya. Hmmmm.. ribet bener...

Untung aja nemu artikel tentang interrupt timer. Dengan Interrupt kita gak perlu susah2 menghitung berapa waktu yang di perlukan untuk meng eksekusi seluruh program kita. Karena saat program dijalanin, timer juga jalan sendiri (digerakkan XTAL). Trus saat nilai tercapai terjadilah interrupt timer.

Register yg biasa saya gunakan untuk menset nilai Timer1 adalah register TCNT, register TCNT sendiri dibagi dua: TCNT 1 H dan TCNT 1 L.

rumus yang digunakan adalah :

TCNT = (1+0xFFFF) - (waktu *( XTAL / prescaler) )

waktu --> waktu yg kita inginkan

XTAL --> frekuensi xtal yg dipakai

prescaler --> nilai prescaler

Apa nilai prescaler itu?

Timer membutuhkan clock source. Biasanya clock source yg saya pakai adalah clock sistem (XTAL). Dan kita bisa menset besarnya nilai ini. Maximum sama dengan XTAL, minimum XTAL/1024. Nah nilai pembagi (1024) ini yg disebur nilai prescaler.

Macam2 nilai prescaler yg diijinkan: 1, 8 , 64 , 256 , 1024

Untuk mengubah nilai prescaler timer 1, kita harus merubah nilai register TCCR1B bit 0...2

image

gambar diatas di ambil dari data sheet ATmega 8535 hal.113

Contoh Program:

Mengakses Timer 1 dengan interval waktu 1 detik.

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

// LCD di PORT B
#asm
.equ __lcd_port=0x18
#endasm
#include <lcd.h>


unsigned char buff[30];
unsigned long detik;


// sub rutin saat terjadi interrupt Timer 1
interrupt [TIM1_OVF] void timer1_ovf_isr(void)
{
TCNT1H=0xC2;
TCNT1L=0xF7;
detik++;
lcd_clear();
sprintf(buff,"detik %d",detik);
lcd_puts(buff);
}

void main(void)
{

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: kHz
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x04;
TCNT1H=0xC2;
TCNT1L=0xF7;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

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

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80;
SFIOR=0x00;

// LCD module initialization
lcd_init(16);

// Global enable interrupts
#asm("sei")
lcd_putsf("wait...");
while (1)
{

};
}

Program di atas menggunakan timer 1 untuk menambah nilai variabel "detik" setiap 1 detik sekali. Kemudian menampilkan hasilnya ke LCD.

ayo kita mutilasi code program di atas:

yang akan kita bahas dari program diatas adalah code yang kliatan ruwet aja. Klo yg biasa silahkan lihat di artikel2 sebelumnya .. ^_^

**************

// LCD di PORT B
#asm
.equ __lcd_port=0x18 -------------->> mendefinisakan bahwa LCD di hubungkan ke PORT B
#endasm

#include <lcd.h> --------------->> library untuk fungsi2 akses LCD

**************

// sub rutin saat terjadi interrupt Timer 1
interrupt [TIM1_OVF] void timer1_ovf_isr(void)
{
TCNT1H=0xC2; ----------------------> nilai didapat dari rumus ......
TCNT1L=0xF7; ----------------------> ....agar Timer 1 bernilai 1 detik
detik++;
lcd_clear();
sprintf(buff,"detik %d",detik); --------------> memasukkan karakter-karakter ke variabel buff
lcd_puts(buff); --------------------------->menampilkan karakter-karakter variabel buff ke LCD
}

Saat kita ingin menampilkan sederet tulisan ke LCD maka kita harus memasukkan karakter-karakter tulisan itu ke suatu variabel array (dalam program di atas adalah variabel "buff"). Baru kemudian data yg ada di variabel array kita tampilkan ke LCD

***************

void main(void)
{

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: kHz
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge

TCCR1A=0x00;
TCCR1B=0x04; ------------------> prescaler 256
TCNT1H=0xC2; ------------------> nilai didapat dari rumus ......
TCNT1L=0xF7; ------------------> ....agar Timer 1 bernilai 1 detik


inget rumus: TCNT = (1+0xFFFF) - (waktu *( XTAL / prescaler) )

waktu yg dinginkan adalah 1 detik , XTAL yg saya pakai adl 4 Mhz dan nilai prescaler=256

Jadi,...............

TCNT= (1+65535)-(1detik * (4.000.000/256))

=65536 - (1detik*15625)

=65536-15625

= 49911 (desimal)

= C2F7 (heksadesimal)

Nilai untuk TCNT yang di dapat dari rumus bernilai 16bit (4 angka Heksadesimal), 2 angka yg di depan kita masukkan ke TCNT1H dan 2 angka yg dibelakang kita masukkan ke TCNT1L

****************

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x04; ----------------->Timer/Counter1, Overflow Interrupt Enable

code di atas hanya men set  "Overflow Interrupt Timer 1". Interrupt baru aktif saat ada perintah:          #asm("sei")

****************

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80; ------------> me OFF kan analog comparator
SFIOR=0x00;

jika tidak dipakai, sebaiknya analog comparator di OFF. Untuk menghemat pemakaian daya. Hal ini sangat penting jika sumber daya yg digunakan memakai baterai.

*******************

// LCD module initialization
lcd_init(16);  ----------------------> inisialisasi LCD 16*2

*******************

// Global enable interrupts
#asm("sei") ----------------------> meng aktifkan Interrupt-interrupt yg sudah di set sebelumnya

Nah... pada saat ini interrupt Timer 1 aktif

*******************

lcd_putsf("wait...");  --------------> menampilkan tulisan wait.. ke LCD

*********************

while (1)
{

};

Program ini yg dijalankan oleh microcontroller... mikro hanya muter disini di dalam while(1){...};

 (inget !!! infinite looping di artikel BASIC I/O ).. Jadi mikro sama sekali tidak mengeksekusi perintah.

lha kok bisa????? bingungg....  ~_~ !

Disinilah bedanya pake Interrupt!!.

saat terjadi Interrupt Timer1, alur program mikro akan meloncat ke:

// sub rutin saat terjadi interrupt Timer 1
interrupt [TIM1_OVF] void timer1_ovf_isr(void)

{

......................................

......yoww..... program yg ada  disini yg dijalanin...

......................................

}

setelah program yg ada di sub rutin INTERRUPT dijalankan, maka alur program mikro akan muter2 lagi di infinite looping

******************

 

 

jika ada yg kurang dari program di atas mohon kritik dan sarannya

any questions?? post comment on this blog: http:\\avrku.blogspot.com

or send email to: zigan@ymail.com

CodeVisionAVR C Compiler is copyright by Pavel Haiduc, HP InfoTech s.r.l.
AVR is a registered trademark of Atmel Corporation.

Saturday, February 7, 2009

Semenggoh Wildlife Centre

The Semenggoh Wildlife Centre was originally established to rehabilitate animals and birds who had been held in captivity by humans. Often, these animals were kept as pets by the local population, and later confiscated by Sarawak Forestry. Many of the animals at this centre were successfully prepared for life back in the wild, and subsequently released. This original mission of rehabilitation has since been moved to the nearby Matang Wildlife Centre. In present times, Semenggoh hosts a group of 24 Orang Utans (the Borneo species; Pongo pygmaeus), who inhabit an area of 650 hectares of primary rainforest.


Map of Semenggoh Wildlife Centre
View Larger Map

The Orang Utans of Semenggoh are semi-wild. They were introduced into the reserve after their rescue from humans. Since that time, several of the female Orang Utans have given birth within Semenggoh itself. Due to its relatively small size, the reserve is unable naturally to support the number of Orang Utans who live there, and so they are fed twice each day from wooden platforms. These feeding times present an opportunity for visitors to see the primates first hand.

During feeding times, the keepers of the reserve call the Orang Utans, and they descend to their food platforms by brachiation along a suspended network of ropes and cables. At a morning feeding, we initially saw several young Orang Utans, and were warned to stay well clear of them because they are known to throw things at human visitors. The young Orang Utans tended to stuff as much food as possible into their mouths before retreating higher into the trees to eat. Later, we saw the dominant male Orang Utan, called Ritchie, who appeared to be more relaxed, and remained on the feeding platform to eat some bananas.

After the feeding time, we paid to go on a hike around Semenggoh with one of the Orang Utan keepers, called Dominick. Dominick led us on a trail which passed cages that were previously used to quarantine birds, Orang Utans and gibbons, after their rescue from humans. It was also on this trail that we saw our first pitcher plants in Borneo. As usual, I sweated a lot in the high tropical humidity, and was quickly soaking from head to toe. It was a fantastic experience, and the only down-side (if it can be called one) was being attacked by tremendously voracious leeches. The leeches found their way throughout my shoes and socks, but I was able to remove most of them safely (safe for both myself and the leeches). The only leech to leave a mark was one that attached itself to the inside of my right upper arm. Trying to remove this one was a mistake, since it had already started feeding. The anti-coagulant it had released left the wound bleeding for a couple of hours, and produced a red circular mark which is still visible 3 days later!

Orang Utans and humans share a long period of post-natal maternal care. Orang Utan mothers take care of their young for a period of around 4 to 5 years after birth, and will only reproduce again when their offspring are independent. Naturally, Orang Utans are semi-solitary animals, and the crowded state of the Semenggoh reserve is only maintained through human assistance. Even with regular feeding times, the 650 hectares of the reserve is only enough room for a single dominant male; currently Ritchie. I wondered how genetic diversity will be maintained in the successfully-breeding captive population, but haven’t yet found out what plans are in place to achieve this. The only mention made of transporting Orang Utans was that Sarawak Forestry supplies them to the zoos in Western Malaysia.

Overall, Semenggoh Wildlife Centre was a great place to visit. We were lucky in seeing so many Orang Utans at the feeding platform. Several guide books mention that sightings are not guaranteed, and that it is worth setting aside a whole day in order to see both morning and afternoon feeding times. The keepers told us that the Orang Utans were more likely to attend feedings when the local plants were not fruiting, so it would be worth checking when this period occurs.

Don’t forget that more pictures of my journey are available online at my Flickr Photostream: http://www.flickr.com/photos/28808691@N05/

Friday, February 6, 2009

Sarawak Cultural Village

The Sarawak Cultural Village is located at the Pantai Damai (Damai Beach) resort area, about 40 minutes’ drive from the city of Kuching. The village contains examples of the types of houses that are characteristic of those built by the ethnic groups that inhabit Sarawak. Upon entry to the village, visitors are given a “Village Passport” which contains information about the local people. This passport has a section in which tourists can collect stamps from each of the village houses that they visit.


A map of the Sarawak Cultural Village and Damai Beach
View Larger Map

The current population of Sarawak consists mainly of the indigenous Iban people, and immigrant Chinese and Malays. The Iban traditionally lived in groups in the lowlands, in longhouses that were built to last around twenty years. Although they were farmers, the Iban gained notoriety among early European travelers as head-hunters. In some social groups, Iban men were not considered worthy for marriage until they had brought home the head of an enemy from battle. The descendants of the Iban account for around 30% of the current population of Sarawak.



Longhouses were a kind of miniature “village within a house”. Limited privacy was afforded by segmenting the longhouse into rooms that were used for different activities. The effort expended in constructing the longhouse could thus be shared by all of the people that would inhabit it. In particular, providing shelter from the rains of Borneo would have been a great incentive for cooperation in the construction of the common roof.

In more mountainous regions, another ethnic group, the Bidayuh, also traditionally lived in longhouses. The Bidayuh consist of several sub-groups; namely the Jagoi, Biatah, Bukar-Sadong, Selakau and Lara peoples. The Bidayuh were often more gentle than the Iban, although they still collected the heads of their enemy in battle and hung them to smoke above the fire. Among their technological achievements, the Bidayuh invented indoor plumbing! The mountainous terrain on which they lived allowed them to dam rivers up-stream from their houses and use a gravity-fed system of bamboo conduits to supply water. The Bidayuh account for around 8.4% of the current Sarawak population.

The Melanau people built large houses in coastal regions that were supported about 12 m above the ground. They preferentially ate Sago palms, instead of the rice that was usually eaten by most of the other ethnic groups. The remaining indigenous people are often categorized under a single name: the Orang Ulu, which means “up-river dwellers”. The Orang Ulu comprise the Penan, Kayan, Kenyah, Kelabit and Lun Bawang. Among these groups, the Penan, who live in the dense jungles of Central Borneo, are often noted for their use of blowpipes in hunting.

The Cultural Village has an auditorium, at which dance performances are held twice each day. These dances are quite varied and show off the spectacular traditional dress of each of the ethnic groups. Having done some jungle trekking, I often had pause to wonder whether the long, elaborate traditional costumes were worn during daily life or only for special celebrations. Unfortunately, I never had that particular question answered. We visited in the late monsoon season, and the wet weather had apparently scared away most tourists from the village. The houses themselves were quite empty for most of our visit, with the exception of the very friendly Bidayuh longhouse, at which we were warmly welcomed.

My impression was that the Cultural Village was very much set up to cater to tourists. I think that it represented a good attempt to convey a superficial sense of the culture of the region, but that it was lacking depth in some areas. Aside from the village passport and some posters which were hung in each of the houses, there was little educational material available.

European culture was forced upon Sarawak by James Brooke, an unsuccessful trader, who arrived there in August 1838 after inheriting a sum of £30,000. When he arrived, a Bidayuh uprising was in progress against the Sultan of Brunei, who ruled Sarawak at that time. He helped to induce a peaceful settlement to the uprising and was granted the title of Rajah by the Sultan; thus becoming the first White Rajah.

Don't forget that more pictures of my journey are available online at my Flickr Photostream: http://www.flickr.com/photos/28808691@N05/

Sunday, February 1, 2009

Arrival in Borneo!

The first thing that I noticed when coming to Malaysia from Australia was the tropical weather. It hasn’t been extremely hot by Australian standards; maximum temperatures have been around 38°C. However, the humidity has been close to 100% during this first part of my trip. The high humidity means that it’s like living in a sauna. If you sweat, it doesn’t evaporate. The sweat just stays there, soaks your clothes, and makes you feel like you’re wearing a wet-suit. Difficult though it is to spend long hours outside, I've been forcing myself to, and I think that I’m gradually acclimatizing.

My girlfriend and I arrived in the city of Kuching, on the western coast of the island of Borneo, at 11:30 am yesterday. Borneo itself is split among three nations: Indonesia, Malaysia and Brunei. There are two states in the Malaysian portion; Sabah in the south west and Sarawak (of which Kuching is the capital) in the north west.

Literally translated, Kuching means “cat” in the Malay language. There are several cat monuments on traffic islands in the city, some complete with whiskers! The city also hosts many stray cats who seem somewhat more outgoing than those that inhabit Kuala Lumpur.

When we arrived at Kuching Airport yesterday, my girlfriend and I were met by a friend of her family; Mr Pei. We visited Mr Pei’s house to have lunch, and were serenaded by some of the family with an impromptu karaoke performance in Hokkien Chinese. From there, we went on to check in at the Harbor View hotel, situated near the Kuching waterfront on the Sarawak River.

Yesterday afternoon, we were met by another family friend, Uncle Loo, who is a native of Kuching. He took us to visit the weekend market on Jalan Satok (Satok road). Uncle Loo informed us that many of the stall-holders at this market are native river-dwelling people who live further inland than Kuching, and travel to the city only for the weekend market. They sleep on the streets of the market or in their cars. It would be interesting to follow some of these market gardeners back to their homes to see how they live, but that will probably have to wait for a future visit.

Today we visited the Kuching waterfront and collected some supplies for later in the week. We had planned to visit Fort Margherita, which lies across the Sarawak River from Kuching. Unfortunately, though, we caught the wrong boat across the river and landed at a place from which it wasn’t possible to reach the fort. The river boats are very small—maybe 3 m long—and lie low in the water. On the way back to Kuching, the captain of our small boat, with its complement of around 10 passengers, was unable to start the motor, so he paddled the boat by hand across the wide Sarawak River!

Kuching, like much of the rest of Malaysia, has extreme economic juxtaposition. Affluent, western-style shopping centers, complete with Starbucks cafes, are situated beside alleys full of crumbling houses. Dotted among the poorer houses are makeshift mounts for the dishes of satellite TV receivers. New construction work is also happening everywhere.

This year, Kuching has suffered unseasonally-long monsoon rains. The areas surrounding the city have been flooded, and local newspapers have reported that around 800 people have been displaced from their homes due to the flooding. It has rained almost continually since we arrived yesterday, but the city of Kuching itself doesn’t appear to have any flooded areas. We have also not seen any sign of the problems that the flooding has caused, but that may be due to our staying in the most affluent part of the city.

As a caucasian here, I draw some attention as a relative rarity. The Kuching population seems to be comprised of three main groups: native people, Malays, and Chinese. Caucasians are called Gwei Los by the Cantonese-speaking Chinese and Mat Salleh by the Malays.

Finally, this evening, we had dinner at a seafood area near to our hotel. I ate fried fern fronds and various other local vegetarian dishes, which were all very tasty. I eat garlic quite a lot, and the locals here also make very enthusiastic use of it in their cooking.

Tomorrow, we are going to the Sarawak Cultural Centre, and hopefully I will have time to write about it in the evening. Don't forget that more pictures of my journey are online at my Flickr photostream: http://www.flickr.com/photos/28808691@N05