Aug 25 2013

Video

LPC800 getting started with exodusino (arduino like) library


Jan 27 2013

Maple ide with STM32 VL discovery

In the past, ARM processors were notoriously unfriendly in non-professional environments due to proprietary tool chains and unfamiliar instruction sets. Because of this, they were conspicuously absent from classrooms and hobbyists’ workbenches. LeafLabs aims to change this by providing an ARM tool-chain built from open source components and a programming environment that is intuitively easy to use.

image

If you’re familiar with Arduino then you’ll recognize the shape of the board, in fact the Maple is designed to be Arduino compatible and not just at the hardware level! The Maple IDE will make Processing/Arduino programmers feel right at home. By swapping the popular “avr-gcc” compiler with CodeSourcery’s "arm-none-eabi-gcc," LeafLabs manages to provide a nearly identical programming experience to Arduino despite targeting a completely different architecture. Also, while some Arduino shields are incompatible due to certain capabilities being allocated to different pins, several of them are currently supported and there are more to come. There is also a guide available on the product page for porting Arduino libraries and source code over to Maple.

As similar as it may be to the Arduino, the differences are what really make the Maple stand out. It harnesses the power of a 32-bit ARM Cortex-M3 clocked at 72 MHz to push 39 GPIOs, 16 analog pins, 12-bit ADC resolution and 15 PWM pins at 16-bit resolution. In order to make sure you have plenty of programming room to flex that hardware, the Maple also provides 128k Flash and 20KB SRAM. All of this performance is delivered in the same form factor as the Arduino Pro.

If your current Arduino-based project is pushing against the performance limits of the ATmega, porting it over to Maple may be the fastest and easiest way to continue developing your project without starting from scratch.

Anyway, here I am talking about STM32 VL DISCOVERY, a great $12 board, that is based on ARM CORTEX processor. This board is an excellent evaluation platform for the STMicroelectronics STM32.



Board features

The STM32 on the board is packed with peripherals, especially communication ports and timers, there is a lot that can be done with this “low end” part.

stm32vl-discovery.jpg

  • STM32F100RB Value Line Medium Density MCU, 24MHz Cortex-M3 CPU, 128KB flash, 8KB RAM.
  • 7 DMA channels, 3 USARTs, 2 SPIs, 2 I2C, ADC, DAC, RTC, lots of timers, CRC unit, two independent watchdogs.
  • Integrated ST-Link USB debugger/programmer unit. The debugger unit is also usable separately.
  • 8MHz HSE crystal.
  • 32768Hz LSE crystal.
  • USB power LED (red).
  • USB communication LED (red).
  • Two user LEDs (green, blue).
  • Reset button.
  • User button.
  • All the STM32 I/O pins are conveniently available on the board pin strips.

 

So, for beginners which used to work with arduino and its IDE, programming this board can be quite confusing. You are lucky, because there is Leaflabs Maple IDE, and with a little help i managed this IDE to work with STM32 discovery. If you want to try it, you can download it here. For example of usage and differencies from Arduino IDE, read here.

Maple IDE v 0.0.11

image


Jan 27 2013

Working with EEPROM on PIC16F877a

EEPROM (Electrically Erasable Programmable Read-Only Memory) is a type of non-volatile memory which can be programmed, erased, and re-programmed electrically while it is on the circuit board. The main problem of FLASH and RAM memories is in fact that  they are not capatible for storing data which will be stored after loss of the electric power. A majority of PIC microcontrollers (for example PIC16F877a) come with some built-in EEPROM which is a great place to store data that should not be lost when the system is powered down. Actually, FLASH can be used for that purpose, but it is a little bit complicated and for data access you need to write a special software called Bootloader. PIC16F877 has a 256 bytes of EEPROM memory.  A good example for EEPROM is a digital lock system where the access code can be stored in the EEPROM of microcontroller so that the contents remain intact even after the power supply has been removed. For more clearer example, you can use internal EEPROM to store the measured temperature values. Reading and writting to EEPROM is pretty straightforward, and it’ relativelly easy.

To read EEPROM you need to:

1.Write an address of EEPROM you want to read into EEADR register

2. Set EEPGD bit from EECON1 register to 0 so the next operations can refer to EEPROM (and not FLASHROM)

3. Set RD bit from EECON1 register to begin EEPROM reading

4. The data is stored in EEDATA register.

Sample code is below:

