Morse code Tutor

 

 




 
 
 
 
Morse code Tutor

Morse code Tutor

Download Morse Tutor (30 kb)

Source code (morse.cpp) and Compiled DOS Binary (morse.exe)

Morse Tutor is a program written in C++. It can be used for learning or sending morse code. Morse code uses long (dash) and short (dot) sounds to communicate. The dot is the basic unit and the dash is equal to the length of three dot's.

Morse Code was developed by Samual Morse in 1897. Due to the advantages like overriding noise, static, use of simple transmitter and low power requirements, it is still used for communication.

The program provides character mode, line mode and file mode of operation. In character mode, separate character can be practiced. In file mode, stored messages can be sent. This mode also have provision for creating a new message file. The speed can be set between 5 WPM (words per minute) to 20 WPM, amd tone can be varied between 100Hz and 4000Hz (4KHz) using the program. The default speed is 12 WPM and tone is 700 Hz.

Recently i have modified the source code to include RANDOM MODE to Morse Tutor. After adding the random mode, i found morse tutor much more interesting. User can specify the number of random words to be generated and the Morse Tutor will generate the random words. You can download the zip file which contains the latest version of Morse Tutor.

NOTE : I suggest you to compile the source code (morse.cpp) in the distribution and use it. If you are going to use included binary (morse.exe), please check for presence of any virus before executing Morse Tutor. Your computer need a Speaker (not a soundcard) to produce the generated morse code.

//File : morse.cpp

//Author : Yujin Boby

//Email : vu3prx@yahoo.com, info@flashwebhost.com

//Home : http://www.flashwebhost.com/

#include<iostreams.h>

#include<conio.h>

#include<dos.h>

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<ctype.h>

void morse();

int mnu_one();

void mode_line();

void mode_file();

void mode_sett();

void mode_char();

char in;

int FREQ=700; // 700 Hz

int DOT=50; // 12 wpm

void main()

{

int choice;

while(1)

{

choice=mnu_one();

if (choice==1) mode_char();

else

if(choice==2) mode_line();

else

if(choice==3) mode_file();

else

if(choice==4) mode_sett();

else

if(choice==5) break;

}

gotoxy(25,19); cout<<"73's & Good Bye.. de VU3PRX\n\n\n";

}

/**************************** MORSE()*********************************/

void morse()

{

char code[8];

switch(toupper(in))

{

case 'A': strcpy(code,".-"); break;

case 'B': strcpy(code,"-..."); break;

case 'C': strcpy(code,"-.-."); break;

case 'D': strcpy(code,"-.."); break;

case 'E': strcpy(code,"."); break;

case 'F': strcpy(code,"..-."); break;

case 'G': strcpy(code,"--."); break;

case 'H': strcpy(code,"...."); break;

case 'I': strcpy(code,".."); break;

case 'J': strcpy(code,".---"); break;

case 'K': strcpy(code,"-.-"); break;

case 'L': strcpy(code,".-.."); break;

case 'M': strcpy(code,"--"); break;

case 'N': strcpy(code,"-."); break;

case 'O': strcpy(code,"---"); break;

case 'P': strcpy(code,".--."); break;

case 'Q': strcpy(code,"--.-"); break;

case 'R': strcpy(code,".-."); break;

case 'S': strcpy(code,"..."); break;

case 'T': strcpy(code,"-"); break;

case 'U': strcpy(code,"..-"); break;

case 'V': strcpy(code,"...-"); break;

case 'W': strcpy(code,".--"); break;

case 'X': strcpy(code,"-..-"); break;

case 'Y': strcpy(code,"-.--"); break;

case 'Z': strcpy(code,"--.."); break;

case '1': strcpy(code,".----"); break;

case '2': strcpy(code,"..---"); break;

case '3': strcpy(code,"...--"); break;

case '4': strcpy(code,"....-"); break;

case '5': strcpy(code,"....."); break;

case '6': strcpy(code,"-...."); break;

case '7': strcpy(code,"--..."); break;

case '8': strcpy(code,"---.."); break;

case '9': strcpy(code,"----."); break;

case '0': strcpy(code,"-----"); break;

case '.': strcpy(code,".-.-.-"); break;

default: cout<<endl<<"MSG-Switch::Invalid

character \"";

cout<<in<<"\""<<endl; break;

}

int len=strlen(code);

for(int i=0;i<len;i++)

{ sound(FREQ);

if(code[i]=='.') delay(DOT);

else

if(code[i]=='-') delay(3*DOT);

nosound(); delay(DOT);

}

delay(3*DOT);

}

/******************MNU_ONE()********************************************/

int mnu_one()

{

int ch;

clrscr();

gotoxy(30,7); cout<<"MORSE CODE TUTOR";

gotoxy(30,8); cout<<"~~~~~~~~~~~~~~~~";

gotoxy(33,9); cout<<"1. CHARACTER MODE";

gotoxy(33,10); cout<<"2. LINE MODE";

gotoxy(33,11); cout<<"3. FILE MODE";

gotoxy(33,12); cout<<"4. SETTINGS";

gotoxy(33,13); cout<<"5. EXIT";

gotoxy(30,15); cout<<"Enter your choice : ";

gotoxy(25,19); cout<<"A FreeWare From VU3PRX";

gotoxy(50,15); cin>>ch; return ch;

 

}

/***************************** MODE_LINE() ***********************/

void mode_line()

{

int flag=1;

char line[80];

clrscr();

cout<<"LINE MODE"<<endl;

cout<<"Type '*' to END sending"<<endl;

while(flag)

{

gets(line);

int len=strlen(line);

for(int i=0;i<len;i++)

{

in=line[i];

if(in==' ') { delay(6*DOT); continue; }

else if(in=='*') { flag=0; break; }

morse();

}

}

}

