input lpt
Hello, Bizum
Re. your inquiry, if you need only check port status, it's very simple.
You may do like belows.
#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <stdlib.h>
#define LPT2 0x379
#define LPT3 0x37A
void main(void)
{
... decalare your variables here;
tmp_dt = inportb(LPT2);
tmp_dat= (tmp_dt & 0x78) >> 3;
tmp_dt = (tmp_dt ^ 0x80) & 0x80;
tmp_dt >>=3;
tmp_dat= tmp_dat + tmp_dt;
tmp_dt = inportb(LPT3);
tmp_dt = (tmp_dt ^ 0x03) & 0x03;
tmp_dt <<= 5;
tmp_dat= tmp_dat + tmp_dt;
tmp_dt = inportb(LPT3);
tmp_dt = (tmp_dt ^ 0x08) & 0x08;
tmp_dt <<= 4;
tmp_dat= tmp_dat + tmp_dt;
... Now you can check 8-pins status;
... Other your codes here;
}
In this point, you'd better to know, there are some pins are Read only
and some are Write only on parallel port of PC.
For detailed information re. this, I attached scanned book image.
Please refer to that, hope to be a useful.
Good luck.
:roll: