Thilina's Blog

I might be wrong, but…

Getting Started with OrCAD 9.2

This article contains the material I prepared for a presentation I have done at my university. Thorough out this post I will discuss to draw schematic, simulate in time domain and frequency domain and design the PCB for a simple transistor amplifier with covering some of mostly used topics in OrCAD.

Looking Back

Let’s start with the transistor amplifier circuit. Potential Divider biased Class A amplifier. Calculate IB, IC, VCE and VC of following circuit. Take β = 100.


Continue reading

2015 April 20 Posted by | Circuit Design, Electronics, Technology | , , , , | 5 Comments

Build your own MIC1 – IJVM on FPGA 01

It’s the “DSD time” at the Department of Electronic and Telecommunication in University of Moratuwa. Just to give the idea; DSD aka Digital System Design is one of most challenging yet interesting modules which offered to the semester 5 undergraduates of the department. In this module they have to develop some RTLs by themselves and as in groups and deploy them into FPGAs as their Individual and Group Projects. When I was an undergraduate same module was taught us in Semester 7(Old Curriculum) and we studied a lot on Processor Architecture with the basis of IJVM (MIC1,2,3 architectures) and at the final semester we got another exam free module called “Advanced Digital System Laboratory” in which we had to implement a stack based processor as its project.

In this article series I am going to share my experience and thoughts on what we did, how can be done the implementation of your own IJVM on FPGA. We will start this article series by brain storming the following,

  • · What are the components/modules require
  • · What are the data/address bus sizes?
  • · Memory depth?
  • · What are the ALU operations in interest?
  • · What are the instructions?

As for the reference of this implementation, I use PIC16F84 datasheet, concepts of Z80 processor demonstration kit and ‘Structured Computer Organization’ by Tanenbaum. Therefore the design will be inspired by some qualities and properties of PIC16F84 and Z80.

Continue reading

2014 June 22 Posted by | Electronics, FPGA, MIC1 IJVM, Technology | 2 Comments

Symbolic Integration and Differentiation using MATLAB

While messing with MATLAB during free time I have found the method (thanks to MATLAB documentation) of performing symbolic integration and differentiation using MATLAB. And also the proper way to display a function in MATLAB command line. In this small article I am going to share my experience on symbolic integration and differentiation using MATLAB.

Representing a function as reader friendly format

Take an example function f(x) as,


We can input our function to MATLAB as follows.


You can clearly see that ‘x’ is a symbolic object and f(x) is a symbolic function. Say If you need to evaluate f(x) at x = 10; that is f(10) then it’s simply;


However this equation and answer representation is bit annoying. Therefore by using the command ‘pretty’ we can display this in more readable format in MATLAB command line.


Now let’s have a look how the symbolic differentiation is performed.

Continue reading

2013 December 15 Posted by | MATLAB | , , , , , , , | Leave a comment

Process spatial operations without ‘for’ loops in MATLAB

While working on some image enhancement applications which the intensity of a given pixel is also a function of its location (spatial coordinates), I used to use ‘for’ loops to iterate each pixel at once and calculate its intensity based on (x,y) value obtained from those two ‘for’ loops. This is very annoying since it takes quite some time to process two ‘for’ loops as well as it is a belief that the MATLAB ‘for’ loops are used to slow. In this article I share my experience how I avoided the requirement of two ‘for’ loops by using the properties of complex numbers for a photo effect which I described in a previous article of mine.

Normally in an image there is an mxnx3 matrix which represents red, green and blue intensities respectively. In my case I append another 4th matrix of coordinates which makes the image matrix as mxnx4. (Even-though there is a memory drawback in this design, it is very easy to handle rather than two nested ‘for’ loops).

This 4th matrix contains complex numbers which their real value is equal to row index and its imaginary value is equal to its column index. And now we do have another advantage. Using the properties of complex numbers we can easily calculate the distance and angle between two pixels in interest which is very useful in image effects such as ‘focal BW’.

Continue reading

2013 October 18 Posted by | Image Processing, MATLAB | , , , , | 1 Comment

Serial PORT MATLAB – Getting Started

Serial port is a physical communication interface which transfer one bit at a time in contrast to parallel port. In the recent past, before USB serial port communication is the most famous communication medium for many computer peripherals such as mouse, keyboard, Etc. Still in many embedded development environments use serial port communication as data transmission interface.

