source คุม print แต่ยังไม่ ok ด้วย tc
Size:1111 Byte Create: 2/2/2548 Time: 15:51:15

// http://www.beyondlogic.org/spp/parallel.htm
// http://www.machinegrid.com/content/view/30/84/
// http://www.galeon.com/x0195/destino/teoria.htm
#include
#include
#include
void main(void) {
unsigned int far *ptraddr; /* Pointer to location of Port Addresses */
unsigned int address; /* Address of Port */
int a;
ptraddr=(unsigned int far *)0x00000408;
for (a = 0; a < 3; a ) {
address = *ptraddr;
if (address == 0)
printf("No port found for LPT%d \n",a 1);
else
printf("Address assigned to LPT%d is %Xh\n",a 1,address);
*ptraddr ;
}
// think 378 but is 3bc in lpt1
do {
outportb(0x3bc,inportb(0x3bc)|0x00); // Stop motor
gotoxy(35,12); printf("0x00");
sleep(1);
outportb(0x3bc,inportb(0x3bc)|0x01); // Move motor (CCW)
gotoxy(35,12); printf("0x01");
sleep(1);
outportb(0x3bc,inportb(0x3bc)|0x02); // Move motor (CW)
gotoxy(35,12); printf("0x02");
delay(1000); // 1000 Miliseconds
} while(!kbhit());
}