eduardprivat
Anmeldungsdatum: 29. Mai 2015
Beiträge: Zähle...
|
Hallo Leute,
ich hab mir ein kleines programm zusammengebastelt, dass mir die messergebnisse meines messgeräts ausgibt. hier der code: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | #include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <usb.h>
using namespace std;
int main()
{
char ch;
FILE *datei,*nano;
cout << "\n\nHoldPeak HP-90EPC \n";
cout.flush();
sleep(0);
datei = fopen ( "nano.txt" , "a+" );
nano = fopen ( "/dev/ttyUSB0" , "r" );
if (datei == NULL )
{
printf ("\nDie Datei konnte nicht geöffnet werden.!\nBitte überprüfen sie die Rechte der Datei nano.txt \n");
}
else
{cout << "nano.txt wurde erstellt bzw. konnte geöffnet werden. \n";}
if (nano == NULL){printf( "Messgerät Fehler \n");}else{printf ("Messgerätr erreichbar \n");
while (ch < 5)
{
putchar(fgetc(nano));
}
}
fclose (datei);
cout << "\n\nProgramm bendet \n\a";
return 0;
}
|
soweit so gut. das messgerät sendet brav die daten und so werden die ausgegeben =/
root@mail:/# ./a.out
HoldPeak HP-90EPC
nano.txt wurde erstellt bzw. konnte geöffnet werden.
Messgerätr erreichbar
�xx���xx��������x��xx�x�x���xx��������x��xx�x�x���xx��������x��xx�x�x���xx���� Hat jemand eine Idee, wie ich das in meinem prog einbauen kann, damit ich das
Nr Value Type Time
0 0.560 DCA mA 14:06:38:116
1 0.560 DCA mA 14:06:38:646 erhalte? mfg
xed
|
seahawk1986
Anmeldungsdatum: 27. Oktober 2006
Beiträge: 11180
Wohnort: München
|
Kannst du mal die Datei selbst anhängen? Ich habe den Eindruck durch das Copy&Paste gehen Informationen zu den Byte-Werten verloren:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 | bpython version 0.14.1 on top of Python 3.4.3 /usr/bin/python
>>> a = "�xx���xx��������x��xx�x�x���xx��������x��xx�x�x���xx��������x��xx�x�x���xx����"
>>> for i in a:
... ord(i)
...
65533
120
120
65533
65533
65533
120
120
65533
65533
65533
65533
65533
65533
65533
65533
120
65533
65533
120
120
65533
120
65533
120
65533
65533
65533
120
120
65533
65533
65533
65533
65533
65533
65533
65533
120
65533
65533
120
120
65533
120
65533
120
65533
65533
65533
120
120
65533
65533
65533
65533
65533
65533
65533
65533
120
65533
65533
120
120
65533
120
65533
120
65533
65533
65533
120
120
65533
65533
65533
65533
|
|
frostschutz
Anmeldungsdatum: 18. November 2010
Beiträge: 7658
|
Häng mal ein hexdump -C an. ./a.out | hexdump -C Wenn was sinnvolles dabei ist kann man vielleicht lustig Protokoll raten. Das Messgerät scheint ja nicht Klartext zu schicken.
|
eduardprivat
(Themenstarter)
Anmeldungsdatum: 29. Mai 2015
Beiträge: 8
|
Hallo. seahawk1986: das sind exakt die Zeichen, wie die entnommen werden. die sonderzeichen scheint er nicht lesen zu können. frostschutz: das sind die Daten, die nun ausgegeben wurden. 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 | root@mail:/# ./a.out | hexdump -C
00000000 0a 0a 48 6f 6c 64 50 65 61 6b 20 48 50 2d 39 30 |..HoldPeak HP-90|
00000010 45 50 43 20 0a 6e 61 6e 6f 2e 74 78 74 20 77 75 |EPC .nano.txt wu|
00000020 72 64 65 20 65 72 73 74 65 6c 6c 74 20 62 7a 77 |rde erstellt bzw|
00000030 2e 20 6b 6f 6e 6e 74 65 20 67 65 c3 b6 66 66 6e |. konnte ge..ffn|
00000040 65 74 20 77 65 72 64 65 6e 2e 20 0a 4d 65 73 73 |et werden. .Mess|
00000050 67 65 72 c3 a4 74 72 20 65 72 72 65 69 63 68 62 |ger..tr erreichb|
00000060 61 72 20 0a f8 78 f8 80 c0 78 c0 f8 00 fc 80 78 |ar ..x...x.....x|
00000070 00 f8 fc 78 f8 fc 80 00 f8 78 00 f8 00 f8 00 00 |...x.....x......|
00000080 78 78 f8 78 f8 80 c0 78 c0 f8 00 fc 80 78 00 f8 |xx.x...x.....x..|
00000090 fc 78 f8 fc 80 00 f8 78 00 f8 00 f8 00 00 78 78 |.x.....x......xx|
000000a0 f8 78 f8 80 c0 78 c0 f8 00 fc 80 78 00 f8 fc 78 |.x...x.....x...x|
000000b0 f8 fc 80 00 f8 78 00 f8 00 f8 00 00 78 78 f8 78 |.....x......xx.x|
000000c0 f8 80 c0 78 c0 f8 00 fc 80 78 00 f8 fc 78 f8 fc |...x.....x...x..|
000000d0 80 00 f8 78 00 f8 00 f8 00 00 78 78 f8 78 f8 80 |...x......xx.x..|
000000e0 c0 78 c0 f8 00 fc 80 78 00 f8 fc 78 f8 fc 80 00 |.x.....x...x....|
000000f0 f8 78 00 f8 00 f8 00 00 78 78 f8 78 f8 80 c0 78 |.x......xx.x...x|
00000100 c0 f8 00 fc 80 78 00 f8 fc 78 f8 fc 80 00 f8 78 |.....x...x.....x|
00000110 00 f8 00 f8 00 00 78 78 f8 78 f8 80 c0 78 c0 f8 |......xx.x...x..|
00000120 00 fc 80 78 00 f8 fc 78 f8 fc 80 00 f8 78 00 f8 |...x...x.....x..|
00000130 00 f8 00 00 78 78 f8 78 f8 80 c0 78 c0 f8 00 fc |....xx.x...x....|
00000140 80 78 00 f8 fc 78 f8 fc 80 00 f8 78 00 f8 00 f8 |.x...x.....x....|
00000150 00 00 78 78 00 f8 78 00 c0 00 c0 f8 00 fc 78 78 |..xx..x.......xx|
00000160 80 80 fc 00 fc 00 00 00 80 00 f8 00 f8 00 00 78 |...............x|
00000170 78 f8 78 f8 80 c0 78 c0 78 fc f8 78 f8 f8 fc 80 |x.x...x.x..x....|
00000180 fc f8 00 80 80 00 f8 00 f8 00 00 78 78 f8 78 f8 |...........xx.x.|
00000190 80 c0 78 c0 78 fc f8 78 f8 f8 fc 80 fc f8 00 80 |..x.x..x........|
000001a0 80 00 f8 00 f8 00 00 78 78 f8 78 f8 80 c0 78 c0 |.......xx.x...x.|
000001b0 78 fc f8 78 f8 f8 fc 80 fc f8 00 80 80 00 f8 00 |x..x............|
|
|
frostschutz
Anmeldungsdatum: 18. November 2010
Beiträge: 7658
|
Da wiederholt sich so ziemlich das gleiche... 00000000: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
0000001e: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
0000003c: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
0000005a: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
00000078: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
00000096: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
000000b4: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx
000000d2: f878 f880 c078 c0f8 00fc 8078 00f8 fc78 f8fc 8000 f878 00f8 00f8 0000 7878 .x...x.....x...x.....x......xx Gibts kein fertiges Programm für das Ding? Protokollbeschreibung vielleicht?
|
seahawk1986
Anmeldungsdatum: 27. Oktober 2006
Beiträge: 11180
Wohnort: München
|
Was ist das für ein Messgerät? Vielleicht hat sich da ja schon mal jemand versucht oder es gibt vom Hersteller ein paar Datenblätter...
|
eduardprivat
(Themenstarter)
Anmeldungsdatum: 29. Mai 2015
Beiträge: 8
|
|
frostschutz
Anmeldungsdatum: 18. November 2010
Beiträge: 7658
|
Mein Beitrag wurde scheinbar als Spam markiert. Aber da wiederholt sich erstmal die gleiche Folge von 30 Bytes achtmal hintereinander. evtl. kann 'sigrok' damit umgehen? gibts auch für die Kommandozeile (sigrok-cli)
|
seahawk1986
Anmeldungsdatum: 27. Oktober 2006
Beiträge: 11180
Wohnort: München
|
|
eduardprivat
(Themenstarter)
Anmeldungsdatum: 29. Mai 2015
Beiträge: 8
|
seahawk1986:hab ich schon probiert, nur die http://packages.ubuntu.com/precise/i386/qtdmm/download dateien lassen sich nicht installieren. bekomme andauernd eine error meldung. frostschutz:
| root@mail# sigrok-cli --scan
The following devices were found:
demo - Demo device with 8 probes: 0 1 2 3 4 5 6 7
alsa - ALSA: Ensoniq AudioPCI ES1371 DAC2/ADC with 2 probes: Ch_0 Ch_1
|
da ist leider nicht einmal das usb gerät dabei.
|
seahawk1986
Anmeldungsdatum: 27. Oktober 2006
Beiträge: 11180
Wohnort: München
|
eduardprivat schrieb: seahawk1986:hab ich schon probiert, nur die http://packages.ubuntu.com/precise/i386/qtdmm/download dateien lassen sich nicht installieren. bekomme andauernd eine error meldung.
Dann bau es dir aus den Sourcen für die 0.9.0:
sudo apt-get install libqt4-dev libqt4-dev-tools build-essential
wget http://www.mtoussaint.de/qtdmm-0.9.0.tgz
tar xzfv qtdmm-0.9.0.tgz
cd QtDMM-0.9.0
qmake
make
# Programm ausführen:
./bin/qtdmm
|
frostschutz
Anmeldungsdatum: 18. November 2010
Beiträge: 7658
|
Du müsstest wissen welcher Treiber für dein Gerät passt und direkt angeben. Beispiel aus der Manpage sigrok-cli --driver=ols:conn=/dev/ttyACM0 Oder du könntest das Zeug in eine Datei schreiben (so wie oben nur ohne die Meldungen deines eigenen Programms) und dann sigrok-cli --input-file=datei In der Manpage steht auch daß serielle Geräte nicht bei scan gefunden werden können However, not all devices are auto-detectable (e.g. serial port based ones).
|
eduardprivat
(Themenstarter)
Anmeldungsdatum: 29. Mai 2015
Beiträge: 8
|
seahawk1986: leider nein. hab auch die dateien versucht einzeln zu installieren. das programm will einfach nicht. =/ 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | root@mail:/home/user/Downloads# dpkg -i libqt3-mt_3.3.8-b-8ubuntu3_i386.deb
Selecting previously unselected package libqt3-mt.
(Reading database ... 158885 files and directories currently installed.)
Preparing to unpack libqt3-mt_3.3.8-b-8ubuntu3_i386.deb ...
Unpacking libqt3-mt (3:3.3.8-b-8ubuntu3) ...
dpkg: dependency problems prevent configuration of libqt3-mt:
libqt3-mt depends on libaudio2.
libqt3-mt depends on libjpeg8 (>= 8c).
libqt3-mt depends on libmng1 (>= 1.0.10).
libqt3-mt depends on libstdc++6 (>= 4.1.1).
libqt3-mt depends on libxcursor1 (>> 1.1.2).
libqt3-mt depends on libxft2 (>> 2.1.1).
libqt3-mt depends on libxi6.
dpkg: error processing package libqt3-mt (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libqt3-mt
root@mail:/home/user/Downloads#
|
frostschutz: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 | root@mail:/home/user/Downloads# sigrok-cli --driver=ols:conn=/dev/ttyACM0
Usage:
sigrok-cli [OPTION...]
Help Options:
-h, --help Show help options
Application Options:
-V, --version Show version and support list
-l, --loglevel Set loglevel (5 is most verbose)
-d, --driver The driver to use
-c, --config Specify device configuration options
-i, --input-file Load input from file
-I, --input-format Input format
-o, --output-file Save output to file
-O, --output-format Output format
-p, --probes Probes to use
-t, --triggers Trigger configuration
-w, --wait-trigger Wait for trigger
-P, --protocol-decoders Protocol decoders to run
-S, --protocol-decoder-stack Protocol decoder stack
-A, --protocol-decoder-annotations Protocol decoder annotation(s) to show
--scan Scan for devices
--show Show device detail
--time How long to sample (ms)
--samples Number of samples to acquire
--frames Number of frames to acquire
--continuous Sample continuously
--set Set device options only
root@mail:/home/user/Downloads# sigrok-cli --driver=ols:conn=/dev/ttyUSB0
Usage:
sigrok-cli [OPTION...]
Help Options:
-h, --help Show help options
Application Options:
-V, --version Show version and support list
-l, --loglevel Set loglevel (5 is most verbose)
-d, --driver The driver to use
-c, --config Specify device configuration options
-i, --input-file Load input from file
-I, --input-format Input format
-o, --output-file Save output to file
-O, --output-format Output format
-p, --probes Probes to use
-t, --triggers Trigger configuration
-w, --wait-trigger Wait for trigger
-P, --protocol-decoders Protocol decoders to run
-S, --protocol-decoder-stack Protocol decoder stack
-A, --protocol-decoder-annotations Protocol decoder annotation(s) to show
--scan Scan for devices
--show Show device detail
--time How long to sample (ms)
--samples Number of samples to acquire
--frames Number of frames to acquire
--continuous Sample continuously
--set Set device options only
|
mit sigrok-cli --input-file=test2.txt bekomm ich die binärdatei, nur weiss ich nicht ob die ok ist =/ hab das gleiche auch mit einer test1.txt datei probiert, wo nur bla bla drin stand und das selbe ergebnis erhalten. naja. ob e sich um 1:1 binäre folgen handelte hab ich nicht überprüft, nur es hat fast gleich lang bei der ausgabe gedauert, wie die text2.txt datei 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | 1:00100100 00000000 01001001 00000000 01011010 00000001 00100000 00000010
2:10100110 00001000 00001100 00100100 01001001 01001101 00110000 01000000
3:00010000 10010000 00100000 00010000 00000000 00000000 10000100 10000001
4:10110110 11011001 00101100 10010010 11011010 01101101 10110110 11001001
5:11111111 11111101 10111110 11011011 11111110 11111111 11111111 11101101
6:00000000 00000010 01000001 00100100 00000001 00000000 00000000 00010010
7:00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0:01000001 10110010 10000011 00001100 10110100 00010000 01101100 10100000
1:01000000 00010110 10000000 01001000 00000000 10010000 00000101 10100000
2:00001001 00010010 01010011 01001100 00010000 00000010 01000100 10010100
3:00000100 00000000 00000000 00100001 00100000 01000001 00000000 00000000
4:00100100 10110110 10011011 01101101 10110010 01001001 00101101 10100110
5:10110110 11111111 10111111 11111111 11111011 01101101 10111111 11101111
6:01001001 00000000 01000000 00000000 00000100 10010010 01000000 00010000
7:00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0:11000011 00101101 00000100 00011011 00101000 00110000 11001011 01000001
1:00010010 00000000 00100100 00000001 01101000 00000100 10000000 00001001
2:11010011 00000100 00000000 10010001 00100101 00110100 11000001 00000000
3:00001000 01001000 00010000 01000000 00000000 00000010 00010010 00000100
4:11011011 01101100 10010010 01001011 01101001 10110110 11011011 00100100
5:11111111 11111110 11011011 01101111 11111011 11111111 11111111 10110110
6:00000000 00000001 00100100 10010000 00000100 00000000 00000000 01001001
7:00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0:00000110 11001010 00001100 00110010 11010000 01000001 10110010 10000011
1:00000000 01011010 00000001 00100000 00000010 01000000 00010110 10000000
2:00100100 01001001 01001101 00110000 01000000 00001001 00010010 01010011
3:00010000 00000000 00000000 10000100 10000001 00000100 00000000 00000000
4:10010010 11011010 01101101 10110110 11001001 00100100 10110110 10011011
|
|
seahawk1986
Anmeldungsdatum: 27. Oktober 2006
Beiträge: 11180
Wohnort: München
|
eduardprivat schrieb: seahawk1986: leider nein. hab auch die dateien versucht einzeln zu installieren. das programm will einfach nicht. =/
Die Version 0.9.0 baut gegen qt4, die vorangehenden Versionen benötigen qt3 und das dürfte mit Ubuntu 14.04 recht schwierig werden...
|
eduardprivat
(Themenstarter)
Anmeldungsdatum: 29. Mai 2015
Beiträge: 8
|
so nach langer suche hab ich die fehlenden infos erhalten. Baud: 2400
Bits: 8
Parity: None
Stop Bity: 1
Digits: 4000
Protocol: 14 bytes binary, continous (VCB20)
Numbers of values: 1 ich dachte ich setze alles im programm mithilfe von:
system("stty -F /dev/ttyUSB0 2400 cs8 -cstopb -parity -icanon min 1 time 1");
alles fest ein und schaue, was der mir auswirft. nur check ich nicht ganz, wie ich die digits und den anderen rest einstellen kann. vielleicht hat einer von euch eine idee. thx lg xed
|