Search This Blog

Showing posts with label 8051. Show all posts
Showing posts with label 8051. Show all posts

Wednesday, November 25, 2015

CC2531 Zigbee USB Dongle

CC2531 USB Evaluation Module Kit ကိုသုံးပြီး wireless communication လုပ်ကြည့်တဲ့ အကြောင်းလေးပါ။ သူ့ရဲ့ website ကိုသွားပြီး CC USB Firmware Library and Examples ဆိုတဲ့ zip ဖိုင်ကို download လုပ်လိုက်ပါတယ်။ ဖိုင်ကိုဖြည်ပြီးတဲ့ အခါ Doc folder ထဲက CC USB Software Examples User’s Guide ထဲမှာ နမူနာပြထားတဲ့ USB RF Modem Example ကို စမ်းကြည့်ခဲ့ပါတယ်။

CC2531 Zigbee Wireless USB Dongle

Tuesday, November 24, 2015

Wireless Communication using CC2530 Zigbee Wireless MCU

CC2530 က IEEE 802.15.4 နဲ့ Zigbee တွေအတွက် RF transceiver နဲ့ 8051 MCU ကို ပေါင်းစပ်ထားတဲ့ system-on-chip (SoC) solution တခုပါ။ သူ့ကို သုံးပြီး wireless module စမ်းလုပ်ဖို့ အတွက် CC2530EM Evaluation Modules နှစ်ခု၊ SmartRF05EB Evaluation Boards နှစ်ခု၊ နဲ့ CC2531 USB Dongle တခုပါတဲ့ CC2530DK devolopment kit ကို ဝယ်တာ USD 400 လောက်ပေးရပါတယ်။ သူတို့နဲ့ သုံးဖို့အတွက် TI ရဲ့ ဝက်ဘ်ဆိုက်မှာ အလကားပေးတဲ့ SmartRF Studio ကို စက်ထဲမှာ install လုပ်ပါတယ်။

CC2530DK

Thursday, September 10, 2015

Accelerometer LIS3DSH

LIS3DSH က STMicroelectronics ထုတ်တဲ့ 3-axis MEMS accelerometer တခု ဖြစ်ပါတယ်။ Full scale ကို ±2g ကနေ ±16g ထိ အမျိုးမျိုးရွေးလို့ ရပါတယ်။ အရွယ်အစားက လည်း 3mm x 3mm ပဲမို့ သေးသေးလေးပါ။ Digital output ကို SPI ဒါမှမဟုတ် I2C ကြိုက်တာသုံးလို့ရပါတယ်။ Supply voltage က 1.71 V ကနေ 3.6 V ထိပေးလို့ ရပါတယ်။ STEVAL-MKI134V1 adapter board လေး တခုဝယ်ပြီး စမ်းကြည့်ထားတဲ့ အတွေ့အကြုံ လေးအကြောင်း ပြောချင်ပါတယ်။


Figure. STEVAL-MKI134V1 - LIS3DSH adapter board for standard DIL24 socket.

Saturday, June 29, 2013

Using Analog to Digital Converter of AT89C51CC01 Microcontroller

AT89STK-06 starter kit ကိုသုံးပြီး 8051 microcontroller တစ်ခုဖြစ်တဲ့ AT89C51CC01 အတွက် analog to digital converter (ADC) အဝင် ကိုဖတ်တဲ့ C ကုဒ် တစ်ချို့ကို ရေးထားပါတယ်။ အဲဒီ မိုက်ခရို ကွန်ထရိုလာ မှာ 10 bit resolution ရှိတဲ့ multiplexed လုပ်ထားတဲ့ အဝင် ၈ ခုရှိပါတယ်။ ဒီနမူနာမှာ variable resister နဲ့ ဆက်ထားတဲ့ အဝင် ပင်နံပါတ် ၇ ကို ဖတ်ကြည့်ထား ပါတယ်။

Tuesday, August 18, 2009

SDCC - Small Device C Compiler

SDCC - Small Device C Compiler က အလကား ရနိုင်တဲ့ free open source C compiler ပါ။ သူက 8051 နဲ့ အခြား microcontroller အချို့အတွက်ပါ။ SDCC လို အလကား မဟုတ်ပဲ ပိုက်ဆံ ပေးဝယ်ရတဲ့ အခြား Keil တို့လို compiler တွေလဲ ရှိပါတယ်။ အဲဒီမှာ free evaluation version ကိုရနိုင်ပေမယ့် အစမ်းသဘော အတွက်ပဲ ရည်ရွယ်ပြီး code size ကို 2k byte ထက် ပိုသုံးလို့ မရအောင် ကန့်သတ်ထားပါတယ်။ SDCC ရဲ့ကောင်းတဲ့ အချက်ကတော့ ပိုက်ဆံ တစ်ပြားမှ မကုန်ပဲ အလကား ရနိုင်တာပါ။ ဒီမှာ ပြောမှာ ကတော့ SDCC manual ကို အကျဉ်းချုံး ထုတ်နုတ်ပြော တာပါ။