When it comes to my field of interest, where developing embedded systems, mostly signal processing applications, I wanted to visualize and to do some tweaks to processed data to verify whether my application works properly or not. In this case normal serial port desktop applications does not allowed me to visualize what I needed except the application ‘Serial Chart’. Therefore as usual I ended up with a MATLAB solution that is serial port communication with MATLAB. In this article I will share my experience in sending data and receiving data with interrupts in serial port with MATLAB.

Continue reading

2013 August 25 Posted by | Biomedical, Electronics, MATLAB | , , , , , | 4 Comments

Photo Effects using MATLAB 3.0 – Image warping using MATLAB – Fisheye Similar Effect

The term fisheye was coined in 1906 by American physicist and inventor Robert W. Wood based on how a fish would see an ultra-wide hemispherical view from beneath the water (a phenomenon known as Snell’s window) (Wikipedia). I tried several domain transformation functions to create the fisheye effect and ultimately I ended up with warping an image into a circle which gives somewhat similar result to the fisheye effect. In this article I am going to share my experience on warping an image in to a circle (fisheye effect, my version).

Here is an example of correct fisheye effect.


Continue reading

2013 April 22 Posted by | Image Processing, MATLAB | , , , | 3 Comments

Setting up VTK and ITK environments for Ubuntu

Visualization Toolkit which is known as VTK is an open source software system for image processing, visualization and 3D computer graphics which is also vastly used in biomedical image processing and visualization. VTK is mainly consists of C++ class library and several interpreted interface layers. ITK is Insight Segmentation and Registration toolkit which is also open source and a cross platform which provides an extensive software tools for image analysis. In this article I am going to share my experience on how to install VTK and ITK environments on Ubuntu.

Continue reading

2013 February 9 Posted by | Biomedical, C++, Image Processing, ITK, Ubuntu, VTK | , , , , | 8 Comments

MATLAB plotting tools 1.0 – ‘plot’ command

Data visualization is a main requirement in Image and Audio signal processing, since it can be used to identify special features, intermediate results, process states as well as the correctness of the final results. Data plotting is one way of data visualization which used in very common by all MATLAB users. However the selection and handling of plot for the requirement is a critical factor since the whole representation of the data is depends on the tool we choose to visualize it. In this article (or maybe a set of articles) I am going to share my experience and suggestions on using MATLAB plotting tools.

plot Command

The command ‘plot’ is the most widely used data visualization tool which will create a 2D line plot on a MATLAB figure. Say you are having a data set called ‘y’ based on values ‘x’, you can simply visualize them using the plot command as follows.

x = 0:0.001:100; % x is the array of 0 to 100 with 0.001 intervals
y = sin(0.05*pi*x); % y is the sine value array of x

After this command plot will be drawn in a MATLAB figure as follows;


Continue reading

2013 February 1 Posted by | MATLAB | , , , | 4 Comments

Connecting Digilent ATLYS board with Xilinx iMPACT

In my previous article I discussed how to setup MATLAB for hardware co-simulation with Digilent Atlys FPGAs. Since Electronic undergraduates in level 3 and level 4 at University of Moratuwa (where I belong) are rushing through their Digital System Design individual and group projects and most of the use Atlys Spartan 6 FPGA as their development platform, I am going to put this quick post so that can help them with their projects. In this article I am going to share my experience on setting up Xilinx for Detect Digilent USB cable.

Continue reading

2012 September 27 Posted by | Electronics, FPGA, Technology | , , , , | 1 Comment

Setting up MATLAB with Atlys Spartan 6 FPGA for Hardware Co-simulation

In my previous articles I discussed how to perform a hardware co-simulation using MATLAB, by using Digilent Atlys Spartan 6 FPGA development kit. But many of my colleagues had the problem of setting up MATLAB for Hardware co-simulation. With a help of a friend of mine, we managed to configure MATLAB for hardware co-simulation. In this short article I am going to share my experience on setting up MATLAB for hardware co-simulation with Atlys Spartan 6 Development Kit.

Continue reading

2012 September 26 Posted by | Electronics, FPGA, MATLAB, Technology | , , , , | 9 Comments

%d bloggers like this: