git://git.jankratochvil.net
/
lptgpib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-debug
[lptgpib.git]
/
terminal.c
diff --git
a/terminal.c
b/terminal.c
index
8ca8cdd
..
188b695
100644
(file)
--- a/
terminal.c
+++ b/
terminal.c
@@
-7,7
+7,7
@@
#include <sys/io.h>
#include <limits.h>
#include <sys/io.h>
#include <limits.h>
-static const int zdroj_adresa=
1
;
+static const int zdroj_adresa=
20
;
// lptgpib.c
#define get_control() (inb(lpt_base+2) ^ 0x04)
// lptgpib.c
#define get_control() (inb(lpt_base+2) ^ 0x04)
@@
-20,28
+20,24
@@
static const int zdroj_adresa=1;
extern int lpt_base;
int main(int argc,char **argv) {
extern int lpt_base;
int main(int argc,char **argv) {
+ setbuf(stdout,NULL);
lptgpib_init(0x378);
int init=1;
for (;;) {
// GPIB -> obrazovka
if (init) {
lptgpib_init(0x378);
int init=1;
for (;;) {
// GPIB -> obrazovka
if (init) {
- fprintf(stderr,"Inicializuji port... ");
lptgpib_command(UNL);
lptgpib_command(MLA+0);
lptgpib_command(MTA+zdroj_adresa);
lptgpib_command(UNL);
lptgpib_command(MLA+0);
lptgpib_command(MTA+zdroj_adresa);
- fprintf(stderr,"hotovo.\n");
init=0;
}
put_control(TRI | NDAC); /* clear NRFD */
usleep(1000000/10);
if (get_control()&DAV) { /* wait for DAV */
init=0;
}
put_control(TRI | NDAC); /* clear NRFD */
usleep(1000000/10);
if (get_control()&DAV) { /* wait for DAV */
- fprintf(stderr,"ctu znak...\n");
char flags,val=lptgpib_read_byte(&flags);
char flags,val=lptgpib_read_byte(&flags);
- if (flags&ATN)
- lptgpib_print_command(val);
- else
- fprintf(stderr,"precten znak: %02x (%c)\n",val,val);
+ if (!(flags&ATN))
+ putchar(val);
}
put_control(TRI | NDAC | NRFD ); /* back to default state */
usleep(1000000/10); /* chvili pockat, asi zbytecne, jen aby to bylo videt na portu */
}
put_control(TRI | NDAC | NRFD ); /* back to default state */
usleep(1000000/10); /* chvili pockat, asi zbytecne, jen aby to bylo videt na portu */
@@
-60,9
+56,8
@@
int main(int argc,char **argv) {
assert(s);
assert(s[1]==0);
*s=0;
assert(s);
assert(s[1]==0);
*s=0;
- fprintf(stderr,"zapisuji radek: %s\n",str);
lptgpib_write(zdroj_adresa,str);
lptgpib_write(zdroj_adresa,str);
-
fprintf(stderr,"zapsan radek.\n")
;
+
init=1
;
}
}
}
}