No changes between revisions
/Designs/Tools/Oscilloscope/SW/PC_side/gnuradio/ARM_QTgui.grc
0,0 → 1,211
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
<timestamp>Sat Nov 12 20:35:22 2011</timestamp>
<block>
<key>options</key>
<param>
<key>id</key>
<value>top_block</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>title</key>
<value></value>
</param>
<param>
<key>author</key>
<value></value>
</param>
<param>
<key>description</key>
<value></value>
</param>
<param>
<key>window_size</key>
<value>1280, 1024</value>
</param>
<param>
<key>generate_options</key>
<value>qt_gui</value>
</param>
<param>
<key>category</key>
<value>Custom</value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>id</key>
<value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>value</key>
<value>250000</value>
</param>
<param>
<key>_coordinate</key>
<value>(14, 171)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>gr_file_source</key>
<param>
<key>id</key>
<value>gr_file_source_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>file</key>
<value>/dev/ttyUSB0</value>
</param>
<param>
<key>type</key>
<value>short</value>
</param>
<param>
<key>repeat</key>
<value>True</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(71, 385)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>gr_short_to_float</key>
<param>
<key>id</key>
<value>gr_short_to_float_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(397, 317)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>qtgui_sink_x</key>
<param>
<key>id</key>
<value>qtgui_sink_x_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>name</key>
<value>QT GUI Plot</value>
</param>
<param>
<key>fftsize</key>
<value>1024</value>
</param>
<param>
<key>wintype</key>
<value>firdes.WIN_BLACKMAN_hARRIS</value>
</param>
<param>
<key>fc</key>
<value>0</value>
</param>
<param>
<key>bw</key>
<value>samp_rate</value>
</param>
<param>
<key>plotfreq</key>
<value>True</value>
</param>
<param>
<key>plotwaterfall</key>
<value>True</value>
</param>
<param>
<key>plottime</key>
<value>True</value>
</param>
<param>
<key>plotconst</key>
<value>True</value>
</param>
<param>
<key>gui_hint</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(664, 226)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<connection>
<source_block_id>gr_file_source_0</source_block_id>
<sink_block_id>gr_short_to_float_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>gr_short_to_float_0</source_block_id>
<sink_block_id>qtgui_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
</flow_graph>
/Designs/Tools/Oscilloscope/SW/PC_side/gnuradio/ARM_WX_scope.grc
0,0 → 1,223
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
<timestamp>Sat Nov 12 20:32:46 2011</timestamp>
<block>
<key>options</key>
<param>
<key>id</key>
<value>top_block</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>title</key>
<value></value>
</param>
<param>
<key>author</key>
<value></value>
</param>
<param>
<key>description</key>
<value></value>
</param>
<param>
<key>window_size</key>
<value>1280, 1024</value>
</param>
<param>
<key>generate_options</key>
<value>wx_gui</value>
</param>
<param>
<key>category</key>
<value>Custom</value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>id</key>
<value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>value</key>
<value>250000</value>
</param>
<param>
<key>_coordinate</key>
<value>(10, 170)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>gr_file_source</key>
<param>
<key>id</key>
<value>gr_file_source_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>file</key>
<value>/dev/ttyUSB0</value>
</param>
<param>
<key>type</key>
<value>short</value>
</param>
<param>
<key>repeat</key>
<value>True</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(72, 385)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>gr_short_to_float</key>
<param>
<key>id</key>
<value>gr_short_to_float_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(383, 350)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
<value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>title</key>
<value>Scope Plot</value>
</param>
<param>
<key>samp_rate</key>
<value>samp_rate</value>
</param>
<param>
<key>v_scale</key>
<value>0</value>
</param>
<param>
<key>v_offset</key>
<value>0</value>
</param>
<param>
<key>t_scale</key>
<value>0</value>
</param>
<param>
<key>ac_couple</key>
<value>False</value>
</param>
<param>
<key>xy_mode</key>
<value>False</value>
</param>
<param>
<key>num_inputs</key>
<value>1</value>
</param>
<param>
<key>win_size</key>
<value></value>
</param>
<param>
<key>grid_pos</key>
<value></value>
</param>
<param>
<key>notebook</key>
<value></value>
</param>
<param>
<key>trig_mode</key>
<value>gr.gr_TRIG_MODE_AUTO</value>
</param>
<param>
<key>y_axis_label</key>
<value>Counts</value>
</param>
<param>
<key>_coordinate</key>
<value>(671, 292)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<connection>
<source_block_id>gr_file_source_0</source_block_id>
<sink_block_id>gr_short_to_float_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>gr_short_to_float_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
</flow_graph>
/Designs/Tools/Oscilloscope/SW/PC_side/gnuradio/setup_serial.sh
0,0 → 1,4
#!/bin/bash
stty -F /dev/ttyUSB0 igncr -echo onocr icrnl speed 1000000
 
#stty -F /dev/ttyUSB0 3000000
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/Designs/Tools/Oscilloscope/SW/PC_side/gnuradio/top_block.py
0,0 → 1,84
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Sat Nov 12 20:35:22 2011
##################################################
 
from PyQt4 import Qt
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.qtgui import qtgui
from optparse import OptionParser
import sip
import sys
 
class top_block(gr.top_block, Qt.QWidget):
 
def __init__(self):
gr.top_block.__init__(self, "Top Block")
Qt.QWidget.__init__(self)
self.setWindowTitle("Top Block")
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
 
 
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 250000
 
##################################################
# Blocks
##################################################
self.qtgui_sink_x_0 = qtgui.sink_f(
1024, #fftsize
firdes.WIN_BLACKMAN_hARRIS, #wintype
0, #fc
samp_rate, #bw
"QT GUI Plot", #name
True, #plotfreq
True, #plotwaterfall
True, #plottime
True, #plotconst
)
self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_sink_x_0_win)
self.gr_short_to_float_0 = gr.short_to_float()
self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "/dev/ttyUSB0", True)
 
##################################################
# Connections
##################################################
self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0))
self.connect((self.gr_short_to_float_0, 0), (self.qtgui_sink_x_0, 0))
 
