Violin Iliev's blog and homepage

14Dec/092

Communicating with TSL202R

Last time I talked about my USB device that I’m creating. I’ve connected the TSL202R Linear Array Photodiode sensor. It has 128 photodiodes(pixels) that tells us how much light there is on each one of them. This is very useful. It can be used for example for OCR, measuring the angle of a light source etc. I’m interesting in measuring the dimensions of object. It’s actually a simple method. Take a look at this figure:

How to measure object dimensions

We have a source of light then an optic system and the sensor. When we put an object in front of the light we get his shadow on the sensor. By measuring the size of the shadow we can calculate the size of the object.

Here’s how the sensor looks like and a simple result of it’s output in my application:

TSL202R graf1

7Dec/090

USB HID Device

This weekend I've managed to create my first USB device. It's a simple board with the PIC18F4550 microcontroller. It gets detected from Windows as HID device and works properly. I can send data to it and read information back. Tried the ADC and it works fine. I still have to make some test on the speed of the transfer but for my needs it's more than enough. I used the Microchip USB Bootloader and modified it a bit to work with the free version of C18 compiler. And so the device is able to update/program it's firmware/memory using the PC thought USB. So no need for my programmer for now. There is a design fault in the pictures below. The big capacitor over there under the LED is too big and the device was not working properly. I have now changed it with a 100nF capacitor and everything is fine.

So here are some pics:

6Nov/090

Random numbers in C++

int GetRandomNumber() {
return 4; //chosen by fair dice roll. guaranteed to be random.
}

:D

Filed under: Fun, Programming No Comments
14Jun/082

Cross-compiling windows applications under Linux with Wine and DevC++

Cross-compileSince I'm trying to switch to Linux(Ubuntu) as my primary OS and since I had some stuff I really need to do under Linux, I had to find alternative applications for my activities. Well I don't play games much so this wasn't a big problem. I mainly do all stuff of programming and there are plenty of development tools for Linux. The big problem was a project I am working on witch is based on some Windows API calls. The IDE used for the project is DevC++. So I tried to install it under Linux and see if it could compile. I installed the last Wine version (1.0-rc5) and installed DevC++ under it. Everything went fine. I created a new empty console project and it compiled fine. However my project didn't compile at all :( . The IDE said that "windres.exe" failed with an strange error number. There was no way to make "windres.exe" work under WINE, so I decided to look for some alternative free Resource compiles. I came across GoRC by Jeremy Gordon. However it's command line arguments are different form windres' one so I had to write a wrapper. The wrapper takes the command line arguments that are passed to "windres" and then translates them and call GoRC. So I made a quick console project in DevC++(under wine) and created a simple wrapper. Then all I had to do is override the real "windres.exe". However things didn't went as expected. It turned out that "windres" produces COFF files which are then send to the linker but GoRC can only produce RES or OBJ files. I tried with the OBJ files but it was not the same COFF format. I was once again stuck. As I was searching for more info I found that "windres" can convert RES files into COFF files. I tried "windres" with a RES file and it successfully made a COFF file. It is not working well with RC->COFF, but it's working fine with RES->COFF. So I made some changes to the wrapper. It first creates a RES file with GoRC and then convert it to COFF using "windres". Guess what - IT IS WORKING!. I was able to compile my first Windows application with 2 RC files and everything went fine. However there are some problems. I tried another project and GoRC said that it could not find "windows.h" which is included in one of the RC files. So I had to copy that file to my project main directory and build went with no errors. The debugger is also working, with some problems, but it didn't worked well under windows either.
So finally I have a cross-compile environment and I can compile my applications for windows from Ubuntu :)
If you have the same problems you could try my wrapper and the GoRC utility. You can download them with the source of the wrapper(very mixed and non commented code :) ) here;
Just copy "windres.exe", "GoRc.exe" and "windres_real.exe" into your MinGW bin folder and override the files that exists. In my case the path is: "~/.wine/drive_c/Dev-Cpp/bin"

15Apr/080

Adobe Flex 3 – First steps

FlexI'm exploring new products and technologies. I started learning Adobe Flex 3 which is a very good RIA framework based on ActionScript3 and can produce SWF files that can run on any PC with Adobe Flash 9.
My first application is a simple blog reader witch takes an RSS feed and gives you the ability to view recent posts.

You can test the application here.

13Apr/081

“Hide My Window” Tool

Hide My Window
Today I wanted to start/create a Linux server over my Vista PC. So I had to install VirtualBox and setup Ubuntu over it. I did all the configurations so the web server inside the VM was visible to the world. But I found one problem. When I start the VM it shows a Windows with it's screen and also appears on the task bar. I didn't find any option to run the VM in somesort of background mode. But I wanted to hide it so I googled for a tool that could to that. Well I found some applications but they are not free....
What I'm saying is that I've written a tool that show all windows on the OS and gives you the option to hide them form being visible (even form the taskbar).
You can download the tool I've written today here

17Jan/08Off

My “Dark GDK” experience

Well I made a quick test of the Dark GDK.


It is very very easy for total beginners even for those starting programing right know. However I'm not going to use it because it doesn't gives me enough freedom. It's a game engine not a 3D engine. As a game engine it has some build-functions and you are mostly limited to them. For example you can't create your own mesh format and write an import plugin. I've found no functions on creating complex Meshes at runtime. You must create them in separate 3d modeling application. For example I wasn't able to make  simple polygon and show it on the screen. There are some basic primitives included like: planes, boxes, pyramids, sphere etc.


So I guess I'll stick with Irrlicht for now. Irrlicht is object oriented, more powerful, faster, free and open source and it's easy to extend.


The fact that I don't like Dark GDK doesn't makes it a bad library. It's a complete game engine witch will involve you into game making fast without having to worry about sounds, collisions, network, file loading operations etc. And it's very easy too.


Here is a sample code for creating a box on the screen:

#include "DarkGDK.h"
void DarkGDK (void){
  dbSyncOn();
  dbMakeObjectBox(0,100,100,100,100);
  while (LoopGDK()){
    dbSync();
  }
  return;
}



PS: Comments are disabled on this page due to spam!

16Jan/082

Dark GDK for free…

Visual studio 2008 Express + Dark GDK

In my little free time today I decided to go check if MS has something new to offer with theirs VS Express Editions. First I found that there is VS 2008 Express Edition already avaliable. I'm a big fan of Delphi but since they haven't updated their Turbo editions and since they are more limited I decided that I should turn to Visual Studio. Well MS - you won ;(

However what really was the big and nice surprise for me is that VS 2008 Express ships with a free version of Dark GDK. A nice and easy 3D framework for game making. I've always wanted to test Dark GDK but it was too expensive for me to afford.

You can find VS 2008 Express here and Dark GDK here.

I'll post more on my Dark GDK experiense later. :)