Search This Blog

Showing posts with label System. Show all posts
Showing posts with label System. Show all posts

Friday, June 11, 2010

Circular Buffered UART Com Module for 8051 Microcontroller

Embedded system အများစု မှာ UART communication ကို သုံးကြပါတယ်။ ဒါကြောင့် ကျွန်တော် ရေးထားတဲ့ circular buffered UART comm module လေးကို ဒီမှာ ဖော်ပြချင်ပါတယ်။ သူ့ကို 8051 microcontroller အတွက် ရေးထားတာ ဖြစ်ပေမယ့် တစ်ခြား microcontroller တွေ အတွက်ဆိုရင် လဲ အလွယ်တစ်ကူ ပြောင်းသုံးလို့ ရပါတယ်။

Using Circular Buffered UART Com Module

သူ့ကို သုံးချင်တဲ့ module မှာ ထုံးစံ အတိုင်း header file ကြေငြာဖို့ လိုပါတယ်။ ကျွန်တော့် နမူနာ မှာတော့ header အားလုံးကို 'headers.h' ဖိုင်ထဲမှာ စုထားတဲ့ အတွက် အဲဒီဖိုင်ကို ထည့်လိုက်ရုံ ပါပဲ။
ပို့ဖို့၊ လက်ခံဖို့ အတွက် buffer အရွယ်အစားတွေကို ComConfig.h မှာ သတ်မှတ် နိုင်ပါတယ်။ အဲဒီမှာပဲ ဒေတာ လက်ခံရရှိတဲ့ အခါ ခေါ်ချင်တဲ့ function ကို သတ်မှတ်နိုင်ပါတယ်။
main function ထဲမှာ buffer ထဲမှာ ဒေတာ တွေ ရောက်နေ မနေ စစ်ဖို့ ComChkRx() function ကို poll လုပ် နိုင်ပါတယ်။
နမူနာ source code ကို

UART-Timer-8051 on GitHub

မှာရယူ နိုင်ပါတယ်။

Sunday, February 1, 2009

FAT32 Format

ကျွန်တော့် removable hard disk ကို Windows ရော Linux စက်တွေမှာပါ သုံးချင်ပေမယ့် ပြဿနာက Linux မှာ NTFS ကသုံးလို့မရ၊ Windows XP မှာကျတော့ FAT32 နဲ့ format ချလို့မရပြန်။ "format x: /fs:fat32" command ကို Windows XP မှာ သုံးတော့ ကျွန်တော့် removable hard disk က 32 GB ထက်ပိုကြီးလို့ မရဘူးတဲ့။ အကြာကြီးစောင့် ပြီးမှ error message နဲ့ အဆုံးသတ်သွားတယ်။ Windows Vista မှာပါတဲ့ FAT32 နဲ့ format ချကြည့် တော့လည်း အဲဒါကြီးက Linux မှာအလုပ် မလုပ်ပြန်ဘူး။ နောက်ဆုံးတော့ fat32format.exe ဆိုတဲ့ freeware program သေးသေးလေးနဲ့ အလုပ်ဖြစ်သွားတယ်။ တော်တော်မြန်ပြီး သုံးရလွယ်တယ်။ Drive X ကို format ချ ဖို့ "fat32format X:" ဆိုတာလေး ရိုက်လိုက်ရုံပဲ။ FAT32 သုံးခြင်းအား ဖြင့် တစ်ခြား Mac, Linux, အစရှိတဲ့ operating systems တွေမှာပါ အဲဒီ disk ကို သုံးလို့ ရသွားပါတယ်။

Sunday, November 23, 2008

Introduction to Squid

Squid က free open source caching proxy software ဖြစ်ပါတယ်။ Squid binaries for Windows ကို http://squid.acmeconsulting.it/ မှာ download ယူနိုင်ပါတယ်။

Installing

