Hello,
I'm trying to control the parallel port via the functions inp and outp. First it did not compile at all, then I added an underscore to the function calls (i.e. _inp and _outp), now it compile but the program crashes! woohoo! Please help ;P
Here is the code, I'm using winXP and VC 6.0 w/ SP5 :
#include <dos.h>
#include "bios.h"
#include <stdio.h>
#include <conio.h>
#define BASE_ADDRESS 0x0378 // printer port base address
#define DATA_REGISTER (BASE_ADDRESS+0) // address of data register
#define STATUS_REGISTER (BASE_ADDRESS+1) // address of status register
#define CONTROL_REGISTER (BASE_ADDRESS+2) // address of control register
int main(void)
{
char my_byte = 0;
char Status;
/* Either of these 2 lines crash the program */
Status = _inp(STATUS_REGISTER);
_outp(DATA_REGISTER,my_byte);
return 0;
}
I'm trying to control the parallel port via the functions inp and outp. First it did not compile at all, then I added an underscore to the function calls (i.e. _inp and _outp), now it compile but the program crashes! woohoo! Please help ;P
Here is the code, I'm using winXP and VC 6.0 w/ SP5 :
#include <dos.h>
#include "bios.h"
#include <stdio.h>
#include <conio.h>
#define BASE_ADDRESS 0x0378 // printer port base address
#define DATA_REGISTER (BASE_ADDRESS+0) // address of data register
#define STATUS_REGISTER (BASE_ADDRESS+1) // address of status register
#define CONTROL_REGISTER (BASE_ADDRESS+2) // address of control register
int main(void)
{
char my_byte = 0;
char Status;
/* Either of these 2 lines crash the program */
Status = _inp(STATUS_REGISTER);
_outp(DATA_REGISTER,my_byte);
return 0;
}