# Blog Arşivleri

## Morse Code Application with Altera FPGA Board -2-

hi everyone,

At my previous post i introduced my morse code project with fpga. Today you can examine the working princible of the project. It is in turkish but you can enable the subtitles of youtube video to english.

.
.
gökhan öztürk

best wishes

## Creating A New Character UTFT Library

Creating A New Character UTFT Library

Today i will try to explain an easy way to create a new character.
By calling “creating” i meant changing.
I won’t create a new character forom the beginnig but we will achieve our goal by changing
a letter that already exist in the UTFT library.

When you open UTFT folder you will able to see “DefaultFonts.c” file.
you can open this file by notepad. After that, for the small letters
just find ”  fontdatatype SmallFont[1144] PROGMEM={ …} ”
(and  for the capital letters ” fontdatatype BigFont[3044] PROGMEM={ … } ” )

I will talk about for the small font.

At UTFT library our smallfont character’s dimensions is 5*7 pixels and it expressed by
like this “0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i”
That was letter of “i” let’s examine for this.

You might be noticed that it is not 5*7 pixels actually ,is 8*12 pixels. But with the
spaces it seems like 5×7 and it is a convenient order.

So my first 0x00 (hex. number) is at the top then 0x00,0x20 goes by relatively through
bottom. You can create a table like mine at Microsoft Excel, then
fill the squares, calculate the exact values in hexadecimal.

Finally, we came to “changing” part. Now you must have 12 hexadecimal numbers for your new character,
replace these values with the values of a rarely used character. For example you calculated value
new values for “é” caharacter, placed the values of this caharacter “/”. When you used “/” at your code
it will be seen at the screen like “é”.

Be aware that this is for small font. For the big font there are 32 parallel lines
(hex. numbers) to change.

Regards

gökhan öztürk

## Traffic Lights and Pedestrian Way Control System with MSP430

Hi, at my this i created a system for traffic lights and pedestrian way control.

You can also watch my Youtube presentation.

Equipments that used in this project are;
+ MSP430 Chipset
+ GLCD (Nokia 5110)
+ Distance Sensor (HCSR-04)
+ Buzzer
+ LEDs
+ Buttons

Procedure of my system is like this;
I have two counters. One stars 60 to zero , another one counts
30 to zero. If we are in the first time interval ( 60 -> 0 ) cars can use their way
but pedestrians should wait until time is end. We can see the down counting from
the screen. If any person attempts to pass across the street ( from car’s road ),
the distance sensor that located edge of car’s road, will war by buzzer.

After first time interval car’s passed. Another countdown starts. (from 30 -> zero )
Cars should stop and people can pass across the street.

Third past is interrupt section. At the late hours traffic won’t be busy so we don’t need
LCD, sensors, buzzer and etc. We just need a blinking LED for warning. That also reduce
the power consupmtion.

P.s. You can find the port interrupt program and my lcd commands from early posts.

Best wishes.

## Port Interrupt with MSP430

Hi, at my this post i will introduce a port interrupt to you. It is so simple.

First of all you should your interrupt pin then enable it and define it’s interrupt edge (hi to low or low low high). You can define your ISR (interrupt service routine) as you wish. At my ISR it blink a LED. Also i defined a button to get out of ISR.

Best wishes.

```

//P2.1 is the interrupt exit button
//P2.4 Interrupt pin
//P2.5 Led Output

#include <msp430.h>
void main(void) {

WDTCTL = WDTPW + WDTHOLD;// Stop WDT
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;

P2DIR |= BIT5; // Set P2.5 to output direction
P2IE |= 0x10; // P2.4 interrupt enabled
P2IES |= 0x10; // P2.4 Hi/lo edge
P2OUT = 0x00;
}

// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
P2OUT = 0x00;
while((P2IN & ~BIT1) != BIT1){ // Button at P2.1 is high active
P2OUT ^= BIT5;
__delay_cycles(100000);
}
P2OUT = 0x00;
P2IFG &= ~0x10; // P1.4 IFG cleared
}

```