Overblog
Editer la page Suivre ce blog Administration + Créer mon blog
/ / /

 

Introduction :


 

    Now, how can we use this small piece of electronic we made there : Add an ST4 port on the EQ4/EQ5 motor drives . If you want to use this hack on MS Windows, just have a look at this page : Add TTL outputs to your USB Laptop (Part 3, Software on Windows)

 

On linux, using this hack is easy, the usb adapter just acts as a simple printing device.

 

 

If you are writing your own software :

 

 

   If you are writing your own software on linux, just use the /dev/usblp0 device just as any other device. Open it, write in it and close it. This is a sample C code (do you know K2000 ?).

 

 

#include <unistd.h>

#include <stdlib.h>

#include <fcntl.h>


#define P_SIZE 6

 

unsigned char patterns[P_SIZE]={0x18,0x24,0x42,0x81,0x42,0x24};

 

int main() {

int i=0;

int fd=open("/dev/usblp0",O_WRONLY);

if(fd<0) {

perror("usblp0");

exit(1);

}

while(1) {

write(fd,&patterns[i],1);

i=(i+1)%P_SIZE;

usleep(100000);

}

close(fd);

return(0);

}

 

 

    Result :

 

 

 

If you use an existing software :

    For existing software, you just have to give the /dev/usblp0 device as printer device, or to use any UNIX tips to redirect the needed device.

 

Next step : how to use our modification on MS Windows :  Add TTL outputs to your USB Laptop (Part 3, Software on Windows)

 



Partager cette page
Repost0