Users Manual & Installation Guide
Software example:
/* Compiler: Borland C++ 3.1 */
#include <stdio.h>
#include <dos.h> /* For inportb() and outportb() */
#define BASEADDR 0x300 /* This must match with SW1 on the PV1648 */ #define OUTBYTE0 (BASEADDR+0)
#define OUTBYTE1 (BASEADDR+1) #define OUTBYTE2 (BASEADDR+2) #define OUTBYTE3 (BASEADDR+3) #define OUTBYTE4 (BASEADDR+4) #define OUTBYTE5 (BASEADDR+5) #define INBYTE0 (BASEADDR+6) #define INBYTE1 (BASEADDR+7)
int main (void)
{
unsigned char value;
/* Show input | */ |
| |
value = inportb | (OUTBYTE0); |
| |
printf ("Input | 0 | = %d\n", (value>>0) & | 0x01); |
printf ("Input | 1 | = %d\n", (value>>1) & | 0x01); |
printf ("Input | 2 | = %d\n", (value>>2) & | 0x01); |
printf ("Input | 3 | = %d\n", (value>>3) & | 0x01); |
printf ("Input | 4 | = %d\n", (value>>4) & | 0x01); |
printf ("Input | 5 | = %d\n", (value>>5) & | 0x01); |
printf ("Input | 6 | = %d\n", (value>>6) & | 0x01); |
printf ("Input | 7 | = %d\n", (value>>7) & | 0x01); |
/* Show input |
| ||
value = inportb | (OUTBYTE1); |
| |
printf ("Input | 8 | = %d\n", (value>>0) & | 0x01); |
printf ("Input | 9 | = %d\n", (value>>1) & | 0x01); |
printf ("Input | 10 | = %d\n", (value>>2) & | 0x01); |
printf ("Input | 11 | = %d\n", (value>>3) & | 0x01); |
printf ("Input | 12 | = %d\n", (value>>4) & | 0x01); |
printf ("Input | 13 | = %d\n", (value>>5) & | 0x01); |
printf ("Input | 14 | = %d\n", (value>>6) & | 0x01); |
printf ("Input | 15 | = %d\n", (value>>7) & | 0x01); |
/* Examples of | output operations on DO0 | – DO7 */ |
outportb (OUTBYTE0, 0x01); | /* Make /DO0 active, all others | off */ |
outportb (OUTBYTE0, 0x02); | /* Make /DO1 active, all others | off */ |
outportb (OUTBYTE0, 0x04); | /* Make /DO2 active, all others | off */ |
outportb (OUTBYTE0, 0x08); | /* Make /DO3 active, all others | off */ |
outportb (OUTBYTE0, 0x10); | /* Make /DO4 active, all others | off */ |
outportb (OUTBYTE0, 0x20); | /* Make /DO5 active, all others | off */ |
outportb (OUTBYTE0, 0x40); | /* Make /DO6 active, all others | off */ |
outportb (OUTBYTE0, 0x80); | /* Make /DO7 active, all others | off */ |
outportb (OUTBYTE0, 0x81); | /* Make /DO0 & /DO7 active, all | others off */ |
return 0;} |
|
|
Page 5 of 8