Wednesday 22 January 2014

CCS_Programme 04: Average Power of Sine wave usign Fixed Point Technique in Code Composer Studio


## Average Power of sinusoidal signal using Fixe Point Programming Technique in Code Composer Studio V5



/* programme for calculating average power of a sin waves whose amplitude
 * is A = 0.9 (scaling factor)
 * x[n] = A* sin(2*PI*f0*t)  
 * x[n] = A* sin ((2*PI*f0*nTs))
 * x[n] = A *sin ((2*PI*n)/(fs/f0))
 * f0 is 1000; and sampling frequency fs is 32000
 * fs/f0 = 32
 *
 * for four cycle no of samples are 32*4 = 128;
 *
 * avg power = 1/N [Summation(n=0 to n=N-1){x^2(n)}]; N is no of samples
 */

#include <stdio.h>
#include <math.h>

#define Q15 (unsigned int)32768
#define FS_BY_F0 32
#define PI (float)3.1416
#define SIZE 128
float amp=0.9;
int x[SIZE];
long prod,sum=0;
float avg;

void main()
{
int i;
for (i=0;i<SIZE;i++)
x[i] = (int)(Q15 * amp * sin ((2*PI*i)/FS_BY_F0));

for (i=0;i<SIZE;i++)
{
prod = (long)x[i] * (long)x[i];  //SSI0F30;
prod = prod <<1; //SI0F31
prod = prod >>7; //SI7F24
sum = sum + prod; //SI7F24
}

printf ("before dividing sum is %ld\n",sum);

sum = sum >>7; // dividing by 128 for calculating avg power

// now sum is nearly equal to 1. and just above result is in SI7F24 formate
// converting result in SI0F31 formate

sum = sum <<7;

avg = (float)sum/((unsigned long)Q15<<16);
printf ("average power is %f\n",avg);
}

/*End of Programme*/

**************************************************************
Click on
Project -> build all
then click on  debug
for graph display click on Tool ->Graph->single time

select Acquisition buffer 128
DSP Data type 16 bit signed integer
Start Address:      x
Then finally Click on OK

A Sinusoidal graph with four cycle will display. 

Wednesday 8 January 2014

A MOOC and a Contest to begin the New Year on a happy note!

Grave this Opportunity with "University of Texas, Austin " 
 by taking online free course on
"UT.6.01x Embedded Systems - Shape the World "


This is a hands-on, learn-by-doing course that shows you how to build solutions to real-world problems using embedded systems. Each student will purchase a Texas Instruments TM4C123 microcontroller kit and a few electronic components. This microcontroller has a state of the art ARM Cortex M4 processor.
 "At the conclusion of this course you will be able to build your own arcade-style game on NOKIA LCD."






  • Title of the course – UT6.01x – Embedded Systems – Shape the world
  • Duration of the course – 15 weeks
  • Who is teaching the course? – Prof. Jonathan Valvano and Prof. Ramesh Yerraballi of UT, Austin
  • Who can take the course? Anyone who wishes to learn about embedded systems!
  • When is this course starting? Jan 24, 2014
  • How many hours do I need to spend in a week? – At least 10 hours a week. (Ekalavya perhaps spent more.)
  • What prerequisites are needed? You must be familiar with C programming, Digital Design, and concepts of Computer Architecture.
  • What is the nature of the course? – Apart from lectures, you will have hands-on assignments which you must complete to benefit from the course. (Imagine Ekalavya just taking a theory class on archery.)
  • What will I need to take the course? You will also need access to a good Internet connection.  If you intend to do the experiments in the convenience of your home, you will need a TM4C123 TIVA Launchpad and some parts (resistors, LED, wires, etc.) – these are explained in Swanland’s blog; you can purchase the components from the links provided therein. You will benefit from a copy of the book from Prof. Valvano – Introduction to Embedded Systems – Vol 1. While it is best to buy yourself a copy, you can also benefit from the course landing page.
  • How can I enroll? Visit this website to get started.
  • Will I get a certificate? If you enroll for the free course and audit the class, you  will not receive any certification. If you formally enrol and complete the course, you will receive a certification that can be useful when you go job hunting.
  • What is the course website? – Here it is: http://users.ece.utexas.edu/~valvano/edX/