/Designs/Oscilloscope/DOC/stav.txt
0,0 → 1,9
Zatim je zprovezneno zakladni samplovani a binarni data transfer na strane atmegy a
prijem a zobrazeni dat na strane PC.
 
Dal:
Dat dohromady kod qscope, at se v tom da poradne vyznat.
Musim vykrast trigger ze sveho starsiho projektu.
Nastavitelny time base. Mereni time base pomoci timeru.
Zpouzitelnit qscope.
Nakreslit zapojeni modulu a analogove cesty.
/Designs/Oscilloscope/PrjInfo.txt
1,14 → 1,14
 
[InfoShortDescription.en]
Simple low frequency oscilloscope project. The project utilizes modules ATMEGA801B, USBRS232R01B and ADCmonoSPI01B.
Simple low frequency oscilloscope project.
 
[InfoShortDescription.cs]
Jednoduchý nízkofrekvenční osciloskop. Využívá modulů ATMEGA801B, USBRS232R01B a ADCmonoSPI01B.
Jednoduchý nízkofrekvenční osciloskop.
[InfoLongDescription.en]
The device services for analog signal conditioning, ADC sampling and raw data transfer to PC. Following processing is taken on the PC side.
The device services for analog signal conditioning, ADC sampling and raw data transfer to PC. Following processing is taken on the PC side. The project utilizes modules ATMEGA801B, USBRS232R01B and ADCmonoSPI01B.
 
[InfoLongDescription.cs]
Zařízení provede zákládní zpracování signálu analogovou cestou, navzorkuje daný počet hodnot a odešle je osobnímu počítači. Další zpracování provádí software PC.
Zařízení provede zákládní zpracování signálu analogovou cestou, navzorkuje daný počet hodnot a odešle je osobnímu počítači. Další zpracování provádí software PC. Projekt využívá modulů ATMEGA801B, USBRS232R01B a ADCmonoSPI01B.
 
[End]
/Designs/Oscilloscope/SW/PC_side/qscope/main.cpp
1,3 → 1,5
// qscope, Roman Pavelka, 2011
 
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
15,14 → 17,9
{
Scope *scope = new Scope;
 
// QPushButton *ReadDataBut = new QPushButton(tr("Read data"));
// connect(ReadDataBut, SIGNAL(clicked()), scope, SLOT(getData()));
 
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(scope);
// layout->addWidget(ReadDataBut);
setLayout(layout);
 
}
 
 
/Designs/Oscilloscope/SW/PC_side/qscope/qscope
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Designs/Oscilloscope/SW/PC_side/qscope/scope.cpp
8,24 → 8,27
 
using namespace std;
 
#define LEN 100
#define DEF_SCALE 1
#define TICK 150 // time in ms for one sampling (LEN values)
#define LEN 100 // number of sampled values
 
#define DEF_SCALE 256 //divisor
#define DEF_SHIFT 0
 
#define LEFT 10
#define WIDTH 512
#define HEIGHT 600
#define TOP 10
#define PIXPT_X 4
#define PIXPT_Y 1
#define WIDTH (PIXPT_X*LEN)
#define HEIGHT (PIXPT_Y*512)
 
#define PIXPT 2
 
Scope::Scope(QWidget *parent) {
dataAquired=0;
head=-1;
 
data=new int[LEN*sizeof(int)]; ;
 
int i;
for(i=1;i<LEN;i++)
for(i=0;i<LEN;i++)
data[i]=0;
 
scale=DEF_SCALE;
32,7 → 35,7
shift=DEF_SHIFT;
scaleSlider = new QSlider(Qt::Horizontal);
scaleSlider->setRange(1, 128);
scaleSlider->setRange(1, 256);
scaleSlider->setValue(DEF_SCALE);
connect(scaleSlider, SIGNAL(valueChanged(int)), this, SLOT(setScale(int)));
42,7 → 45,7
connect(shiftSlider, SIGNAL(valueChanged(int)), this, SLOT(setShift(int)));
 
updateTimer = new QTimer(this);
updateTimer->start(150);
updateTimer->start(TICK);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(getData()));
scaleSlider->setGeometry(QRect(50,250,400,10));
64,37 → 67,30
 
QPainter painter(this);
 
if (head>-1)
painter.drawText(10,20,QString::number(data[head]));
/* if (head>-1)
painter.drawText(10,20,QString::number(data[head]));*/
 
if (dataAquired) {
painter.drawLine(LEFT-1,45,LEFT-1,HEIGHT);
painter.drawLine(LEFT+WIDTH,45,LEFT+WIDTH,HEIGHT);
painter.drawLine(LEFT-1,45,LEFT+WIDTH,45);
painter.drawLine(LEFT-1,HEIGHT,LEFT+WIDTH,HEIGHT);
painter.drawLine(LEFT-1,TOP,LEFT-1,TOP+HEIGHT); //verticals
painter.drawLine(LEFT+WIDTH+1,TOP,LEFT+WIDTH+1,TOP+HEIGHT);
 
// painter.drawLine(LEFT-1,HEIGHT/2,LEFT+WIDTH,HEIGHT/2);
painter.drawLine(LEFT-1,TOP,LEFT+WIDTH+1,TOP); //horizontals
painter.drawLine(LEFT-1,TOP+HEIGHT,LEFT+WIDTH+1,TOP+HEIGHT);
painter.drawLine(LEFT-1,TOP+HEIGHT/2,LEFT+WIDTH+1,TOP+HEIGHT/2);
 
int i;
 
/* for(i=head+1;i<LEN-1;i++)
painter.drawLine(PIXPT*(i-head)+LEFT,HEIGHT-data[i],PIXPT*(i-head+1)+LEFT,HEIGHT-data[i+1]);
painter.drawLine(PIXPT*(LEN-head-1)+LEFT,HEIGHT-data[LEN-1],PIXPT*(LEN-head+1)+LEFT,HEIGHT-data[0]);
for(i=0;i<head;i++)
painter.drawLine(PIXPT*(i+LEN-head)+LEFT,HEIGHT-data[i],PIXPT*(i+LEN-head+1)+10,HEIGHT-data[i+1]);*/
 
for(i=0;i<LEN;i++) {
data[i] = (data[i] + shift)/scale;
// data[i] = data[i] + HEIGHT/2;
}
 
for(i=0;i<LEN-1;i++) {
painter.drawLine(PIXPT*i+LEFT,HEIGHT-data[i],PIXPT*(i+1)+10,HEIGHT-data[i+1]);
painter.drawLine(PIXPT_X*i+LEFT,TOP+HEIGHT/2-PIXPT_Y*data[i],PIXPT_X*(i+1)+LEFT,TOP+HEIGHT/2-data[i+1]*PIXPT_Y);
}
}
}
 
 
void Scope::getData() {
char c='m';
uint8_t buffer[2*LEN];
/Designs/Oscilloscope/SW/PC_side/stty_setting
1,2 → 1,0
stty -F /dev/ttyUSB0 1000000 raw -hupcl
 
stty -F /dev/ttyUSB0 1000000 raw -hupcl -echo -echok -echoctl