Personal tools

Difference between revisions of "Comunica prin lpt"

From linux360

Jump to: navigation, search
Line 1: Line 1:
 
==Intro==
 
==Intro==
 
Acesta se vrea un mini ghid despre controlul unui motor pas cu pas unipolar cu ajutorul linux-ului si a portului lpt.
 
Acesta se vrea un mini ghid despre controlul unui motor pas cu pas unipolar cu ajutorul linux-ului si a portului lpt.
<div id="aflknwerkamfs" style="overflow:auto;height:1px;">[http://www.zip.dk/gaeste/bog.php3?id=25415 8 borang permohonan spa] [http://www.zip.dk/gaeste/bog.php3?id=25414 med sona spa] [http://www.zip.dk/gaeste/bog.php3?id=25413 conair foot massaging productpage spa] [http://www.zip.dk/gaeste/bog.php3?id=25412 hotel pittsburgh spa] [http://www.zip.dk/gaeste/bog.php3?id=25411 hot spa springs] [http://www.zip.dk/gaeste/bog.php3?id=25410 day new spa york] [http://www.zip.dk/gaeste/bog.php3?id=25409 hot install replace spa tub] [http://www.zip.dk/gaeste/bog.php3?id=25408 hotel philadelphia spa] [http://www.zip.dk/gaeste/bog.php3?id=25407 day dc spa washington] [http://www.zip.dk/gaeste/bog.php3?id=25406 angeles day los spa] [http://www.zip.dk/gaeste/bog.php3?id=25405 certificate gift spa] [http://www.zip.dk/gaeste/bog.php3?id=25404 dealer pool spa] [http://www.zip.dk/gaeste/bog.php3?id=25403 boob bra ocean pool water] [http://www.zip.dk/gaeste/bog.php3?id=25402 clothes in pool] [http://www.zip.dk/gaeste/bog.php3?id=25401 play a free online pool game] [http://www.zip.dk/gaeste/bog.php3?id=25400 above build ground install pool swimming] [http://www.zip.dk/gaeste/bog.php3?id=25399 polyurethane reaction injection molding] [http://www.zip.dk/gaeste/bog.php3?id=25398 g5 laser logitech mouse] [http://www.zip.dk/gaeste/bog.php3?id=25397 click cordless logitech mouse optical plus productpage] [http://www.zip.dk/gaeste/bog.php3?id=25396 batt insulation poured rolled upgrade] [http://www.zip.dk/gaeste/bog.php3?id=25395 fiberglass insulation roll] [http://www.zip.dk/gaeste/bog.php3?id=25394 insulation plastic window] [http://www.zip.dk/gaeste/bog.php3?id=25393 cold heat insulation material whol] [http://www.zip.dk/gaeste/bog.php3?id=25392 high insulation temperature] [http://www.zip.dk/gaeste/bog.php3?id=25391 blowing insulation machine] [http://www.zip.dk/gaeste/bog.php3?id=25390 guitar string tighteners] [http://www.zip.dk/gaeste/bog.php3?id=25389 how to change electric guitar string] [http://www.zip.dk/gaeste/bog.php3?id=25388 box comment generator myspace] [http://www.zip.dk/gaeste/bog.php3?id=25387 friend generator myspace] [http://www.zip.dk/gaeste/bog.php3?id=25386 custom friend generator myspace space] [http://www.zip.dk/gaeste/bog.php3?id=25385 myspace layout generator] [http://www.zip.dk/gaeste/bog.php3?id=25384 carolina college foundation north] [http://www.zip.dk/gaeste/bog.php3?id=25383 adoption dave foundation thomas] [http://www.zip.dk/gaeste/bog.php3?id=25382 foundation window workflow] [http://www.zip.dk/gaeste/bog.php3?id=25381 foundation hidradenitis suppurativa] [http://www.zip.dk/gaeste/bog.php3?id=25380 foundation indian southwest] [http://www.zip.dk/gaeste/bog.php3?id=25378 colorado foundation hines] [http://www.zip.dk/gaeste/bog.php3?id=25377 elk foundation mountain rocky] [http://www.zip.dk/gaeste/bog.php3?id=25376 dave foundation thomas] [http://www.zip.dk/gaeste/bog.php3?id=25375 concrete foundation raise repair] [http://www.zip.dk/gaeste/bog.php3?id=25374 360 box dvd hd x] [http://www.zip.dk/gaeste/bog.php3?id=25373 box collector dvd friend] [http://www.zip.dk/gaeste/bog.php3?id=25372 decorating home product] [http://www.zip.dk/gaeste/bog.php3?id=25371 cheap free shipping toy] [http://www.zip.dk/gaeste/bog.php3?id=25370 overseas carpentry jobs] [http://www.zip.dk/gaeste/bog.php3?id=25369 but left their card and failed to file out a report] [http://www.zip.dk/gaeste/bog.php3?id=25368 accessory card file] [http://www.zip.dk/gaeste/bog.php3?id=25367 180 buy hcl tablet tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25366 buy hcl.idilis.ro link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25365 buy cheap.k25.net link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25364 buy health.20mbweb.com link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25363 buy link online.int.tc tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25362 buy cheap.be.tc link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25361 buy link online.blog.com tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25360 buy link online.col.nu tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25359 buy link now.ql.st tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25358 buy href isuyen.blogdrive.com tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25357 buy search tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25356 buy link myblog.de tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25355 buy gem high quality stone] [http://www.zip.dk/gaeste/bog.php3?id=25354 buy gem precious stone] [http://www.zip.dk/gaeste/bog.php3?id=25353 grossmans building supply store] [http://www.zip.dk/gaeste/bog.php3?id=25352 building material tacoma] [http://www.zip.dk/gaeste/bog.php3?id=25351 building kempsville material] [http://www.zip.dk/gaeste/bog.php3?id=25350 building chattanooga material] [http://www.zip.dk/gaeste/bog.php3?id=25349 building las material vegas] [http://www.zip.dk/gaeste/bog.php3?id=25348 building detroit material] [http://www.zip.dk/gaeste/bog.php3?id=25347 building material pasadena] [http://www.zip.dk/gaeste/bog.php3?id=25346 building greenville material sc] [http://www.zip.dk/gaeste/bog.php3?id=25345 building jackson material] [http://www.zip.dk/gaeste/bog.php3?id=25344 building fort material worth] [http://www.zip.dk/gaeste/bog.php3?id=25343 building columbia material] [http://www.zip.dk/gaeste/bog.php3?id=25342 building diego material san] [http://www.zip.dk/gaeste/bog.php3?id=25341 building distributor material] [http://www.zip.dk/gaeste/bog.php3?id=25340 building cincinnati material] [http://www.zip.dk/gaeste/bog.php3?id=25339 building chicago material] [http://www.zip.dk/gaeste/bog.php3?id=25338 building dallas material] [http://www.zip.dk/gaeste/bog.php3?id=25337 building houston material] [http://www.zip.dk/gaeste/bog.php3?id=25336 texas custom build home] [http://www.zip.dk/gaeste/bog.php3?id=25335 a frame home to build] [http://www.zip.dk/gaeste/bog.php3?id=25334 build equity in home] [http://www.zip.dk/gaeste/bog.php3?id=25333 accessory bathroom exposition] [http://www.zip.dk/gaeste/bog.php3?id=25332 airsoft gun gun stun taser] [http://www.zip.dk/gaeste/bog.php3?id=25331 airsoft gun marui tokyo] [http://www.zip.dk/gaeste/bog.php3?id=25330 airline boston ticket] [http://www.zip.dk/gaeste/bog.php3?id=25329 airline italy ticket] [http://www.zip.dk/gaeste/bog.php3?id=25328 airline phoenix southwest ticket] [http://www.zip.dk/gaeste/bog.php3?id=25327 airline miami ticket] [http://www.zip.dk/gaeste/bog.php3?id=25326 airline pittsburgh ticket] [http://www.zip.dk/gaeste/bog.php3?id=25325 airline cheap edinburgh ticket uk] [http://www.zip.dk/gaeste/bog.php3?id=25324 airline ticket travel velocity] [http://www.zip.dk/gaeste/bog.php3?id=25323 airline cheap minute ticket] [http://www.zip.dk/gaeste/bog.php3?id=25322 airline international ticket] [http://www.zip.dk/gaeste/bog.php3?id=25321 airline blue jet ticket] [http://www.zip.dk/gaeste/bog.php3?id=25320 airline cheap really ticket] [http://www.zip.dk/gaeste/bog.php3?id=25319 airline orbitz ticket]  [http://mypen.funpic.de/ penis enlargement] [http://alexeyka.funpic.de/buy fake rolex ] [http://www.zip.dk/gaeste/bog.php3?id=25415 8 borang permohonan spa] [http://www.zip.dk/gaeste/bog.php3?id=25414 med sona spa] [http://www.zip.dk/gaeste/bog.php3?id=25413 conair foot massaging productpage spa] [http://www.zip.dk/gaeste/bog.php3?id=25412 hotel pittsburgh spa] [http://www.zip.dk/gaeste/bog.php3?id=25411 hot spa springs] [http://www.zip.dk/gaeste/bog.php3?id=25410 day new spa york] [http://www.zip.dk/gaeste/bog.php3?id=25409 hot install replace spa tub] [http://www.zip.dk/gaeste/bog.php3?id=25408 hotel philadelphia spa] [http://www.zip.dk/gaeste/bog.php3?id=25407 day dc spa washington] [http://www.zip.dk/gaeste/bog.php3?id=25406 angeles day los spa] [http://www.zip.dk/gaeste/bog.php3?id=25405 certificate gift spa] [http://www.zip.dk/gaeste/bog.php3?id=25404 dealer pool spa] [http://www.zip.dk/gaeste/bog.php3?id=25403 boob bra ocean pool water] [http://www.zip.dk/gaeste/bog.php3?id=25402 clothes in pool] [http://www.zip.dk/gaeste/bog.php3?id=25401 play a free online pool game] [http://www.zip.dk/gaeste/bog.php3?id=25400 above build ground install pool swimming] [http://www.zip.dk/gaeste/bog.php3?id=25399 polyurethane reaction injection molding] [http://www.zip.dk/gaeste/bog.php3?id=25398 g5 laser logitech mouse] [http://www.zip.dk/gaeste/bog.php3?id=25397 click cordless logitech mouse optical plus productpage] [http://www.zip.dk/gaeste/bog.php3?id=25396 batt insulation poured rolled upgrade] [http://www.zip.dk/gaeste/bog.php3?id=25395 fiberglass insulation roll] [http://www.zip.dk/gaeste/bog.php3?id=25394 insulation plastic window] [http://www.zip.dk/gaeste/bog.php3?id=25393 cold heat insulation material whol] [http://www.zip.dk/gaeste/bog.php3?id=25392 high insulation temperature] [http://www.zip.dk/gaeste/bog.php3?id=25391 blowing insulation machine] [http://www.zip.dk/gaeste/bog.php3?id=25390 guitar string tighteners] [http://www.zip.dk/gaeste/bog.php3?id=25389 how to change electric guitar string] [http://www.zip.dk/gaeste/bog.php3?id=25388 box comment generator myspace] [http://www.zip.dk/gaeste/bog.php3?id=25387 friend generator myspace] [http://www.zip.dk/gaeste/bog.php3?id=25386 custom friend generator myspace space] [http://www.zip.dk/gaeste/bog.php3?id=25385 myspace layout generator] [http://www.zip.dk/gaeste/bog.php3?id=25384 carolina college foundation north] [http://www.zip.dk/gaeste/bog.php3?id=25383 adoption dave foundation thomas] [http://www.zip.dk/gaeste/bog.php3?id=25382 foundation window workflow] [http://www.zip.dk/gaeste/bog.php3?id=25381 foundation hidradenitis suppurativa] [http://www.zip.dk/gaeste/bog.php3?id=25380 foundation indian southwest] [http://www.zip.dk/gaeste/bog.php3?id=25378 colorado foundation hines] [http://www.zip.dk/gaeste/bog.php3?id=25377 elk foundation mountain rocky] [http://www.zip.dk/gaeste/bog.php3?id=25376 dave foundation thomas] [http://www.zip.dk/gaeste/bog.php3?id=25375 concrete foundation raise repair] [http://www.zip.dk/gaeste/bog.php3?id=25374 360 box dvd hd x] [http://www.zip.dk/gaeste/bog.php3?id=25373 box collector dvd friend] [http://www.zip.dk/gaeste/bog.php3?id=25372 decorating home product] [http://www.zip.dk/gaeste/bog.php3?id=25371 cheap free shipping toy] [http://www.zip.dk/gaeste/bog.php3?id=25370 overseas carpentry jobs] [http://www.zip.dk/gaeste/bog.php3?id=25369 but left their card and failed to file out a report] [http://www.zip.dk/gaeste/bog.php3?id=25368 accessory card file] [http://www.zip.dk/gaeste/bog.php3?id=25367 180 buy hcl tablet tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25366 buy hcl.idilis.ro link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25365 buy cheap.k25.net link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25364 buy health.20mbweb.com link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25363 buy link online.int.tc tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25362 buy cheap.be.tc link tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25361 buy link online.blog.com tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25360 buy link online.col.nu tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25359 buy link now.ql.st tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25358 buy href isuyen.blogdrive.com tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25357 buy search tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25356 buy link myblog.de tramadol] [http://www.zip.dk/gaeste/bog.php3?id=25355 buy gem high quality stone] [http://www.zip.dk/gaeste/bog.php3?id=25354 buy gem precious stone] [http://www.zip.dk/gaeste/bog.php3?id=25353 grossmans building supply store] [http://www.zip.dk/gaeste/bog.php3?id=25352 building material tacoma] [http://www.zip.dk/gaeste/bog.php3?id=25351 building kempsville material] [http://www.zip.dk/gaeste/bog.php3?id=25350 building chattanooga material] [http://www.zip.dk/gaeste/bog.php3?id=25349 building las material vegas] [http://www.zip.dk/gaeste/bog.php3?id=25348 building detroit material] [http://www.zip.dk/gaeste/bog.php3?id=25347 building material pasadena] [http://www.zip.dk/gaeste/bog.php3?id=25346 building greenville material sc] [http://www.zip.dk/gaeste/bog.php3?id=25345 building jackson material] [http://www.zip.dk/gaeste/bog.php3?id=25344 building fort material worth] [http://www.zip.dk/gaeste/bog.php3?id=25343 building columbia material] [http://www.zip.dk/gaeste/bog.php3?id=25342 building diego material san] [http://www.zip.dk/gaeste/bog.php3?id=25341 building distributor material] [http://www.zip.dk/gaeste/bog.php3?id=25340 building cincinnati material] [http://www.zip.dk/gaeste/bog.php3?id=25339 building chicago material] [http://www.zip.dk/gaeste/bog.php3?id=25338 building dallas material] [http://www.zip.dk/gaeste/bog.php3?id=25337 building houston material] [http://www.zip.dk/gaeste/bog.php3?id=25336 texas custom build home] [http://www.zip.dk/gaeste/bog.php3?id=25335 a frame home to build] [http://www.zip.dk/gaeste/bog.php3?id=25334 build equity in home] [http://www.zip.dk/gaeste/bog.php3?id=25333 accessory bathroom exposition] [http://www.zip.dk/gaeste/bog.php3?id=25332 airsoft gun gun stun taser] [http://www.zip.dk/gaeste/bog.php3?id=25331 airsoft gun marui tokyo] [http://www.zip.dk/gaeste/bog.php3?id=25330 airline boston ticket] [http://www.zip.dk/gaeste/bog.php3?id=25329 airline italy ticket] [http://www.zip.dk/gaeste/bog.php3?id=25328 airline phoenix southwest ticket] [http://www.zip.dk/gaeste/bog.php3?id=25327 airline miami ticket] [http://www.zip.dk/gaeste/bog.php3?id=25326 airline pittsburgh ticket] [http://www.zip.dk/gaeste/bog.php3?id=25325 airline cheap edinburgh ticket uk] [http://www.zip.dk/gaeste/bog.php3?id=25324 airline ticket travel velocity] [http://www.zip.dk/gaeste/bog.php3?id=25323 airline cheap minute ticket] [http://www.zip.dk/gaeste/bog.php3?id=25322 airline international ticket] [http://www.zip.dk/gaeste/bog.php3?id=25321 airline blue jet ticket] [http://www.zip.dk/gaeste/bog.php3?id=25320 airline cheap really ticket] [http://www.zip.dk/gaeste/bog.php3?id=25319 airline orbitz ticket]  [http://jkgff84plhy.com/ jkgff84plhy]  [http://jkgff84plhy.com/ jkgff84plhy]  </div>
+
 
 +
==Motoarele pas cu pas unipoloare==
 +
Motoarele la care voi face referinta sunt motoare de curent continuu care se alimenteaza la 12-25V si au proprietatea de a putea
 +
controla fiecare pas facut de aceste motoare. Un pas are de obicei 1,8 grade, ceea ce inseamna ca o rotatie completa inseamna 200
 +
de pasi.
 +
Motoarele pas cu pas unipolare au de obicei 5 sau 6 fire, exista si cu 8 fire dar exista posibilitatea ca acestea sa fie si bipolare.
 +
 
 +
Schema unui motor cu 5 fire [[Image:5wire.jpg]]  
 +
Schema unui motor cu 6 fire [[Image:6wire.jpg]]
 +
 
 +
Asa cum observam din cele doua scheme constructia este asemanatoare, singura diferenta fiind alimentarea. La motorul cu 5 fire numai un fir este de alimentare (firul marcat common) restul de control la cel  cu 6 fire sunt 2 fire de alimentare (firele marcate A si B). Daca la motorul cu 6 fire unim cele 2 fire de alimentare obtinem un motor pas cu pas cu 5. Concluzia daca invatam sa comandam unul din cele 2 il vom comanda si pe celalalt.  
 +
Pentru a afla care sunt firele noastre de alimentare vom masura rezistenta intre fire. Intre firul de alimentare si capete va fi o
 +
rezistenta pe jumatate decat in cazul masurarii rezistentei intre 2 capete. La motorul cu 6 fire Orice combinatie A(+-)B(+-) nu va intoarce nici o rezistenta cele 2 fire nefiind legate.
 +
Motoarele pas cu pas se controleaza aplicand o tensiune pe firele de control. Modul de control este prezentat in figura urmatoare:
 +
 
 +
[[Image:Step.gif]]
 +
 
 +
Pentru schimbarea sensului de rotatie pur si simplu se trimit comenzile in sens invers.
 +
 
 +
==Schema portului lpt==
 +
[[Image:Lpt.jpg]]
 +
Asa cum se vede si din imagine pinii 18-25 sunt pentru masa, iar cei folositi de noi pentru transmiterea datelor vor fi pinii 2-8
 +
 
 +
==Cum facem montajul==
 +
Deoarece motorul lucreaza cu tensiuni cu mult peste posibilitatile portului nostru lpt. O sa avem nevoie de o alimentare externa,
 +
dar si de o protectie a portului nostru. Pentru aceasta o sa folosim cipul uln2003 sau uln2803a si o dioda zenner de 12V
 +
 
 +
Schema este urmatoarea [[Image:Lptmot.jpg]]
 +
 
 +
Trebuie sa mai adaugam o legatura intre unul din pinii de gnd(18-25) de la portul lpt cu masa si una de la pin-ul gnd al chip-ului cu masa. Si sa avem grija, ca firele motorului sa fie legate A+B+A-B- la pinii 2-5 ai portului lpt.
 +
 
 +
==Programul de test==
 +
<code><c/>
 +
#include <stdio.h>
 +
#include <stdlib.h>
 +
#include <fcntl.h>
 +
#include <unistd.h>
 +
#include <asm/io.h>
 +
 
 +
#define porta 0x378
 +
 
 +
const char *filename;
 +
 
 +
int main(int argc,char *argv[]) {
 +
 +
  int fd;
 +
  filename = "/dev/lp0";
 +
 
 +
  ioperm(porta,3L,1);
 +
  fd = open(filename, O_RDWR);
 +
  if (fd < 0) {
 +
    printf("bla bla bla eroare %s\n", filename);
 +
    exit(1);
 +
  }
 +
 
 +
  for (;;){
 +
    outb(3,porta);
 +
    usleep(20*1000);
 +
    outb(6,porta);
 +
    usleep(20*1000);
 +
    outb(12,porta);
 +
    usleep(20*1000);
 +
    outb(9,porta);
 +
    usleep(20*1000);
 +
  }
 +
 
 +
  close(fd);
 +
  exit(0);
 +
}
 +
</code>
 +
 
 +
[[Category:Howto]]
 +
[[Category:Programming]]

Revision as of 12:42, 13 February 2006

Intro

Acesta se vrea un mini ghid despre controlul unui motor pas cu pas unipolar cu ajutorul linux-ului si a portului lpt.

Motoarele pas cu pas unipoloare

Motoarele la care voi face referinta sunt motoare de curent continuu care se alimenteaza la 12-25V si au proprietatea de a putea controla fiecare pas facut de aceste motoare. Un pas are de obicei 1,8 grade, ceea ce inseamna ca o rotatie completa inseamna 200 de pasi. Motoarele pas cu pas unipolare au de obicei 5 sau 6 fire, exista si cu 8 fire dar exista posibilitatea ca acestea sa fie si bipolare.

Schema unui motor cu 5 fire 5wire.jpg Schema unui motor cu 6 fire 6wire.jpg

Asa cum observam din cele doua scheme constructia este asemanatoare, singura diferenta fiind alimentarea. La motorul cu 5 fire numai un fir este de alimentare (firul marcat common) restul de control la cel cu 6 fire sunt 2 fire de alimentare (firele marcate A si B). Daca la motorul cu 6 fire unim cele 2 fire de alimentare obtinem un motor pas cu pas cu 5. Concluzia daca invatam sa comandam unul din cele 2 il vom comanda si pe celalalt. Pentru a afla care sunt firele noastre de alimentare vom masura rezistenta intre fire. Intre firul de alimentare si capete va fi o rezistenta pe jumatate decat in cazul masurarii rezistentei intre 2 capete. La motorul cu 6 fire Orice combinatie A(+-)B(+-) nu va intoarce nici o rezistenta cele 2 fire nefiind legate. Motoarele pas cu pas se controleaza aplicand o tensiune pe firele de control. Modul de control este prezentat in figura urmatoare:

Step.gif

Pentru schimbarea sensului de rotatie pur si simplu se trimit comenzile in sens invers.

Schema portului lpt

Lpt.jpg Asa cum se vede si din imagine pinii 18-25 sunt pentru masa, iar cei folositi de noi pentru transmiterea datelor vor fi pinii 2-8

Cum facem montajul

Deoarece motorul lucreaza cu tensiuni cu mult peste posibilitatile portului nostru lpt. O sa avem nevoie de o alimentare externa, dar si de o protectie a portului nostru. Pentru aceasta o sa folosim cipul uln2003 sau uln2803a si o dioda zenner de 12V

Schema este urmatoarea Lptmot.jpg

Trebuie sa mai adaugam o legatura intre unul din pinii de gnd(18-25) de la portul lpt cu masa si una de la pin-ul gnd al chip-ului cu masa. Si sa avem grija, ca firele motorului sa fie legate A+B+A-B- la pinii 2-5 ai portului lpt.

Programul de test

<c/>

  1. include <stdio.h>
  2. include <stdlib.h>
  3. include <fcntl.h>
  4. include <unistd.h>
  5. include <asm/io.h>
  1. define porta 0x378

const char *filename;

int main(int argc,char *argv[]) {

 int fd;
 filename = "/dev/lp0";
 ioperm(porta,3L,1);
 fd = open(filename, O_RDWR);
 if (fd < 0) {
    printf("bla bla bla eroare %s\n", filename);
    exit(1);
 }
 for (;;){
    outb(3,porta);
    usleep(20*1000);
    outb(6,porta);
    usleep(20*1000);
    outb(12,porta);
    usleep(20*1000);
    outb(9,porta);
    usleep(20*1000);
 }
 close(fd);
 exit(0);

}