ဒီနမူနာမှာတော့ squid-2.7.STABLE5-bin.zip ဖိုင်ကို download လုပ်ပြီး extract လုပ်ခဲ့ပါတယ်။ နောက် "squid" directory ကို C drive ထဲမှာ "C:squid" အနေနဲ့ copy ကူးလိုက်ပါတယ်။ နောက် "C:squidetc" directory ကိုသွားပြီး အောက်ပါဖိုင်များကို copy ကူးပြီး rename လုပ်လိုက်ပါ။
squid.conf.default ==> squid.conf
mime.conf.default ==> mime.conf
cachemgr.conf.default ==> cachemgr.conf
နောက် squid.conf ကိုလိုသလို edit လုပ်နိုင်ပါပြီ။ ဒီနမူနာမှာတော့ ဘာမှမပြောင်းပဲ default အတိုင်းထားခဲ့ပါတယ်။
Windows start menu ကိုဖွင့်ပြီး Start->Run ကိုသွားပါ။ ထို့နောက် "cmd" ကိုထည့်ပြီး OK ကိုနှိပ်ရင် "Comman Prompt" windows တက်လာပါမယ်။ "squid.exe" program ရှိတဲ့ sbin folder ကိုသွားဖို့ အောက်ပါအတိုင်း command prompt မှာရိုက်ထည့်နိုင်ပါတယ်။
cd C:squidsbin
ဝင်းဒိုး service ကို install လုပ်ဖို့ command format ကတော့ "squid -i [-f configfile] [-n servicename]" ဖြစ်ပြီး servicename က Squid service ရဲ့နာမည်တစ်ခုခုနဲ့ configfile က configuration file ဖြစ်ပါတယ်။ (ဘာမှမထည့်ရင် configfile က "c:/squid/etc/squid.conf" လို့ယူဆမှာဖြစ်ပြီး servicename က "Squid" လို့ယူဆမှာဖြစ်ပါတယ်။) ဒီမှာတော့ servicename ကို squid နဲ့ configfile က C:squidetcsquid.conf ဖြစ်တဲ့အတွက် ထောင့်ကွင်းတွေထဲက optional arguments တွေကိုမထည့်လဲရပါတယ်။ Path ကိုပြောတဲ့အခါ '' ကိုမသုံးပဲ '/' ကိုသာသုံးပါ။ အောက်ပါတို့ကိုရိုက်ထည့်ပါ။
squid -i -f c:/squid/etc/squid.conf  -n squid
ထို့နောက် cache directories များဖန်တီးရန်အောက်ပါအတိုင်းရိုက်ထည့်ပါ။
squid -z -f c:/squid/etc/squid.conf

Squid servicename service command line ကို Windows Registry တွင်ထည့်ရန်အောက်ပါအတိုင်းထပ်ရိုက်ထည့်နိုင်ပါတယ်။
squid -O servicecommandline  -n squid

ထို့နောက် "Start->Control Panel->Administrative Tools->Services" ကိုဖွင့်၍ "squid" service ကို start လုပ်ပါ။ Squid proxy server က default အနေနဲ့ဆိုရင် port 3128 ကို listen လုပ်ပါတယ်။

Client Side Setting

Client machine ရဲ့ proxy server သုံးချင်တဲ့ browser မှာလဲ proxy settings တွေကို တနည်းနည်းနဲ့ configure လုပ်ဖို့လိုပါတယ်။ ဒီမှာတော့ Mozilla Frefox ကိုသုံးပြီးနမူနာပြထားပါတယ်။ Firefox browser ရဲ့ Tools menu -> Options... command -> Network tab -> က connection frame ထဲက Settings... button ကိုနှိပ်ပြီး proxy server ရဲ့ address နဲ့ port (3128) တို့ကိုထည့်ပါ။

Linux စက်တွေမှာတော့ squid ကို transparent proxy အနေနဲ့တိုက်ရိုက်သုံးလို့ရပါတယ်။ Windows စက်တွေမှာတော့ အဲဒါက known limitation အနေနဲ့ ရှိနေတုန်းပါပဲ။ (Transparent Proxy: missing Windows non commercial interception driver) လို့ဖော်ပြထားတာ တွေ့ရပါတယ်။