void delay(char n) { //function that inserts delay 5ms
char i; // we need it because we will send data from EEPROM to LED
OPTION=7;  // diodes which are on PORTB
do { 
clrwdt();
i=TMR0+39;
while(i!=TMR0);
}while(—n>0);
}
void main(void){
TRISB=0;
EEADR = 0;
EEPGD = 0; // 0 enables to read write from EEPROM-a ..

// EEPGD=1 means that we want read/write access to FLASHROM
unsigned char eeprom_address = 0;
for(eeprom_address = 0; eeprom_address< 0xFF; eeprom_address++)
{ // for loop for reading EEPROM  and displaying it on PORTB
EEADR=eeprom_address;
while(RD); //wait to finish EEPROM reading
delay(50);
PORTB=EEDATA;
if(eeprom_address==0xFF)
eeprom_address=0;
}
}

I will write about writting to EEPROM in next post.


Dec 09 2012

HOCE LI ISTA O MENI ZNATI


Hoće li išta
о meni znati onaj
što noću će, uz lampu i mrak uokolo,
ove redove čitati?


Hoće li čuti drhat, i strepnju
srca koje misli, dok biskao bude
slovo svako i redak, ко brižna majka
kosu dječiju, češljem najgušćim?


Hoće li išta, išta, uistinu znati?


Il jednakće pustoš
u domu njegovom da zjapi i sja,
nad stolom i knjigom, dok sabran,
i težak od tuge, svoje,
ovu moju bude razgrtao,
vlat po vlat,
mrak po mrak?

A.Sidran


Dec 09 2012

Znalo je biti vremena

Znalo je biti vremena kad duša ciči.
Oči, srce i ruke, prepuni budu straha.
 Na mrtve svoje u trenu počnem da ličim,
tijelo mi lomača biva, gnijezdo sveopšteg praha.


Znalo je biti vremena kad duša pjeva.
Vjetru i kiši, trnu i cesti, nasmijan pruža naklon,
kao da nikad nesretan ne bjeh ni gnjevan,
niti me ikad slamao očaj i stvari crni zakon.


Znalo je biti vremena kad duše nema.
U domu njenom stoglavo ništa zjapi
i tamne posvuda pipke širi nezbivanja neman,
a žestoke kiše udaraca niotkud ni kapi.


Tek tad je urliko u oku ustrijeljen vepar!
Svemu je duša sestrom znala biti, i bila,
al nje kad nema, dok svijetom vlada kosmički nepar 
- blago je i toplo strašno lice ništavila.

A.Sidran


Nov 10 2012

Photo

Testing new server. :)))

Testing new server. :)))


Nov 08 2012

Bosnian language

Here is what wikipedia says about Bosnian language:  http://en.wikipedia.org/wiki/Bosnian_language :)


Nov 06 2012

Lectures digital image processing

https://rapidshare.com/files/2968184648/lec01.mp4;

https://rapidshare.com/files/1095912649/lec02.mp4;

https://rapidshare.com/files/2361663880/lec03.mp4;

https://rapidshare.com/files/3795140206/lec04.mp4;

https://rapidshare.com/files/1772240076/lec05.mp4;

https://rapidshare.com/files/929959307/lec06.mp4;

https://rapidshare.com/files/3855895699/lec07.mp4;

https://rapidshare.com/files/3220084299/lec08.mp4;

https://rapidshare.com/files/1537614407/lec09.mp4;

https://rapidshare.com/files/3873529871/lec10.mp4;

https://rapidshare.com/files/887631679/lec11.mp4;

https://rapidshare.com/files/154278693/lec12.mp4;

https://rapidshare.com/files/954016232/lec13.mp4;

https://rapidshare.com/files/715910894/lec14.mp4;

https://rapidshare.com/files/2019258102/lec15.mp4;

https://rapidshare.com/files/2154454705/lec16.mp4;

https://rapidshare.com/files/4240804980/lec17.mp4;

https://rapidshare.com/files/3274204480/lec18.mp4;

https://rapidshare.com/files/3253339427/lec19.mp4;

https://rapidshare.com/files/382858833/lec20.mp4;

https://rapidshare.com/files/925947051/lec21.mp4;

https://rapidshare.com/files/2010012729/lec22.mp4;

https://rapidshare.com/files/148899075/lec23.mp4;

https://rapidshare.com/files/3461564047/lec24.mp4;

https://rapidshare.com/files/3515715742/lec25.mp4;

https://rapidshare.com/files/268087098/lec26.mp4;

https://rapidshare.com/files/2225718863/lec27.mp4;

https://rapidshare.com/files/3785410777/lec28.mp4;

https://rapidshare.com/files/3512592569/lec29.mp4;

https://rapidshare.com/files/4239789250/lec30.mp4;

https://rapidshare.com/files/1101258555/lec31.mp4;

https://rapidshare.com/files/2071664244/lec32.mp4;

https://rapidshare.com/files/1199200952/lec33.mp4;

https://rapidshare.com/files/2431935799/lec34.mp4;

https://rapidshare.com/files/3202796057/lec35.mp4;

https://rapidshare.com/files/2373613967/lec36.mp4;

https://rapidshare.com/files/3233880022/lec37.mp4;

https://rapidshare.com/files/2003063087/lec38.mp4;

https://rapidshare.com/files/261013949/lec39.mp4;

https://rapidshare.com/files/1068646618/lec40.mp4;

These are lectures from nptel on digital image processing.

Nov 01 2012

Video

Free open source RTS game


Nov 01 2012
3 notes

Fourier series

Fourier Series: Basic Results

Recall that the mathematical expression 

\begin{displaymath}A_0 + \sum_{n = 1}^{\infty} (A_n\cos(nx) + B_n\sin(nx)).\end{displaymath}


is called a Fourier series
Since this expression deals with convergence, we start by defining a similar expression when the sum is finite. 

Definition. A Fourier polynomial is an expression of the form 

\begin{displaymath}F_n(x) = a_0 + \Big(a_1\cos(x) +b_1\sin(x)\Big)+ \cdots + \Big(a_n\cos(nx) + b_n\sin(nx)\Big)\end{displaymath}


which may rewritten as 

\begin{displaymath}F_n(x) = a_0 + \sum_{k= 1}^{k=n} \Big(a_k\cos(kx) + b_k\sin(kx)\Big).\end{displaymath}


The constants a0ai and bi$i=1,\cdots,n$, are called the coefficients of Fn(x). 

The Fourier polynomials are $2\pi$-periodic functions. Using the trigonometric identities 

\begin{displaymath}\begin{array}{lcr}
\sin(mx)\cos(nx) &=&\displaystyle \frac{1}...
...e \frac{1}{2}\Big[\cos((m-n)x) - \cos((m+n)x) \Big]
\end{array}\end{displaymath}


we can easily prove the integral formulas(1)for $n \geq 0$, we have 

\begin{displaymath}\int_{-\pi}^{\pi} \cos(nx)dx = 0,\;\;\;\mbox{and}\;\; \int_{-\pi}^{\pi}\sin(nx)
dx = 0,\end{displaymath}


(2)for m et n, we have 

\begin{displaymath}\int_{-\pi}^{\pi} \sin(mx) \cos(nx)dx = 0,\end{displaymath}


(3)for $n \neq m$, we have 

\begin{displaymath}\int_{-\pi}^{\pi} \cos(mx)\cos(nx)dx = 0,\;\;\mbox{and}\;\;
\int_{-\pi}^{\pi}\sin(mx) \sin(nx)dx=0,\end{displaymath}


(4)for $ n \geq 1$, we have 

\begin{displaymath}\int_{-\pi}^{\pi}\cos^2(nx)dx = \pi,\;\;\mbox{and}\;\;
\int_{-\pi}^{\pi} \sin^2(nx)dx = \pi.\end{displaymath}

Using the above formulas, we can easily deduce the following result: 

Theorem. Let 

\begin{displaymath}F_n(x) = a_0 + \sum_{k= 1}^{k=n} \Big(a_k\cos(kx) + b_k\sin(kx)\Big).\end{displaymath}


We have 

