Appendix A Dio (Digital I/O) Sample Code - BCM MX57QM User Manual

Hide thumbs Also See for MX57QM:
Table of Contents

Advertisement

Appendix A DIO (Digital I/O) Sample Code

//============================================
//MX57QM DOS DIO sample program
//Please compile with Turbo C 3.0 to utilized the program
//============================================
Int main()
{
Int RetVal;
/////////// Write Digital Output ///////////
// Set all output to 0
RetVal = inp(0x549);
RetVal = RetVal & 0xF2;
Outp(0x549,RetVal);
RetVal = inp(0x50F);
RetVal = RetVal & 0xFE;
Outp(0x50F,RetVal);
RetVal = inp(0x53B);
RetVal = RetVal & 0xF8;
Outp(0x53B,RetVal);
RetVal = inp(0x539);
RetVal = RetVal & 0xEF;
Outp(0x539,RetVal);
// Set all output to 1
RetVal = inp(0x549);
RetVal = RetVal | 0x0D;
Outp(0x549,RetVal);
RetVal = inp(0x50F);
RetVal = RetVal | 0x01;
Outp(0x50F,RetVal);
RetVal = inp(0x53B);
RetVal = RetVal | 0x07;
Outp(0x53B,RetVal);
// DO0 is bit3
// DO1 is bit2
// DO2 is bit0
// DO3 is bit0
// DO4 is bit2
// DO5 is bit1
// DO6 is bit0
// DO7 is bit4
// DO0 is bit3
// DO1 is bit2
// DO2 is bit0
// DO3 is bit0
// DO4 is bit2
// DO5 is bit1
61

Advertisement

Table of Contents
loading

Table of Contents