Installing
http://sdcc.sourceforge.net/ ကိုသွားပြီး setup program ကို download လုပ်နိုင်ပါတယ်။ နောက် setup program ကို Run ပါ။

Testing the SDCC Compiler
နောက် command prompt ကိုသွားပြီး compiler အလုပ် လုပ်မလုပ် စမ်းကြည့်ဖို့ "sdcc -v" ကို enter လုပ်ပါ။ SDCC ကသူ့ရဲ့ ဗားရှင်း နံပါတ်ကို reply ပြန်တာ ကို တွေ့ ရပါလိမ့် မယ်။

Example C Program
အောက် ပါ နမူနာ program ကို စိတ်ကြိုက် ASCII editor တစ်ခုခု သုံးပြီး ရိုက်ပါ။ ထို့နောက် led.c အမည်ဖြင့် သိမ်းပါ။ Eclipse အစရှိတဲ့ development IDE တွေသုံးလို့ လဲရပါတယ်။ အဲဒီ အကြောင်း ကြုံရင် ပြောပါမယ်။ ဒီနမူနာ က 8051 microcontroller ရဲ့ P3.4 pin ကိုဆက်သွယ်ထား တဲ့ LED ကို မှိတ်တုပ် မှိတ်တုပ် အဖွင့် အပိတ် လုပ်ပေးဖို့ ပါ။
#include<8052.h>
void main()
{
int i;
while(1)
{
P3_4=0;   //Output 0
for(i=0;i<30000;i++);  //delay loop
P3_4=1;   //Output 1
for(i=0;i<30000;i++);  //delay loop
}
}


Compiling and Getting Hex File
command prompt မှာ ဖိုင် led.c ရှိတဲ့ နေရာကို သွားပြီး "sdcc led.c" ကို enter လုပ်ပါ။ အားလုံး အဆင်ပြေရင် အမှား မတက်ပဲ led.ihx ဆိုတဲ့ဖိုင် ထွက်လာပါမယ်။ "dir" ကို enter လုပ်ပြီး အဲဒီဖိုင် ထွက်မထွက် ကြည့်နိုင်ပါတယ်။ နောက် သင့်ရဲ့ chip ထဲကို download လုပ်ဖို့ သင့်တော်တဲ့ intel hex file ရအောင် "packihx led.ihx>led.hex" ကို enter လုပ်ပါ။ ထွက်လာတဲ့ led.hex ကို သုံးလို့ ရပါပြီ။

Projects with Multiple Source Files
SDCC က တစ်ကြိမ်မှာ တစ်ဖိုင် ပဲ compile လုပ်ပေးနိုင်ပါတယ်။ ဥပမာ main.c blink.c ဆိုတဲ့ ဖိုင်တွေရှိ တဲ့ project ကို စမ်းဖို့ အောက်ပါ အတိုင်း ရိုက်ထည့်ပြီး ဖိုင် များကို ဖန်တီးပါ။
//File name: main.c
#include "blink.h"
void main()
{
while(1)
{
toggle();
delay();
}
}


//File name: blink.c
#include <8052.h>
#include "blink.h"
void toggle()
{
P3_4^=1;
}
void delay()
{
int i;
for(i=0;i<30000;i++); //delay loop
}


//File name: blink.h
void toggle();
void delay();

main() function မပါတဲ့ ဖိုင်များကို "sdcc -c blink.c" ဆိုတဲ့ command သုံးပြီး သပ်သပ် compile လုပ်ပါ။ နောက် main() function ပါတဲ့ ဖိုင်ကို နောက်ဆုံးမှ "sdcc main.c blink.rel" ဆိုတဲ့ ပုံစံ အတိုင်း compile လုပ်နိုင်ပါတယ်။ main.ihx ဆိုတဲ့ ဖိုင်ထွက်လာမှာ ဖြစ်ပြီး ထုံးစံ အတိုင်း main.hex ကို ရယူ အသုံးပြု နိုင်ပါတယ်။