\begin{displaymath}\left\{\begin{array}{lclr}
a_0 &=&\displaystyle \frac{1}{2\pi...
...\pi} F_n(x) \sin(kx)dx,& 1 \leq k \leq n.\\
\end{array}\right.\end{displaymath}

This theorem helps associate a Fourier series to any $2\pi$-periodic function. 

Definition. Let f(x) be a $2\pi$-periodic function which is integrable on $[-\pi, \pi]$. Set 

\begin{displaymath}\left\{\begin{array}{lclr}
a_0 &=& \displaystyle \frac{1}{2\p...
..._{-\pi}^{\pi} f(x) \sin(nx)dx,& 1 \leq n.\\
\end{array}\right.\end{displaymath}


The trigonometric series 

\begin{displaymath}a_0 + \sum \Big(a_n\cos(nx) + b_n\sin(nx)\Big)\end{displaymath}


is called the Fourier series associated to the function f(x). We will use the notation 

\begin{displaymath}f(x) \sim a_0 + \sum_{n=1}^{\infty} \Big(a_n\cos(nx) + b_n\sin(nx)\Big).\end{displaymath}

Example. Find the Fourier series of the function 

\begin{displaymath}f(x) = x, \;\;\; -\pi \leq x \leq \pi.\end{displaymath}


Answer. Since f(x) is odd, then an = 0, for $n \geq 0$. We turn our attention to the coefficients bn. For any $ n \geq 1$, we have 

\begin{displaymath}b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} x \sin(nx)dx =
\frac{1...
...\frac{x\cos(nx)}{n} + \frac{\sin(nx)}{n^2}\right]^{\pi}_{-\pi}.\end{displaymath}


We deduce 

\begin{displaymath}b_n = -\frac{2}{n}\cos(n\pi) = \frac{2}{n}(-1)^{n+1}.\end{displaymath}


Hence 

\begin{displaymath}f(x) \sim 2\left(\sin(x) - \frac{\sin(2x)}{2} + \frac{\sin(3x)}{3} ....\right).\end{displaymath}

Example. Find the Fourier series of the function 

\begin{displaymath}f(x) = \left\{ \begin{array}{lll}
0,& -\pi \leq x < 0\\
\pi, & 0 \leq x \leq \pi
\end{array} \right.\end{displaymath}


Answer. We have 

\begin{displaymath}a_0 = \frac{1}{2\pi}\left(\int_{-\pi}^{0} 0dx + \int_{0}^{\pi...
...\;\;\; a_n = \int_{0}^{\pi} \pi\cos(nx)dx = 0, \;\;\; n \geq 1,\end{displaymath}


and 

\begin{displaymath}b_n = \int_{0}^{\pi} \pi\sin(nx)dx = \frac{1}{n}(1-\cos(n\pi)) =
\frac{1}{n}(1-(-1)^n).\end{displaymath}


We obtain b2n = 0 and 

\begin{displaymath}b_{2n+1} =\frac{2}{2n+1}.\end{displaymath}


Therefore, the Fourier series of f(x) is 

\begin{displaymath}f(x) \sim \frac{\pi}{2} + 2 \left(\sin(x) + \frac{\sin(3x)}{3} +
\frac{\sin(5x)}{5}+\ldots\right).\end{displaymath}

Example. Find the Fourier series of the function function 

\begin{displaymath}f(x) = \left\{ \begin{array}{rrr}
-{\displaystyle \frac{\pi}...
...ystyle \frac{\pi}{2}}, & 0 \leq x \leq \pi
\end{array} \right.\end{displaymath}


Answer. Since this function is the function of the example above minus the constant $\displaystyle \frac{\pi}{2}$. So Therefore, the Fourier series of f(x) is 

\begin{displaymath}f(x) \sim 2 \left(\sin(x) + \frac{\sin(3x)}{3} + \frac{\sin(5x)}{5}+\ldots
\right).\end{displaymath}

Remark. We defined the Fourier series for functions which are $2\pi$-periodic, one would wonder how to define a similar notion for functions which are L-periodic. 

Assume that f(x) is defined and integrable on the interval [-L,L]. Set 

\begin{displaymath}F(x) = f\left(\frac{Lx}{\pi}\right).\end{displaymath}


The function F(x) is defined and integrable on $[-\pi, \pi]$. Consider the Fourier series ofF(x

\begin{displaymath}F(x) = f\left(\frac{Lx}{\pi}\right) \sim \frac{a_0}{2} +
\sum_{n=1}^{\infty} \Big(a_n\cos(nx) + b_n\sin(nx)\Big).\end{displaymath}


Using the substitution $t =\displaystyle \frac{Lx}{\pi}$, we obtain the following definition: 

Definition. Let f(x) be a function defined and integrable on [-L,L]. The Fourier series of f(x) is 

\begin{displaymath}f(t) \sim a_0 + \sum_{n=1}^{\infty} \left(a_n\cos\left(n\frac{\pi t}
{L}\right) + b_n\sin\left(n\frac{\pi t}{L}\right)\right)\end{displaymath}


where 

\begin{displaymath}\left\{\begin{array}{lclr}
a_0 &=& \displaystyle \displaystyl...
...f(x) \sin\left(n\frac{\pi x}{L}\right)dx,\\
\end{array}\right.\end{displaymath}


for $1\leq n$

Example. Find the Fourier series of 

\begin{displaymath}f(x) = \left\{ \begin{array}{lll}
0,& -2 \leq x < 0\\
x, & 0 \leq x \leq 2
\end{array} \right.\end{displaymath}


Answer. Since L = 2, we obtain 

\begin{displaymath}\begin{array}{lll}
a_0 &=& \displaystyle \frac{1}{4} \int_{0...
...{n\pi} = \displaystyle \frac{2}{n\pi}(-1)^{n+1}\\
\end{array}\end{displaymath}


for $ n \geq 1$. Therefore, we have 

\begin{displaymath}f(x) \sim \frac{1}{2} +
\sum_{n=1}^{\infty} \left[\frac{2}{n...
...rac{2}{n\pi}(-1)^{n+1}\sin\left(n\frac{\pi x}{2}\right)\right].\end{displaymath}


Previous 1 2 3 Next