/**************************** MODE_FILE() ********************************/

void mode_file()

{

FILE *fp;

char fname[10];

clrscr();

cout<<"Enter file name : ";

cin>>fname;

if((fp=fopen(fname,"r"))!=NULL)

{

while((in=getc(fp))!=EOF)

{

if(in==' ') { delay(6*DOT); continue; }

morse();

}

}

else

{

char ans;

cout<<endl<<"File not found, Create New (Y/N) ?

";

cin>>ans;

if((ans=='y')||(ans=='Y'))

if((fp=fopen(fname,"w"))!=NULL)

 

hile((ans=getchar())!='\n')

putc(ans,fp);

}

fclose(fp);

}

/************************** void mode_sett();*********************/

void mode_sett()

 

{

int cho;

clrscr();

cout<<"1. CHANGE FREQUENCY"<<endl;

cout<<"2. CHANGE SPEED"<<endl;

cout<<endl<<"Enter your choice : ";

cin>>cho;

if(cho==1)

{ cout<<endl<<"Current Frequency of tone is

"<<FREQ<<" Hz"<<endl;

cout<<"The valid frequency range is from 100 Hz to

4000 Hz"<<endl;

 

cout<<endl<<"Enter the new frequency : ";

int tmp;

cin>>tmp;

cout<<endl<<endl;

if((tmp>99)&&(tmp<4001))

{

FREQ=tmp;

cout<<"Now the Frequency is changed to "<<FREQ<<"

Hz"<<endl;

}

else cout<<"Error : Invalid frequency range";

getch();

}

if(cho==2)

{

int speed;

speed=36000/(DOT*60);

cout<<"\nCurrent speed is "<<speed<<"

Words/Minute"<<endl;

cout<<"The valid Speed is from 5 WPM to 20 WPM "<<endl;

cout<<"\n\nEnter new speed : ";

 

cin>>speed;

if((speed>4)&&(speed<21))

{

DOT=36000/(speed*60);

cout<<"\n\nNow the speed is "<<speed<<"

Words Per Minute";

}

else cout<<"\n\nError : Speed "<<speed<<"

WPM not allowed\n";

 

getch();

}

/*********************** MODE_CHAR() ***********************************/

void mode_char()

{

clrscr();

cout<<"CHARACTER MODE"<<endl;

cout<<"Type '*' to END sending"<<endl;

while(1)

{

in=getche();

if(in==' ') { delay(6*DOT); continue; }

else if(in=='*') break;

morse();

}

}

 

Ham Radio

7 MHz SSB Transceiver

 

Ladder Filter used in 7MHz SSB Ham Radio Transceiver
Linear Amplifier used in 7MHz SSB Ham Radio Transceiver using 2N2222A, SL100B and BD139

Hobby Circuits - Ham ( Amature ) Radio

 

7MHz SSB Transceiver - Circuit digram and brief description of 7MHz SSB Transceiver for Hams. The circuit is designed around two numbers of MC1496. It can push around 80 Watts with IRF840 in the final. You can down load HTML version or the printer friendly word document.
Morse Code Tutor - A program (23kb) written in C++. Morse code uses dot and dash for communication. Still it is popularly used for communication is short wave bands. The Archive contains program source code and executable.
AM DSB Transmitter for Hams - circuit diagram of simple double side band suppressed carrier (DSBSC) transmitter for hams. Circuit uses crystal oscillator, crystal can be switched for multi band operation.
Antennas for Ham Transmitters - Describes how to construct various type of antenna for Ham Radio Transmitters.
600 Volt Power Supply - simple 600 Volt DC power supply. Convert 230V AC to 300V and 600V DC.
Ham Radio BFO - circuit diagram of beat frequency oscillator using BF494 and how to listen amateur radio communication on ordinary BC receiver.
Miniature MW Transmitter - circuit diagram of simple medium wave transmitter using BF494B. This simple transmitter have a range of 200 meters.
807 and 1625 Valves - data on vacuum tubes 807 and 1625 used in ham radio transmitters. Describes various pin voltages and different operation modes.
FM Wireless Mike - low power frequency modulated transmitter using two transistors. The circuit works with 9v power supply.
60 Watt RF Amplifier - Soild state RF power amplifier using IRF840. Simple and easy to construct. IRF840 can handle a maximum power output of 125 Watts.
Simple RF Power Meter - simple RF power meter cum dummy load for low power transmitters.
Touch CPO - touch operated code practice oscillator using popular timer IC555. Practice Morse code in a different way.
Modulation Monitor - very simple and useful circuit used to monitor on air transmission of your low power amplitude modulated transmitter.
Cheap Crystal filter - Ladder filter using six 4.43MHz Crystals. Building cheap side band filter for your bome brew SSB Rig.
RF Dummy Load - make this simple RF Dummy Load for off-air testing of your radio transmitter.
Mosquito Repellant - very simple and easy to assemble mosquito repellant using two transistors and handy components.
Ceramic Filter BFO - Receive SSB and CW transmissions on your BC receiver. Simple BFO is build around 455 KHz Ceramic Filter.
SSB ADAPTOR - Build this simple adaptor to receive single side band SSB on short wave AM receivers.
QRP Keyer - very simple keyer circuit using only one transistor.
Designing RF Probe - make your self simple and heighly useful RF probe. An essential tool for every home brewer.
Shorty Forty Antenna - Do you have space limitaion to put a 40 meter dipole. Try this Compact 40 meter antenna.