def get_samp_rate(self):
return self.samp_rate
 
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.qtgui_sink_x_0.set_frequency_range(0, self.samp_rate)
 
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
qapp = Qt.QApplication(sys.argv)
tb = top_block()
tb.start()
tb.show()
qapp.exec_()
tb.stop()
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/Makefile
0,0 → 1,215
#############################################################################
# Makefile for building: qscope
# Generated by qmake (2.01a) (Qt 4.7.4) on: so 11 12 19:21:14 2011
# Project: qscope.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile qscope.pro
#############################################################################
 
####### Compiler, tools and options
 
CC = gcc
CXX = g++
DEFINES = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
LINK = g++
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
 
####### Output directory
 
OBJECTS_DIR = ./
 
####### Files
 
SOURCES = main.cpp \
scope.cpp moc_scope.cpp
OBJECTS = main.o \
scope.o \
moc_scope.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
qscope.pro
QMAKE_TARGET = qscope
DESTDIR =
TARGET = qscope
 
first: all
####### Implicit rules
 
.SUFFIXES: .o .c .cpp .cc .cxx .C
 
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
 
####### Build rules
 
all: Makefile $(TARGET)
 
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
Makefile: qscope.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/x86_64-linux-gnu/libQtGui.prl \
/usr/lib/x86_64-linux-gnu/libQtCore.prl
$(QMAKE) -o Makefile qscope.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/x86_64-linux-gnu/libQtGui.prl:
/usr/lib/x86_64-linux-gnu/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile qscope.pro
 
dist:
@$(CHK_DIR_EXISTS) .tmp/qscope1.0.0 || $(MKDIR) .tmp/qscope1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qscope1.0.0/ && $(COPY_FILE) --parents scope.h .tmp/qscope1.0.0/ && $(COPY_FILE) --parents main.cpp scope.cpp .tmp/qscope1.0.0/ && (cd `dirname .tmp/qscope1.0.0` && $(TAR) qscope1.0.0.tar qscope1.0.0 && $(COMPRESS) qscope1.0.0.tar) && $(MOVE) `dirname .tmp/qscope1.0.0`/qscope1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qscope1.0.0
 
 
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
 
 
####### Sub-libraries
 
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
 
 
check: first
 
mocclean: compiler_moc_header_clean compiler_moc_source_clean
 
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
 
compiler_moc_header_make_all: moc_scope.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_scope.cpp
moc_scope.cpp: scope.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) scope.h -o moc_scope.cpp
 
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean
 
####### Compile
 
main.o: main.cpp scope.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
 
scope.o: scope.cpp scope.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o scope.o scope.cpp
 
moc_scope.o: moc_scope.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_scope.o moc_scope.cpp
 
####### Install
 
install: FORCE
 
uninstall: FORCE
 
FORCE:
 
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/qscope
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/main.cpp
0,0 → 1,33
// qscope, Roman Pavelka, 2011
 
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
 
#include "scope.h"
 
class Window : public QWidget
{
public:
Window(QWidget *parent = 0);
};
 
Window::Window(QWidget *parent)
: QWidget(parent)
{
Scope *scope = new Scope;
 
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(scope);
setLayout(layout);
}
 
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
window.setGeometry(500, 100, 460, 740);
window.show();
return app.exec();
}
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/moc_scope.cpp
0,0 → 1,84
/****************************************************************************
** Meta object code from reading C++ file 'scope.h'
**
** Created: Mon Aug 15 00:34:35 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
 
#include "scope.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'scope.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 62
#error "This file was generated using the moc from 4.7.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
 
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_Scope[] = {
 
// content:
5, // revision
0, // classname
0, 0, // classinfo
3, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
 
// slots: signature, parameters, type, tag, flags
7, 6, 6, 6, 0x0a,
21, 17, 6, 6, 0x0a,
35, 17, 6, 6, 0x0a,
 
0 // eod
};
 
static const char qt_meta_stringdata_Scope[] = {
"Scope\0\0getData()\0val\0setScale(int)\0"
"setShift(int)\0"
};
 
const QMetaObject Scope::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_Scope,
qt_meta_data_Scope, 0 }
};
 
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &Scope::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
 
const QMetaObject *Scope::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
 
void *Scope::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Scope))
return static_cast<void*>(const_cast< Scope*>(this));
return QWidget::qt_metacast(_clname);
}
 
int Scope::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: getData(); break;
case 1: setScale((*reinterpret_cast< int(*)>(_a[1]))); break;
case 2: setShift((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
_id -= 3;
}
return _id;
}
QT_END_MOC_NAMESPACE
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/scope.cpp
0,0 → 1,151
#include "scope.h"
 
#include <QPainter>
#include <QString>
 
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
void UI(void);
 
Scope::Scope(QWidget *parent) { // CONSTRUCTOR, graphic stuff
dataAquired=0;
 
// data=new int[LEN*sizeof(int)]; ;
 
int i;
for(i=0;i<LEN;i++) // buffer init
data[i]=0;
 
scale=DEF_SCALE; // default coords: data[i] = (data[i] + shift)/scale;
shift=DEF_SHIFT;
scaleSlider = new QSlider(Qt::Horizontal,this);
scaleSlider->setRange(1, 256);
scaleSlider->setValue(DEF_SCALE);
connect(scaleSlider, SIGNAL(valueChanged(int)), this, SLOT(setScale(int)));
shiftSlider = new QSlider(Qt::Horizontal,this);
shiftSlider->setRange(0, +60000);
shiftSlider->setValue(DEF_SHIFT);
connect(shiftSlider, SIGNAL(valueChanged(int)), this, SLOT(setShift(int)));
 
updateTimer = new QTimer(this);
updateTimer->start(TICK);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(getData()));
labels[1] = new QLabel(this);
/*QString tempStr;
tempStr.setNum(shift);
labels[1]->setText("Zero level: " + tempStr);
labels[1]->setGeometry (20, 550, 200, 20);
labels[1]->show();
shiftSlider->setGeometry(QRect(20,580,400,60));
shiftSlider->show();*/
 
 
labels[2] = new QLabel(this);
this->UI();/*
tempStr.setNum(scale);
labels[2]->setText("Divisor: " + tempStr);
labels[2]->setGeometry (20, 630, 400, 20);
labels[2]->show();
scaleSlider->setGeometry(QRect(20,660,400,60));
scaleSlider->show();*/
}
 
