X-Git-Url: http://git.jankratochvil.net/?p=lptgpib.git;a=blobdiff_plain;f=terminal.c;h=b3c460eb5331d59ade3ab53c44ce2f77a4e22ce8;hp=c0ceafdc5edd9d36de0596abbeb419bcc640ea46;hb=a5f79a5362f7a39266a4ba33abf76eec004cf805;hpb=04d93746d425f830cf4ad933c2cb7ce53a378be6 diff --git a/terminal.c b/terminal.c index c0ceafd..b3c460e 100644 --- a/terminal.c +++ b/terminal.c @@ -7,7 +7,7 @@ #include #include -static const int zdroj_adresa=1; +static const int zdroj_adresa=20; // lptgpib.c #define get_control() (inb(lpt_base+2) ^ 0x04) @@ -25,14 +25,14 @@ int main(int argc,char **argv) { for (;;) { // GPIB -> obrazovka - if (init) + if (init) { fprintf(stderr,"Inicializuji port... "); - lptgpib_command(UNL); - lptgpib_command(MLA+0); - lptgpib_command(MTA+zdroj_adresa); - if (init) + lptgpib_command(UNL); + lptgpib_command(MLA+0); + lptgpib_command(MTA+zdroj_adresa); fprintf(stderr,"hotovo.\n"); - init=0; + init=0; + } put_control(TRI | NDAC); /* clear NRFD */ usleep(1000000/10); if (get_control()&DAV) { /* wait for DAV */ @@ -44,6 +44,7 @@ int main(int argc,char **argv) { fprintf(stderr,"precten znak: %02x (%c)\n",val,val); } put_control(TRI | NDAC | NRFD ); /* back to default state */ + usleep(1000000/10); /* chvili pockat, asi zbytecne, jen aby to bylo videt na portu */ // klavesnice -> GPIB struct pollfd pollfd; @@ -62,6 +63,7 @@ int main(int argc,char **argv) { fprintf(stderr,"zapisuji radek: %s\n",str); lptgpib_write(zdroj_adresa,str); fprintf(stderr,"zapsan radek.\n"); + init=1; } }