logo
Most Viewed Last 7 Days
GB3YT (YV,YX) (329)
EME In 2006 (328)
Chirp Sounders (328)
Microsource YIG Synth (328)
11km on 134GHz (328)
13cm 200mW Comtech info (328)

ALL


Cluster Activity

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

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

My Weather

Date:01/01/70 Time:00: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