void Scope::UI(void) {
QString tempStr;
tempStr.setNum(shift);
labels[1]->setText("Zero level: " + tempStr);
labels[1]->setGeometry (20, 550, 200, 20);
labels[1]->show();
shiftSlider->setGeometry(QRect(20,580,400,60));
shiftSlider->show();
 
tempStr.setNum(scale);
labels[2]->setText("Divisor: " + tempStr);
labels[2]->setGeometry (20, 630, 400, 20);
labels[2]->show();
scaleSlider->setGeometry(QRect(20,660,400,60));
scaleSlider->show();
}
 
 
 
 
 
 
Scope::~Scope() {
delete [] data;
}
 
 
void Scope::paintEvent(QPaintEvent* event) {
 
QPainter painter(this);
 
if (dataAquired) {
painter.drawLine(LEFT-1,TOP,LEFT-1,TOP+HEIGHT); //vertical bound box lines
painter.drawLine(LEFT+WIDTH+1,TOP,LEFT+WIDTH+1,TOP+HEIGHT);
 
painter.drawLine(LEFT-1,TOP,LEFT+WIDTH+1,TOP); //horizontals bound box lines
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=0;i<LEN;i++) {
data[i] = (data[i] - shift)/scale;
}
 
for(i=0;i<LEN-1;i++) {
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);
}
//cout << "Screen updated"<<endl;
}
}
 
 
void Scope::getData() {
char c='m';
 
cout << "Serial transfer start."<<endl;
FILE *serial=fopen("/dev/ttyUSB0","r+");
 
if (serial==NULL) {
cout << "Serial port error."<<endl;
} else {
//cout << "Serial port open."<<endl;
fwrite(&c,sizeof(char),1,serial); // poprosime o data
fread(buffer,sizeof(uint8_t),2*LEN,serial); // a berem je
// cout << "Serial transfer completed."<<endl;
fclose(serial);
int i;
for(i=0;i<LEN;i++) {
data[i]=buffer[2*i]*256+buffer[2*i+1];
// cout << 1*data[i] <<endl;
}
// cout << "Screen updating...."<<endl;
dataAquired=1;
update();
}
}
 
 
void Scope::setScale(int val) {
scale=val;
UI();
}
 
void Scope::setShift(int val) {
shift=val;
UI();
}
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/scope.h
0,0 → 1,55
#ifndef SCOPE_H
#define SCOPE_H
 
#include <QWidget>
#include <QTimer>
#include <QSlider>
#include <stdint.h>
#include <QLabel>
 
#define TICK 250 // time in ms for one sample (LEN values)
#define LEN 100 // number of sampled values
 
#define DEF_SCALE 128 //divisor
#define DEF_SHIFT 37203
 
#define LEFT 10
#define TOP 10
#define PIXPT_X 4
#define PIXPT_Y 1
#define WIDTH (PIXPT_X*LEN)
#define HEIGHT (PIXPT_Y*512)
 
class Scope : public QWidget
{
Q_OBJECT
 
public:
Scope(QWidget *parent = 0);
~Scope();
 
public slots:
void getData();
void setScale(int val);
void setShift(int val);
 
protected:
void paintEvent(QPaintEvent *event);
 
private:
uint8_t buffer[2*LEN];
int data[LEN];
char dataAquired;
void UI(void);
int shift, scale;
 
QTimer *updateTimer;
QSlider *shiftSlider;
QSlider *scaleSlider;
 
QLabel * labels[5];
};
 
#endif
/Designs/Tools/Oscilloscope/SW/PC_side/qscope/qscope.pro
0,0 → 1,12
######################################################################
# Automatically generated by qmake (2.01a) Sun Aug 14 00:40:56 2011
######################################################################
 
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
 
# Input
HEADERS += scope.h
SOURCES += main.cpp scope.cpp
/Designs/Tools/Oscilloscope/SW/PC_side/stty_setting.sh
0,0 → 1,2
#!/bin/bash
stty -F /dev/ttyUSB0 1000000 raw -hupcl -echo -echok -echoctl
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/Makefile
0,0 → 1,33
PRG = scope
OBJ = main.o ./libs/usart.o ./libs/spi.o
MCU_TARGET = atmega8
AVRDUDE_PART = m8
 
OPTIMIZE = -O1
# OPTIMIZE = -Os
 
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
 
all: hex
 
./libs/spi.o: ./libs/spi.h
./libs/usart.o: ./libs/usart.h
#./libs/timer.o: ./libs/timer.h
 
hex: $(PRG).hex
 
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
 
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 
load: $(PRG).hex
avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB0 -B 2 -U flash:w:$<
 
clean:
rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/libs/spi.c
0,0 → 1,20
#include "spi.h"
 
#include <avr/io.h>
 
void SPI_MasterInit(void)
{
/* Enable SPI, Master, set clock rate fck/4, SCK high when idle, sample on rising */
// SPSR|= 0b00000001; //for fck/2
SPCR = 0b01011100;
}
 
char SPI_MasterTransmit(char cData) {
/* Start transmission */
SPDR = cData;
 
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
;
return SPDR;
}
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/libs/spi.h
0,0 → 1,7
#ifndef SPI_H
#define SPI_H
 
void SPI_MasterInit(void);
char SPI_MasterTransmit(char cData);
 
#endif
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/libs/usart.c
0,0 → 1,128
#include "usart.h"
 
#include <avr/io.h>
 
 
void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
 
/* flush transmitt register Double speed */
UCSRA = (1<<UDRE)|(1 << U2X);
 
/* enable receiver interrupt and transmitter, pins forced */
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
 
/* Asynchronous, no parity, Set frame format: 8data, 1stop bit */
UCSRC = (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1);
}
 
 
void USART_Transmit( unsigned char data )
{
while ( !( UCSRA & (1<<UDRE)) ); /* Wait for empty transmit buffer */
 
UDR = data; /* Put data into buffer, sends the data */
}
 
 
void USART_Transmit_string( char *data )
{
while ( *data != 0 ) {
USART_Transmit(*data);
data++;
}
}
 
 
void USART_Transmit_longnum(signed long data ) {
unsigned char digits[10],i;
 
if (data==0)
USART_Transmit('0');
else { // PROZKOUMAT!
 
if (data<0) {
USART_Transmit('-');
data*=-1;
}
 
for (i=0;i<10;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=9;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_uint16 (unsigned int data ) {
unsigned char digits[5],i;
 
if (data==0) //podivne, ale nulu to odeslat neumi
USART_Transmit('0');
else {
 
for (i=0;i<5;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=4;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_num(unsigned char data ) {
unsigned char a,b,c;
 
c=data%10;
data=data/10;
b=data%10;
data=data/10;
a=data%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}
 
 
/*void USART_Transmit_float( float data ) {
int a,b,c;
 
c=((int)data)%10;
b=((int)(data/10))%10;
a=((int)(data/100))%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}*/
 
 
void USART_Transmit_byte( char data ) {
unsigned char i;
i=0b10000000;
while (i) {
USART_Transmit( ( (i&data)&&1 ) + 48 );
i>>=1;
}
}
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/libs/usart.h
0,0 → 1,17
#ifndef USART_H
#define USART_H
 
//Inits:
void USART_Init( unsigned int ubrr); // 8b, no parity, 1 stop
// asynchronous, RX interrupt
 
// Busy loops:
void USART_Transmit( unsigned char data ); // send char (1B)
void USART_Transmit_string( char *data ); // send string
void USART_Transmit_num( unsigned char data ); // send ascii
void USART_Transmit_longnum( signed long data ); // send ascii
void USART_Transmit_uint16( unsigned int data ); // send ascii
//void USART_Transmit_float( float data );
void USART_Transmit_byte( char data ); //send in ascii hex reprezentation
 
#endif
/Designs/Tools/Oscilloscope/SW/firmware/gnuradio/main.c
0,0 → 1,38
// Oscilloscope firmware, Roman Pavelka, 2011
// written for atmega8
 
#define F_CPU 16000000
#define BAUD 1000000
//#define MYUBRR F_CPU/8/BAUD-1
#define MYUBRR 1
 
#include "./libs/usart.h"
#include "./libs/spi.h"
 
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <inttypes.h>
 
int main (void) {
USART_Init(MYUBRR);
 
DDRB = 0b00100100; //SCK, SS out
PORTB = 0b00000000; // CONV low
 
SPI_MasterInit();
 
 
while(1)
{
PORTB |= 0b00000100;
_delay_us(4);
PORTB &= 0b11111011; //one conversion
 
USART_Transmit(SPI_MasterTransmit(0x0)); //Binary transfer
USART_Transmit(SPI_MasterTransmit(0x0));
_delay_us(4);
}
return 0;
}
 
/Designs/Tools/Oscilloscope/SW/firmware/Makefile
0,0 → 1,33
PRG = scope
OBJ = main.o ./libs/usart.o ./libs/spi.o
MCU_TARGET = atmega8
AVRDUDE_PART = m8
 
OPTIMIZE = -O1
# OPTIMIZE = -Os
 
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
 
all: hex
 
./libs/spi.o: ./libs/spi.h
./libs/usart.o: ./libs/usart.h
#./libs/timer.o: ./libs/timer.h
 
hex: $(PRG).hex
 
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
 
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 
load: $(PRG).hex
avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB0 -B 2 -U flash:w:$<
 
clean:
rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o
 
Property changes:
Added: svn:executable
/Designs/Tools/Oscilloscope/SW/firmware/scope.elf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Tools/Oscilloscope/SW/firmware/scope.hex
0,0 → 1,67
:1000000012C021C020C01FC01EC01DC01CC01BC00C
:100010001AC019C018C053C016C015C014C013C0F0
:1000200012C011C010C011241FBECFE5D4E0DEBF46
:10003000CDBF11E0A0E6B0E001C01D92A832B1072B
:10004000E1F702D0E8C1DCCF81E090E05FD084E24C
:1000500087BB18BA7BD17894FFCF0F931F93CF93B0
:10006000DF93C0E6D0E008E211E0C29A85E18A950C
:10007000F1F70000C29880E06CD1888380E069D1FC
:1000800089832296C017D10781F7DF91CF911F9105
:100090000F9108950F931F93CF93DF93C0E6D0E0A5
:1000A00008E211E088813BD0898139D02296C017BF
:1000B000D107C1F7DF91CF911F910F9108951F9242
:1000C0000F920FB60F9211242F933F934F935F938C
:1000D0006F937F938F939F93AF93BF93EF93FF9310
:1000E0008CB18D3611F4B9DFD5DFFF91EF91BF915F
:1000F000AF919F918F917F916F915F914F913F91C0
:100100002F910F900FBE0F901F90189590BD89B939
:1001100082E28BB988E98AB986E880BD08955D9B43
:10012000FECF8CB90895CF93DF93EC0188818823AB
:1001300029F02196F4DF89918823E1F7DF91CF91AF
:1001400008956F927F928F929F92AF92BF92CF92BB
:10015000DF92EF92FF920F931F93DF93CF93CDB770
:10016000DEB72A970FB6F894DEBF0FBECDBF7B0176
:100170008C01611571058105910519F480E3CFDFCC
:1001800050C0992354F48DE2CADF10950095F09485
:10019000E094E11CF11C011D111D6E010894C11CAD
:1001A000D11C0F2EFBE06F2E7724F02D6C0E7D1EE0
:1001B0000F2EFAE08F2EF0E09F2EF0E0AF2EF0E051
:1001C000BF2EF02DC801B701A5019401E7D0F601BB
:1001D00061936F01E22EF32E042F152FE615F7051C
:1001E00089F78A85882311F019E00CC019E0CE0147
:1001F00001961150FC01E10FF11D20812223C9F36A
:10020000112361F07E010894E11CF11CF701E10F5C
:10021000F11D8081805D83DF1150C1F78981805D90
:100220007EDF2A960FB6F894DEBF0FBECDBFCF910A
:10023000DF911F910F91FF90EF90DF90CF90BF90D3
:10024000AF909F908F907F906F900895FF920F9343
:100250001F93DF93CF9300D000D00F92CDB7DEB7BE
:10026000009719F480E35BDF32C0FE0131968E0106
:100270000A5F1F4F2AE030E0B9017CD08193862FBE
:10028000972FE017F107C1F78D81882321F0FF2414
:100290006894F2F80EC0FF246894F2F8CE0101963B
:1002A000FA94FC01EF0DF11D20812223C9F3FF20F8
:1002B00059F08E010F5F1F4FF801EF0DF11D808186
:1002C000805D2DDFFA94C1F78981805D28DF0F9072
:1002D0000F900F900F900F90CF91DF911F910F9182
:1002E000FF9008950F931F932AE0622F37D0192FA4
:1002F00035D0092F33D0892F805D11DF802F805DAD
:100300000EDF812F805D0BDF1F910F910895EF921B
:10031000FF921F93CF93DF93C8E0D0E010E8E82E60
:10032000FF24E7FCF094812F90E08E219F2100971D
:1003300011F081E301C080E3F2DE1695219799F771
:10034000DF91CF911F91FF90EF9008958CE58DB9CB
:1003500008958FB9779BFECF8FB10895991B79E0EF
:1003600004C0991F961708F0961B881F7A95C9F745
:1003700080950895AA1BBB1B51E107C0AA1FBB1F94
:10038000A617B70710F0A61BB70B881F991F5A9521
:10039000A9F780959095BC01CD01089597FB092E92
:1003A00005260ED057FD04D014D00AD0001C38F416
:1003B00050954095309521953F4F4F4F5F4F089591
:1003C000F6F790958095709561957F4F8F4F9F4F71
:1003D0000895A1E21A2EAA1BBB1BFD010DC0AA1F86
:1003E000BB1FEE1FFF1FA217B307E407F50720F09E
:1003F000A21BB30BE40BF50B661F771F881F991F19
:100400001A9469F760957095809590959B01AC0161
:0A041000BD01CF010895F894FFCF5D
:00000001FF
/Designs/Tools/Oscilloscope/SW/firmware/libs/spi.c
0,0 → 1,20
#include "spi.h"
 
#include <avr/io.h>
 
void SPI_MasterInit(void)
{
/* Enable SPI, Master, set clock rate fck/4, SCK high when idle, sample on rising */
// SPSR|= 0b00000001; //for fck/2
SPCR = 0b01011100;
}
 
char SPI_MasterTransmit(char cData) {
/* Start transmission */
SPDR = cData;
 
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
;
return SPDR;
}
/Designs/Tools/Oscilloscope/SW/firmware/libs/spi.h
0,0 → 1,7
#ifndef SPI_H
#define SPI_H
 
void SPI_MasterInit(void);
char SPI_MasterTransmit(char cData);
 
#endif
/Designs/Tools/Oscilloscope/SW/firmware/libs/usart.c
0,0 → 1,128
#include "usart.h"
 
#include <avr/io.h>
 
 
void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
 
/* flush transmitt register Double speed */
UCSRA = (1<<UDRE)|(1 << U2X);
 
/* enable receiver interrupt and transmitter, pins forced */
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
 
/* Asynchronous, no parity, Set frame format: 8data, 1stop bit */
UCSRC = (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1);
}
 
 
void USART_Transmit( unsigned char data )
{
while ( !( UCSRA & (1<<UDRE)) ); /* Wait for empty transmit buffer */
 
UDR = data; /* Put data into buffer, sends the data */
}
 
 
void USART_Transmit_string( char *data )
{
while ( *data != 0 ) {
USART_Transmit(*data);
data++;
}
}
 
 
void USART_Transmit_longnum(signed long data ) {
unsigned char digits[10],i;
 
if (data==0)
USART_Transmit('0');
else { // PROZKOUMAT!
 
if (data<0) {
USART_Transmit('-');
data*=-1;
}
 
for (i=0;i<10;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=9;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_uint16 (unsigned int data ) {
unsigned char digits[5],i;
 
if (data==0) //podivne, ale nulu to odeslat neumi
USART_Transmit('0');
else {
 
for (i=0;i<5;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=4;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_num(unsigned char data ) {
unsigned char a,b,c;
 
c=data%10;
data=data/10;
b=data%10;
data=data/10;
a=data%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}
 
 
/*void USART_Transmit_float( float data ) {
int a,b,c;
 
c=((int)data)%10;
b=((int)(data/10))%10;
a=((int)(data/100))%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}*/
 
 
void USART_Transmit_byte( char data ) {
unsigned char i;
i=0b10000000;
while (i) {
USART_Transmit( ( (i&data)&&1 ) + 48 );
i>>=1;
}
}
/Designs/Tools/Oscilloscope/SW/firmware/libs/usart.h
0,0 → 1,17
#ifndef USART_H
#define USART_H
 
//Inits:
void USART_Init( unsigned int ubrr); // 8b, no parity, 1 stop
// asynchronous, RX interrupt
 
// Busy loops:
void USART_Transmit( unsigned char data ); // send char (1B)
void USART_Transmit_string( char *data ); // send string
void USART_Transmit_num( unsigned char data ); // send ascii
void USART_Transmit_longnum( signed long data ); // send ascii
void USART_Transmit_uint16( unsigned int data ); // send ascii
//void USART_Transmit_float( float data );
void USART_Transmit_byte( char data ); //send in ascii hex reprezentation
 
#endif
/Designs/Tools/Oscilloscope/SW/firmware/main.c
0,0 → 1,79
// Oscilloscope firmware, Roman Pavelka, 2011
// written for atmega8
 
#define F_CPU 16000000
#define BAUD 1000000
//#define MYUBRR F_CPU/8/BAUD-1
#define MYUBRR 1
 
#include "./libs/usart.h"
#include "./libs/spi.h"
 
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <inttypes.h>
 
#define LEN 100
uint8_t data[2*LEN];
 
void measure(void);
void send(void);
 
 
int main (void) {
USART_Init(MYUBRR);
 
DDRB = 0b00100100; //SCK, SS out
PORTB = 0b00000000; // CONV low
 
SPI_MasterInit();
 
sei();
 
while(1) {}
 
return 0;
 
}
 
 
void measure(void) {
uint8_t i;
 
for(i=0;i<LEN;i++) {
PORTB |= 0b00000100;
_delay_us(4);
PORTB &= 0b11111011; //one conversion
 
data[2*i] = SPI_MasterTransmit(0x0);
data[2*i+1] = SPI_MasterTransmit(0x0);
}
}
 
void send(void) {
uint8_t i;
 
for(i=0;i<LEN;i++) {
 
/* USART_Transmit_uint16(data[i]); //ASCII transfer
USART_Transmit('\n');*/
 
USART_Transmit(data[2*i]); //Binary transfer
USART_Transmit(data[2*i+1]);
// USART_Transmit('\n');
 
}
}
 
 
ISR(USART_RXC_vect) {
char data;
 
data=UDR; //must be read to untrigger interupt
 
if (data=='m') {
measure();
send();
}
}
/Designs/Tools/Oscilloscope/DOC/stav.txt
0,0 → 1,16
Zatim je zprovezneno zakladni samplovani a binarni data transfer na strane atmegy a
prijem a zobrazeni dat na strane PC. Ovladani uz nejak vypada. Je k dispozici zapojeni modulu.
 
CHYBI:
Zakladni dokumentace. Nakreslit schema analogove cesty.
Oboustrana komunikace.
Nastavitelny time base. Mereni time base pomoci timeru.
Implementovan trigger (vemu ze sveho starsiho projektu).
Mody on-first-trigger, on-every-trigger, logger (slow)
 
Budoucnost:
Spinatelna reference/bias, automaticka kalibrace.
Spektralni analyza.
Propojit se signalovym generatorem.
Vymyslet, jak posilat a zobrazovat vice kanalu a nastavovat generator prubehu
 
/Designs/Tools/Oscilloscope/SCH/Oscilloscope_SCH.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Tools/Oscilloscope/SCH/Oscilloscope_SCH.ps
0,0 → 1,245
%!PS-Adobe-3.0
%%Title: Oscilloscope_SCH.ps
%%Creator: XCircuit v3.6 rev165
%%CreationDate: Mon Aug 15 01:46:54 2011
%%Pages: 1
%%BoundingBox: 0 0 612 792
%%DocumentNeededResources: font Helvetica Times-Roman
%%EndComments
%%BeginProlog
%
% PostScript prolog for output from xcircuit
% Version: 3.3
%
% Electrical circuit (and otherwise general) drawing program
%
% Written by Tim Edwards 8/5/93--7/13/05 (tim.edwards@multigig.com)
% The Johns Hopkins University (1993-2004)
% MultiGiG, Inc. (2004-present)
%
%%BeginResource: procset XCIRCproc 3.3 0
%
% supporting definitions --- these are the primary xcircuit types.
 
/XCIRCsave save def
/topmat matrix currentmatrix def
 
/fontslant { /slant exch def [1 0 slant 1 0 0]
exch findfont exch makefont dup length dict /ndict exch def
{ 1 index /FID ne { ndict 3 1 roll put } { pop pop } ifelse } forall
ndict definefont pop} def
/ul { dup type /stringtype eq showflag 1 eq and { gsave
currentpoint topmat setmatrix 0 0 moveto 2 index stringwidth pop (_)
false charpath flattenpath pathbbox grestore exch pop 1 index
sub setlinewidth exch pop currentpoint 3 -1 roll add moveto 0
rlineto stroke moveto } if } def
/ol { dup type /stringtype eq showflag 1 eq and { gsave gsave
currentpoint topmat setmatrix 2 index stringwidth pop 3 index
true charpath flattenpath pathbbox grestore exch pop
exch pop topmat setmatrix (_) true charpath pathbbox grestore
exch pop 1 index sub setlinewidth exch pop currentpoint
exch 4 1 roll exch sub add moveto pop 0 rlineto stroke
moveto } if } def
/stW { gsave currentpoint newpath moveto true charpath flattenpath
pathbbox pop exch pop sub grestore } def
/Ts {mark Tabs aload pop counttomark 1 add array astore /Tabs exch def Tabs
0 currentpoint pop put} def
/Tbn {mark Tabs aload pop counttomark dup 2 add 1 roll cleartomark 1 sub} def
/Tb { 0 1 Tbn {Tabs exch get dup currentpoint pop lt
{currentpoint exch pop moveto exit} {pop} ifelse } for } def
/Tf { Tbn -1 0 {Tabs exch get dup currentpoint pop gt
{currentpoint exch pop moveto exit} {pop} ifelse } for } def
/qS { (aa) stW (a a) stW sub 4 div 0 Kn } def
/hS { qS qS } def
/pspc 0 def
/cf0 { scalefont setfont } bind def
/Kn { dup kY add /kY exch def rmoveto } bind def
/ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
0.33 mul neg Kn} def
/Ss { /fscale fscale 0.67 mul def currentfont 0.67 cf0 0 fscale0 fscale mul
0.67 mul Kn } def
/ns { 0 kY neg Kn /kY 0 def /fscale 1.0 def xfont0 1.0 cf0 } def
/CR { ns 0 /Bline Bline fscale0 neg add def Bline moveto } def
/cf { dup type /realtype ne {1.0} if exch findfont exch kY 0 eq
{ 40 mul dup /fscale0 exch def cf0 /xfont0 currentfont def}
{fscale0 mul fscale mul cf0} ifelse } def
/ctmk { counttomark dup 2 add -1 roll pop } bind def
/label { gsave translate 0 0 moveto dup scale neg /rotval exch def
/just exch def just 384 and 0 gt {/mshow {pop} def} {/mshow {show}
def} ifelse just 16 and 0 gt {gsave rotval rotate 0 1 dtransform
gsave pagemat setmatrix idtransform exch grestore 1 0 dtransform
gsave pagemat setmatrix idtransform exch grestore dup abs 1e-9 lt
{pop mul 0 gt} {3 1 roll pop pop 0 lt} ifelse grestore {-1 /rotval
rotval neg def /just just dup 3 and 1 ne {3 xor} if def} {1} ifelse
exch -1e-9 lt {-1 /rotval rotval neg def /just just dup 12 and
4 ne {12 xor} if def} {1} ifelse scale } if /showflag 0 def
/fspc pspc def /Bline 0 def /Tabs 0 array def /fscale 1.0 def
/kY 0 def gsave dup 1 add copy 0 exch 1 0 dtransform exch atan rotate
{exch dup type /stringtype eq {true charpath flattenpath} {dup type
/arraytype eq {exec} {12 string cvs true charpath flattenpath} ifelse}
ifelse} repeat pop pathbbox grestore 3 -1 roll pop 3 1 roll just
1 and 0 gt {just 2 and 0 gt {exch pop neg fspc sub} {exch sub 0.5
mul neg} ifelse} {pop neg fspc add} ifelse exch Bline exch just 4
and 0 gt {just 8 and 0 gt {exch pop neg fspc sub} {add 0.5 mul neg}
ifelse} {pop neg fspc add} ifelse rotval rotate Kn currentpoint
translate /showflag 1 def /Bline 0 def /Tabs 0 array def /fscale
1.0 def /kY 0 def {dup type /stringtype eq {mshow} {dup type
/arraytype eq {exec} {12 string cvs mshow} ifelse} ifelse} repeat
grestore } def
/pinlabel { 4 index 32 and 0 ne hlevel 0 eq or { /pspc 10 def label
/pspc 0 def } { pop pop pop pop pop {pop} repeat } ifelse } def
/pinglobal { pinlabel } def
/infolabel { pinlabel } def
/graphic { gsave 4 index cvx exec /DataSource get resetfile translate
0 0 moveto neg rotate dup scale cvx exec image grestore } def
 
/scb { setrgbcolor } bind def /sce { defColor aload pop scb } bind def
/cRedef {/defColor currentcolor 3 array astore def} def
/begingate {dup type /dicttype ne {1 dict} if begin % default params
dup type /dicttype ne {1 dict} if begin % instanced params
/hlevel hlevel 1 add def /defColor currentcolor sce 3 array
astore def gsave sce translate 0 0 moveto neg rotate dup abs scale
} bind def
/endgate { /hlevel hlevel 1 sub def grestore defColor aload pop cRedef
scb end end} bind def
 
/hlevel 0 def
/tmpa [1 0 0 1 0 0] def
/gar {8 8 true tmpa {<c0 c0 00 00 0c 0c 00 00>} imagemask} bind
{8 8 true tmpa {<30 70 60 02 03 07 06 20>} imagemask} bind
{8 8 true tmpa {<0c 1e 1e 0c c0 e1 e1 c0>} imagemask} bind
{8 8 true tmpa {<0f 0f 0f 0f f0 f0 f0 f0>} imagemask} bind
{8 8 true tmpa {<3f f3 e1 e1 f3 3f 1e 1e>} imagemask} bind
{8 8 true tmpa {<df cf 8f 9f fd fc f8 f9>} imagemask} bind
{8 8 true tmpa {<ff 3f 3f ff ff f3 f3 ff>} imagemask} bind 7 array astore def
/ppaint { gsave clip tmpa dup setmatrix pathbbox neg exch neg 4 2 roll
neg 4 -1 roll 2 copy gt {exch} if 8 div ceiling 8 mul 4 2 roll neg 2 copy
gt {exch} if 8 div ceiling 8 mul 3 -1 roll -8 5 -1 roll
{ 3 index exch 5 exch put dup -8 3 index { 3 index
exch 4 exch put 3 index exec } for } for pop pop pop pop grestore } bind def
/setstyles {
currentlinewidth mul setlinewidth /style exch def
style 1 and 0 gt not {closepath} if
style 1024 and 0 gt {2 setlinecap} if
style 2 and 0 gt {currentlinewidth 4 mul dup 2 array astore 0 setdash} if
style 4 and 0 gt {0.5 currentlinewidth 4 mul 2 array astore 0 setdash} if
gsave style 16 and 0 gt { style 224 and -5 bitshift style 256 and 0 gt {
7 exch sub 8 div dup 1 exch sub currentrgbcolor 3 array astore
{3 copy mul add 4 1 roll pop} forall pop pop setrgbcolor eofill}
{dup 7 lt {gar exch get ppaint} {pop eofill} ifelse} ifelse}
{style 256 and 0 gt {1 setgray eofill} if} ifelse grestore style 8 and 0 gt
style 512 eq or {newpath} {stroke} ifelse grestore} def
 
/polygon { gsave /num exch def moveto num 1 sub {lineto} repeat setstyles } def
/xcarc { gsave newpath arc setstyles } def
/elb { matrix currentmatrix 7 -1 roll 7 -1 roll translate 5 1 roll 4 -1 roll
3 index div 1 scale } def
/ele { 0 4 1 roll 0 4 1 roll } bind def
/ellipse { gsave elb newpath ele arc setmatrix setstyles } def
/pellip { elb ele arc setmatrix } def
/nellip { elb ele arcn setmatrix } def
/spline { gsave moveto curveto setstyles } def
/polyc { {lineto} repeat } bind def
/beginpath { gsave moveto } bind def
/endpath { setstyles } bind def
/bop { 1 setlinecap 0 setlinejoin 6 setmiterlimit 0 0 0 scb cRedef } def
/psinsertion {/PSobj save def /showpage {} def /setpagedevice {pop} def bop
rotate translate dup scale} def
/end_insert {PSobj restore} def
/setpagemat {/pagemat matrix currentmatrix def} def
/inchscale {setpagemat 0.375 mul dup scale} def
/cmscale {setpagemat 0.35433071 mul dup scale} def
 
%%EndResource
%%EndProlog
 
% XCircuit output starts here.
 
%%BeginSetup
 
/generic::circle {
% trivial
begingate
1 1.000 16 0 6 0.000 360.000 xcarc
1 1.000 0 0 10 0 2 polygon
1.000 0.000 0.000 scb
(out) {/Times-Roman cf} 2 4 0 1.000 16 0 pinlabel
(out) {/Times-Roman cf} 2 7 0 1.000 0 0 pinlabel
endgate
} def
 
 
%%EndSetup
 
%%Page: Oscilloscope_SCH 1
%%PageOrientation: Portrait
%%PageBoundingBox: 0 0 612 792
/pgsave save def bop
0.8571 inchscale
2.6000 setlinewidth 1728 1472 translate
 
(Personal computer) {/Helvetica cf} 2 16 0 1.000 -1072 432 label
(ATprogISPUSBA01) {/Helvetica cf} 2 21 0 1.000 -1168 128 label
(USB232R01B) {/Helvetica cf} 2 21 0 1.000 -688 128 label
(ATMEGA801B) {/Helvetica cf} 2 16 0 1.000 -1056 -160 label
(ADCmonoSPI01B) {/Helvetica cf} 2 21 0 1.000 -400 -480 label
(USB) {/Helvetica cf} 2 16 0 1.000 -688 272 label
(USB) {/Helvetica cf} 2 16 0 1.000 -1152 272 label
(AT PC supply unit) {/Helvetica cf} 2 16 0 1.000 -1472 -928 label
(Analog power supply) {/Helvetica cf} 2 16 0 1.000 -912 -960 label
(+/-8 V) {/Helvetica cf} 2 21 0 1.000 -816 -896 label
(5 V) {/Helvetica cf} 2 21 0 1.000 -640 -896 label
(TX) {/Helvetica cf} 2 16 0 1.000 -848 -80 label
(RX) {/Helvetica cf} 2 16 0 1.000 -784 -80 label
(ISP 6-pin) {/Helvetica cf} 2 20 0 1.000 -1472 -256 label
(RX) {/Helvetica cf} 2 16 0 1.000 -784 32 label
(TX) {/Helvetica cf} 2 16 0 1.000 -848 32 label
(5 V) {/Helvetica cf} 2 21 0 1.000 -528 16 label
(50 kHz lowpass) {/Helvetica cf} 2 16 0 1.000 -1056 -688 label
(bias 2.5 V) {/Helvetica cf} 2 16 0 1.000 -704 -688 label
(protection clamp) {/Helvetica cf} 2 16 0 1.000 -448 -688 label
(INPUT) {/Helvetica cf} 2 16 0 1.000 -1488 -688 label
0 1.000 -1376 512 -1376 384 -432 384 -432 512 4 polygon
0 1.000 -1376 192 -1376 64 -944 64 -944 192 4 polygon
0 1.000 -896 192 -896 64 -464 64 -464 192 4 polygon
0 1.000 -1168 -96 -1168 -352 -656 -352 -656 -96 4 polygon
(SPI) {/Helvetica cf} 2 16 0 1.000 -1136 -336 label
1 1.000 -1168 192 -1168 384 2 polygon
1 1.000 -688 192 -688 384 2 polygon
1 1.000 -848 64 -848 0 -784 -32 -784 -96 4 polygon
1 1.000 -784 64 -784 0 -848 -32 -848 -96 4 polygon
1 1.000 -1296 64 -1296 -400 -1104 -400 -1104 -352 4 polygon
1 1.000 -1344 -688 -1216 -688 2 polygon
1 1.000 -1216 -688 -1216 -608 -1120 -688 -1216 -768 -1216 -688 5 polygon
1 1.000 -576 64 -576 -128 2 polygon
1 1.000 -576 -128 -656 -192 2 polygon
1 1.000 -256 -432 -576 -432 -576 -528 -256 -528 -192 -480 -256 -432 6 polygon
0 1.000 -1072 -624 -1072 -736 -752 -736 -752 -624 4 polygon
0 1.000 -720 -624 -720 -736 -496 -736 -496 -624 4 polygon
0 1.000 -464 -624 -464 -736 -144 -736 -144 -624 4 polygon
0 1.000 -944 -864 -944 -992 -528 -992 -528 -864 4 polygon
-1.000 0 -1344 -688 generic::circle
1 1.000 -1120 -688 -1072 -688 2 polygon
1 1.000 -752 -688 -720 -688 2 polygon
1 1.000 -496 -688 -464 -688 2 polygon
1 1.000 -144 -688 -112 -688 -112 -480 -192 -480 4 polygon
1 1.000 -576 -480 -1088 -480 -1088 -352 3 polygon
(SCK,SDO) {/Helvetica cf} 2 16 0 1.000 -752 -512 label
(SCK,MISO) {/Helvetica cf} 2 16 0 1.000 -1088 -384 label
1 1.000 -880 -352 -880 -464 -576 -464 3 polygon
(SS) {/Helvetica cf} 2 16 0 1.000 -880 -384 label
(CONV) {/Helvetica cf} 2 16 0 1.000 -704 -448 label
1 1.000 -832 -864 -832 -736 2 polygon
1 1.000 -816 -864 -816 -816 -720 -736 3 polygon
1 1.000 -800 -864 -800 -832 -720 -768 -432 -768 -400 -736 5 polygon
1 1.000 -640 -864 -640 -848 -592 -800 -176 -800 -48 -704 -48 -448 -128 -368
-352 -368 -400 -416 -400 -432 10 polygon
(5 V) {/Helvetica cf} 2 21 0 1.000 -304 -336 label
0 1.000 -1504 -864 -1504 -992 -1136 -992 -1136 -864 4 polygon
1 1.000 -1136 -928 -944 -928 2 polygon
(+/- 12 V) {/Helvetica cf} 2 16 0 1.000 -1120 -912 label
pgsave restore showpage
 
%%Trailer
XCIRCsave restore
%%EOF
/Designs/Tools/Oscilloscope/PrjInfo.txt
0,0 → 1,14
 
[InfoShortDescription.en]
Simple low frequency oscilloscope project.
 
[InfoShortDescription.cs]
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 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. Projekt využívá modulů ATMEGA801B, USBRS232R01B a ADCmonoSPI01B.
 
[End]