logo
Most Viewed Last 7 Days
This bit is broken!!! (7)
(7)
(7)
(7)
(7)
(7)

ALL


Cluster Activity

Spots per uW band today:
UK spotter or spotted only.

Solar data:
SFI
71
A-Index
13
K-Index
3
Exp.K
2
Sunspots
0
Activity
qui
GMF
qui
Aurora?
no

My Weather

Date:01/01/70 Time:01:00
Temp:C
Wind Speed:0mph
Wind Dir:deg
Pressure:0mB
Humidity:%
Dew Point:-20C
UKHASnet

//This is an IQ Mixer made with my knowledge of sdr so far... don't laugh ;-)
//Reads samples from standard input at 1.204Ms/s and writes mixed samples to standard output
//
// to compile: gcc mixer.c -o mixer -lm
//
//rob@m0dts.co.uk
//
//September 2015

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



void main(void){


int n,i;
unsigned char inbuf[2];
int sample_rate;
float m1,m2,m3,m4,*vfoi,*vfoq,osc,outbuf[2];

osc = 15000;
sample_rate = 1024000;

//allocate memory for IQ oscillator lookup table, probably a better way to do it? complex values maybe?
vfoi= malloc(sample_rate * sizeof(float));
vfoq= malloc(sample_rate * sizeof(float));

//Create lookup samples for one cycle of oscillator - could use 1/4 cycle... better way?
for(n=0;n<(sample_rate/(int)osc);n++){
vfoi[n]=sin((2*M_PI)*osc/sample_rate*n);
vfoq[n]=cos((2*M_PI)*osc/sample_rate*n);
}

//IQ mixer - based on 'understanding dsp' book example
n=0;
while(1){
//Read pair of samples
fread(&inbuf,sizeof(char),2,stdin);
//I_sample*Q_osc
m1 = ((float)inbuf[0]-127.0) *vfoq[n];
//Q_sample*Q_osc
m2 = ((float)inbuf[1]-127.0) *vfoq[n];
//Q_sample*I_osc
m3 = ((float)inbuf[1]-127.0) *-vfoi[n]; // remove '-' for up conversion
//I_sample*I_osc
m4 = ((float)inbuf[0]-127.0) *-vfoi[n]; // remove '-' for up conversion
//sum
outbuf[0] = m1 - m3;
outbuf[1] = m2 + m4;

n++;
if(n==(sample_rate/(int)osc)){n=0;}

//Write pair of samples
fwrite(&outbuf,sizeof(float),2,stdout);

}

}













Last page added:25/03/00 18:32
M0DTS.co.uk