10 static const int zdroj_adresa=20;
13 #define get_control() (inb(lpt_base+2) ^ 0x04)
14 #define put_control(x) outb((x) ^ 0x04, lpt_base+2)
15 #define TRI 0x20 /* tristate data lines */
16 #define NDAC 0x04 /* LPT pin 16 */
17 #define DAV 0x01 /* LPT pin 1 */
18 #define NRFD 0x02 /* LPT pin 14 */
22 int main(int argc,char **argv) {
31 lptgpib_command(MLA+0);
32 lptgpib_command(MTA+zdroj_adresa);
35 put_control(TRI | NDAC); /* clear NRFD */
37 if (get_control()&DAV) { /* wait for DAV */
38 char flags,val=lptgpib_read_byte(&flags);
42 put_control(TRI | NDAC | NRFD ); /* back to default state */
43 usleep(1000000/10); /* chvili pockat, asi zbytecne, jen aby to bylo videt na portu */
47 memset(&pollfd,0,sizeof pollfd);
50 int i=poll(&pollfd,1,0);
53 char str[LINE_MAX],*s=fgets(str,sizeof(str),stdin);
59 lptgpib_write(zdroj_adresa,str);