Compiling a V-USB (AVR-USB) example program with Visual C++
সাজিদ মুহাইমিন চৌধুরী কর্তৃক এ.ভি.আর, টিউটোরিয়াল, মাইক্রোকন্ট্রোলার এ প্রকাশিত - আগস্ট ২৫৩৯;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪;, ২১ শ্রাবণ ১৪১৭
Well, I used MinGW / MSYS to compile some AVR-USB programs when I was working for IICT. Setting up MinGW is in windows is extremely tedious, especially if you live in a country where 30kBps download speed is considerably high. The offline installation of MinGW is equally confusing. I was considering an alternate development environment for windows, and Visual C++ can be considered as a great option.
Some of my students today visited me with some problems compiling a V-USB commandline example. Although I managed to solve it, I had to do it with considerable amount of hacks to the v-usb libraries. They were using visual C++ version 6. Now I am going to show some steps to compile an example of V-USB from Microsoft Visual C++ 2010 Express Edition.
Both online and offline installer for Visual C++ express edition is available from the website. The express edition is free to download and use for evaluation and education: http://www.microsoft.com/express/downloads/
In case you don’t know yet, v-usb can be downloaded from obdev’s website at: http://www.obdev.at/products/vusb/download.html
To set up the VC++ environment, you’ll also need libusb-win32 drivers. Download them from: http://sourceforge.net/projects/libusb-win32/
For this blogpost, I am using these files:
vusb-20100715.tar.gz
libusb-win32-bin-1.2.1.0.zip
downloaded from the respective sites, and the latest version at the time of writing this blogpost. I’ve also downloaded and installed Microsoft Visual C++ 2010 Express edition.
I am using 32 bit version of Windows 7, with intel processor. If you use 64 bit version of windows or AMD processor, you have to select apropriate libraries.
Open the libusb-win32-bin-1.2.1.0.zip with 7-zip and extract contents of folder libusb-win32-bin-1.2.1.0.zip\libusb-win32-bin-1.2.1.0\lib\msvc\ to C:\Program Files\Microsoft Visual Studio 10.0\VC\lib , (note, the library folder to be copied for 64 bit version is msvc_x64). Also extract the content of libusb-win32-bin-1.2.1.0\include\ to C:\Program Files\Microsoft Visual Studio 10.0\VC\include
Read this file: libusb-win32-bin-1.2.1.0\bin\libusb-win32-bin-README.txt to know how to install the bin folder content.
Open Microsoft Visual Studio Express edition, and create a new Win32 Console Application Project using the wizard. Use all default settings of wizard.
Now, using windows explorer, open the folder where the project is created using the wizard. My project title is ledcomm. By default, it will be in \Documents\Visual Studio 2010\Projects\ledcomm\ledcomm
Open the vusb-20100715.tar.gz and browse to this folder:
Copy the contents of commandline folder into the folder where you created the project (X:\Documents\Visual Studio 2010\Projects\ledcomm\ledcomm). The folder should now look like:
Copy the folder “firmware” vusb-20100715.tar\vusb-20100715\examples\custom-class\ to X:\Documents\Visual Studio 2010\Projects\ledcomm\ (note: it is one level up the folder where we copied command line). You can use this folder to create a AVR studio project later.
In the project explorer, remove all source and header files from the project:
Now add the following source files and header files to the project
ledcomm\set-led.c
ledcomm\opendevice.h
ledcomm\opendevice.c
firmware\requests.h
firmware\usbconfig.h
The project explorer window now looks like this:
Go to project properties and check if the Pre Compiled header is disabled:
At this point, if you hit F5 (Run), you’ll get this debug result:
1>—— Build started: Project: ledcomm, Configuration: Debug Win32 ——
1> set-led.c
1>X:\documents\visual studio 2010\projects\ledcomm\ledcomm\set-led.c(84): warning C4013: ‘strcasecmp’ undefined; assuming extern returning int
1> opendevice.c
1> Generating Code…
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_control_msg referenced in function _usbGetStringAscii
1>set-led.obj : error LNK2001: unresolved external symbol _usb_control_msg
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_get_string_simple referenced in function _usbGetStringAscii
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_close referenced in function _usbOpenDevice
1>set-led.obj : error LNK2001: unresolved external symbol _usb_close
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_strerror referenced in function _usbOpenDevice
1>set-led.obj : error LNK2001: unresolved external symbol _usb_strerror
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_open referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_get_busses referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_find_devices referenced in function _usbOpenDevice
1>opendevice.obj : error LNK2019: unresolved external symbol _usb_find_busses referenced in function _usbOpenDevice
1>set-led.obj : error LNK2019: unresolved external symbol _strcasecmp referenced in function _main
1>set-led.obj : error LNK2019: unresolved external symbol _usb_init referenced in function _main
1>X:\documents\visual studio 2010\Projects\ledcomm\Debug\ledcomm.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I just pasted this error message so that people who have a hard time finding a solution quickly hits this page.
Firstly, VC++ doesn’t have strcasecmp, so replace the strcasecmp command with strcmp command. There goes the case insensitivity!
Now project>project properties, Configuration Options>Linker>Input>Additional Dependencies
Click on the additional dependency box and click on <Edit…>
In the additional dependencies dialogue, type in libusb.lib. Then press ok, and again ok from the properties dialogue.
Now Press F7 to build the project.
1>—— Build started: Project: ledcomm, Configuration: Debug Win32 ——
1> set-led.c
1> ledcomm.vcxproj -> x:\documents\visual studio 2010\Projects\ledcomm\Debug\ledcomm.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Now you can run the created exe file:
In this way, you can use Visual C++ 2010 Express Edition to compile the
Recover your Pendrive folders from the BronTok virus attack
সাজিদ মুহাইমিন চৌধুরী কর্তৃক বিবিধ এ প্রকাশিত - জুন ২৫৩৭;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪;, ২০ জ্যৈষ্ঠ ১৪১৭
Perhaps the most notorious virus that is spreading through all computers in bangladesh is the Win32 Brontok virus. It is possibly the sole reason that many people chose to switch to a Windows 7.
The virus is updating itself. Back in early days, it used to create a New Folder.Exe file and make the exe icon identical to the folder icon of windows. Unsuspecting user would double click, and his PC would be instantly infected. Now improved versions of this virus causes the task manager, folder options to disappear. The “Show Hidden files and folders” also does not work. Most annoyingly, the recent version of the virus locks all folders of the pendrive as hidden, and you cannot make them unhidden even from windows 7 folder options.
To fix such a pendrive, I created a batch file. It removes the folder lock and unhides all the hidden folders in your pendrive. The batch then deletes all exe files in the root directory (So please don’t mistakenly keep any installers in root folder of pendrive.), Finally it deletes the autoexec.bat file causing the virus. Just keep the batch file in your pendrive, and double click on a non infected PC to recover folders.
THe code of the batch file:
rem Created by Sajid Muhaimin Choudhury Echo off attrib -S -H -R /S /D del *.exe del autoexec.bat /F /S /Q del killvirus.vbs /F /S /Q mkdir autoexec.bat mkdir killvirus.vbs attrib +R +A +S +H autoexec.bat attrib +R +A +S +H killvirus.vbs Echo on
MATLAB code for Major Minor grouping of students of Dept of EEE, BUET
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ম্যাটল্যাব এ প্রকাশিত - মে ২৫৩৫;২৫৪৩;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪;, ৫ জ্যৈষ্ঠ ১৪১৭
It’s been some time since I joined BUET as a lecturer. Today, we were assigning major and minor topics to students. The assigning process was quite cumbersome and had to be done by hand. In order to automate the process, I wrote a small MATLAB program that can be used to automate the process.
The major minor system of the Dept of EEE is quite simple. Currently, there are 3 major groups and 4 minor groups of the department. Based on decision of BUET Undergraduta Studies (BUGS) there is a maximum number of student per major or minor group. The groups are allocated according to CGPA of the students, and if more students want a particular major group than allowed limit, then students with better CGPA will get more preference.
Any how, I am pasting my program here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | % This program automates creation of major minor list of the students. % Program was written by Sajid Muhaimin Choudhury, Lecturer, Department of % EEE, BUET on 19/5/2010 clc %constants: N_maj_max = 60; N_min_max = 60; N_std = 180; %Execute the program once, then open variable editor to edit rawdata and % paste values from excel, columns are, roll, cgpa, maj_choice 1-4, minor % choice 1-4. %rawdata = [1,2,3,4,5,6,7,8,9,10;4,5,6,7,8,9,10,11,12,5]; rawdata = sortrows(rawdata, -2); %sort according to CGPA std_roll = rawdata(:,1) std_cgpa = rawdata(:,2) std_maj_choice = rawdata(:,3:6) std_min_choice = rawdata(:,7:10) std_maj = zeros(N_std,1); std_min = zeros(N_std,1); count_maj = zeros(1,4); count_min = zeros(1,4); %assign major group according to CGPA. for i = 1:N_std for j = 1:4 if count_maj(std_maj_choice(i,j)) < N_maj_max count_maj(std_maj_choice(i,j)) = count_maj(std_maj_choice(i,j)) +1; std_maj(i) = std_maj_choice(i,j); break; end end end %assign minor group according to CGPA for i = 1:N_std for j = 1:4 if (count_min(std_min_choice(i,j)) < N_min_max) && (std_min_choice(i,j) ~= std_maj(i)) count_min(std_min_choice(i,j)) = count_min(std_min_choice(i,j)) +1; std_min(i) = std_min_choice(i,j); break; end end end final_result = [std_roll'; std_cgpa' std_maj'; std_min']'; final_result = sortrows(final_result, 1); |
Auto Routing in Single Layer – Proteus Isis and Ares
সাজিদ মুহাইমিন চৌধুরী কর্তৃক পি.সি.বি বিন্যাস এ প্রকাশিত - এপ্রিল ২৫৪০;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪;, ২৩ চৈত্র ১৪১৬
Switched my academic website to webnode
সাজিদ মুহাইমিন চৌধুরী কর্তৃক অশ্রেণীভুক্ত এ প্রকাশিত - এপ্রিল ২৫৪০;, ২৫৩৬;২৫৩৪;২৫৩৫;২৫৩৪;, ২৩ চৈত্র ১৪১৬
As I mentioned earlier, I used Google Sites to maintain my academic website. The google sites is a great choice with unlimited bandwidth of site, but the layout and themes of the site is quite restricted. I was looking for some alternative to that. Weebly posed as an impressive alternative, but wasn’t quite that good. I stumbled upon webnode. It’s interface and default themes are really impressive. Moreover, they allow you to edit the default css of the themes.
This is a custom made theme for my present website, (still teacher.buet.ac.bd/sajid)
The header of the site is taken from a CC website, possibly free web headers or some website.
There is one catch of webnode. Since it earns its revenue by web hosting, the free package comes with only 1GB bandwidth. So, the site is not quite suitable for hosting large files. I’ll try to use some other disk services for the file sharing part. Otherwise webnode is just fine.
Bookmarklet for Google Dictionary
সাজিদ মুহাইমিন চৌধুরী কর্তৃক অশ্রেণীভুক্ত, ওয়েব তৈরি, বৃকমার্কলেট এ প্রকাশিত - ডিসেম্বর ২৫৩৬;২৫৩৭;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩;, ৯ পৌষ ১৪১৬
A reader of my blog was kind to let me know by telephone that he was eager to use Google dictionary with my inline dictionary bookmarklet. So today I am launching the Google version of my bookmarklet. As usual, drag them to your browser bar to use. The English to Bangla dictionary is still being developed, and not that robust.
Google Sites – Home of my academic website
সাজিদ মুহাইমিন চৌধুরী কর্তৃক ব্যক্তিগত এ প্রকাশিত - ডিসেম্বর ২৫৩৬;২৫৩৬;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩;, ৮ পৌষ ১৪১৬
I like wordpress as a blogging environment. And freebeehosting is a as great as a hosting platform can ever be. But for my academic materials, I need a hosting platform that is 24×7 available without any interruption. Google sites seemed to be a good option.
The BUET website management allows to upload 5 files at a time. So all I did was to create an index.html file with iframe set to my google site page.
Google sites give options to rapidly create a website. I edited a default theme to incorporate the BUET logo into the banner. Problem is, you can’t have any custom CSS or javascript code, and if you are logged in, the google icons appear overhead.
Nevertheless, it is where I am hosting all my course related materials.
My BUET page: teacher.buet.ac.bd/sajid
My actual Sites Page: sites.google.com/site/smcbuet/
Update: Some of my friends are also using this technique. I’ll keep link of their sites here:
Raisul - http://teacher.buet.ac.bd/raisulislam (Hosting24)
Shanto – http://teacher.buet.ac.bd/ashfanoor (Google Sites)
Google Brings Indic IME
সাজিদ মুহাইমিন চৌধুরী কর্তৃক সফটওয়্যার এ প্রকাশিত - ডিসেম্বর ২৫৩৬;২৫৩৬;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩;, ৮ পৌষ ১৪১৬
Avro and other phonetic typing software enabled us to forget about memorizing the so called “Bijoy Keyboard”, where h means ba and l means da. Any way, I don’t like their keyboard for one reason: you have to keep pressing the shift key to switch between letters. To me, phonetic typing means I’ll type the pronunciation in English, and computer will understand what I mean. That is when Google Transliteration came. First it started as a browser based text only editor. Then it brought rich text editor support and bookmarklets to support any web based text editor. But it still isn’t enough. I do a lot of typing using windows live writer and Microsoft Word. So I was still somewhat dependent on Ekushey and Avro. Now google has decided to end that misery. Google has launched it’s own version of Ekushey, the Google Indic IME. Imagine what google has to offer:
- Offline Support – No dependency on internet connection.
- Word Completions – Dictionary based word completions for prefixes.
- Personalized Choices – Remember user corrections for personalized service.
- Easy Keyboard – Dictionary enabled keyboard to enter rare and complex words.
- Cool Customization – Customize suggestions page size, display font and more.
Beware, however that Google will be able to access every word you type, so careful what you are typing. Download it from : http://www.google.com/ime/transliteration/index.html Some people may have some difficulty with google update behind a firewall. (Especially my BUET colleagues). For them, here is a direct link to the installer. http://sites.google.com/site/sajiduc/my-files/googlebengaliinputsetup.zip

