User Tools

Site Tools


user:jmendoza:portfolio:datacomm5

Project: Morse Code

A project for Data Communications by Jason Mendoza and senior Corn-d-o-dubba-g during the fall 2013 semester.

This project was begun in late November 2013 and is anticipated to take a while.

Objectives

The purpose of this project is to be awesome in the area of greatness. one pi should talk to another and the receiveing pi should ultimately take in the signal from the sending pi and be able to determine the signal as English/roman letters using a binary tree as a deciphering structure.

#sick

Prerequisites

  • A library of Morse code values
  • A decent understanding of what the who-heck Morse code is and how it works
  • A smattering of code from all the previous projects
  • Coffee
  • A working conducting program

Background

This should be super sweet. The hope is that we will have communication. This means we will have the basics of all networks and all machine communication. From this we can do all sorts of things that have already been done but, hell, its still pretty exciting.

Scope

This is going to be problematic. There will be latency issues but hopefully we will be able to extend the reach of the signal across the lair at least. This will be invaluable for the purpose of trading steamy details about encounters with Tom's mom.

Attributes

State and justify the attributes you'd like to receive upon successful approval and completion of this project.

  • Knowledge: All else is irrelevent

Procedure

Well gov.lord.king.geniousCaseyCornaire.M.D.PHD.esquire lost all my notes so here we go!

We will hard code all of the signal length values for all into a file in the sending pi. We will have an inververse function on the receining pi or a binary tree of values to decode. What we will do is brute force a method of finding the minimum length of a signal that cn be interpreted on the receiving pi and build our signal reception signal aroud that time signature metric. The big problem will be latency as and differenciaions in runtime because of system resource fluctuations. gogo gadget party.

Code

Upon completion of the project, if there is an applicable collection of created code, place a copy of your finished code within <code> </code> blocks here.

#include <stdio.h>
#include <stdlib.h>
#include "rpi.h"
int main()
 
{
 
if(map_peripheral(&gpio) == -1) 
  {
    printf("Failed to map the physical GPIO registers into the virtual memory space.\n");
    return -1; 
  }
 
 INP_GPIO(23);
  OUT_GPIO(23);
 
 
 
 
 
char morse;
 
printf("type a string: \n");
scanf( "%c", &morse );
 
while( morse != '#' )
{
 
if( morse  == 'A' )
 
	{
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;
	    usleep(360000);	
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23;
		usleep(1480000);
		printf( ".- " ) ;
	}
 
	else if( morse == 'B' )
 
    {   
		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23;
		usleep(200000);
        GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(360000); 
		GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(360000); 
		GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(760000);  	
        printf( "-... " ) ; 
    }   
 
	else if( morse == 'C' )
 
    {   
        GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
        GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(360000); 
		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
        GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(760000); 
 
		printf( "-.-. " ) ;
    }
 
	else if( morse == 'D' )
 
    {   
        GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
        GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(360000); 
        GPIO_SET = 1 << 23;
		usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(1200000);
 
		printf( "-.. " ) ; 
    }   
 
    else if( morse == 'E' )
 
    {   
		GPIO_SET = 1 << 23;
		usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(2080000);
 
        printf( ". " ) ; 
    }   
 
	else if( morse == 'F' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
        GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(80000);
		GPIO_CLR = 1 << 23;
        usleep(760000);
		printf( "..-. " ) ; 
    }   
 
	else if( morse == 'G' )
 
    {   
        GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(1200000);
		printf( "--. " ) ; 
    }   
 
	else if( morse == 'H' )
 
    {   
         GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(760000);
		printf( ".... " ) ; 
    }   
 
	else if( morse == 'I' )
 
    {   
         GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(1640000);
		printf( ".. " ) ; 
    }
 
	else if( morse == 'J' )
 
    {   
         GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
		 GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
 		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(600000);
 
		printf( ".--- " ) ; 
    }   
 
	else if( morse == 'K' )
 
    {   
         GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
		 GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(1040000); 
 
		printf( "-.- " ) ; 
    }   
 
	else if( morse == 'L' )
 
    {   
        GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000); 
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(760000);
 
		printf( ".-.. " ) ; 
    }   
 
	else if( morse == 'M' )
 
    {   
        GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(200000);
		GPIO_SET = 1 << 23; 
        usleep(240000);
        GPIO_CLR = 1 << 23; 
        usleep(600000);
 
		printf( "-- " ) ; 
    }   
 
	else if( morse == 'N' )
 
    {   
        GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(1640000);
		printf( "-. " ) ; 
    }   
 
	else if( morse == 'O' )
 
    {   
 
		 GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		 GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		 GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(1040000);
		printf( "--- " ) ; 
    }   
 
	else if( morse == 'P' )
 
    {   
        GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(760000);
		printf( ".--. " ) ; 
    }   
 
	else if( morse == 'Q' )
 
    {   
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		 GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
 
        printf( "--.- " ) ; 
    }   
 
	else if( morse == 'R' )
 
    {   
        GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(360000);
        GPIO_SET = 1 << 23;
        usleep(240000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
		GPIO_SET = 1 << 23; 
        usleep(80000);
        GPIO_CLR = 1 << 23; 
        usleep(1200000);
 
		printf( ".-. " ) ; 
    }   
 
	else if( morse == 'S' )
 
    {   
        GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(360000);
		GPIO_SET = 1 << 23;
        usleep(80000);
        GPIO_CLR = 1 << 23;
        usleep(1200000);
 
		printf( "... " ) ; 
    }   
 
	else if( morse == 'T' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(1920000);
 
		printf( "- " ) ; 
    }   
 
	else if( morse == 'U' )
 
    {   
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);  	
        GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(1040000);
 
		printf( "..- " ) ; 
    }   
 
	else if( morse == 'V' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(600000);
 
		printf( "...- " ) ; 
    }   
 
	else if( morse == 'W' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(3600000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(1040000);
 
		printf( ".-- " ) ; 
    }   
 
	else if( morse == 'X' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(240000);
	    GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000); 
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000); 
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(600000);
 
		printf( "-..- " ) ; 
    }   
 
	else if( morse == 'Y' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000); 
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(600000);
 
		printf( "-.-- " ) ; 
    }   
 
	else if( morse == 'Z' )
 
    {   
        GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(240000);
		GPIO_CLR = 1 << 23; 
		usleep(200000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(360000);
		GPIO_SET = 1 << 23;
		usleep(80000);
		GPIO_CLR = 1 << 23;         
		usleep(760000);
		printf( "--.. " ) ; 
    }   
 
	scanf( "%c", &morse );
 
}
 
printf( "\n" );
 
return 0;
 
}

Execution

This project is uncomplete :( #sadpanda

Reflection

The most educating and rewarding aspect of this particular project was watching my peers. Everyone had REALLY uniques approaches and different frontal lobe reactions to the same problems we were all having. This was great! All at the same time I was like “ They are F987king idiots/brilliant and I would never have done anything tahat way or even thought too, sweet”

Screwing with the kernel!?!?! BRILLIANT/QUACKERY!!!!!!

Seriously this is awesome.

user/jmendoza/portfolio/datacomm5.txt · Last modified: 2013/12/13 22:50 by jmendoza