কতদিন দেখিনা মায়ের মুখ
সাজিদ মুহাইমিন চৌধুরী কর্তৃক সাহিত্য এ প্রকাশিত - নভেম্বর ২৫৩৫;২৫৪২;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩;, ৪ অগ্রহায়ন ১৪১৬
খালিদ হাসান মিলুর গাওয়া অসাধারণ একটি গান|
কতদিন দেখিনা মায়ের মুখ
শুনি না সেই কোকিল নামের
কালা পাখির গান
হায়রে পরান
হায় রে আমার গাঁয়ের বাড়ি
সারি সারি গরুর গাড়ি
মরা নদীর চর
দিঘির জলে হাঁসের খেলা
ঘরের চালে দুপুর বেলা
রঙ্গিলা কইতাম
উঠানে ছরাইনা সোনার ধান
হায়রে পরান
কতদিন ধরিনা ডোবায় মাছ
করি না সেই মরা নদীর
মিঠা পানি পান
হায়রে পরান
হায়রে আমার রাখল মিয়া
কাজলা গরুর গোসল দিয়া
মাঠে নিয়া যায়
বিকাল বেলা বাঁশের বনে
ঝিকি মিকি রোদের সনে
মন মিলাইতে চায়
ভুলিতে পারি না মাটির টান
হায় হায়রে পরান
কতদিন রাখিনা চাঁদের খোঁজ
দেখিনা সেই তারার চকের
মিছা অভিমান
হায় রে পরান
আভিধানিক অর্থ সরাসরি আপনার ব্রাউজারে দেখুন
সাজিদ মুহাইমিন চৌধুরী কর্তৃক বৃকমার্কলেট এ প্রকাশিত - অক্টোবর ২৫৩৫;, ২৫৩৬;২৫৩৪;২৫৩৪;২৫৪৩;, ১৬ আশ্বিন ১৪১৬
আপনি যদি কোন শব্দের আভিধানিক অর্থ পেতে চান, তবে ব্রাউজার উইন্ডোতে সরাসরি তা পেতে পারেন। এই বুকমার্কলেটটি ব্যবহার করুন:
ব্যবহার:
লেখা থেকে কোনও শব্দ নির্বাচন করুন ও Define It! এ ক্লিক করুন। আপনার ব্রাউজার উইন্ডোতে সরাসরি শব্দের অর্থ দেখাবে
![[Bloglines]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/google.png)
![[Twitter]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/twitter.png)
![[Yahoo!]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.sajidmc.net/wp-content/plugins/bookmarkify/email.png)
সাম্প্রতিক মন্তব্যসমূহ