µC DIO Library - MxV Microcontroller Emulation

Simulated Microcontroller Digital Inputs/Digital Outputs

The MxV uC library simulates a generic DIO sub-system of a typical microcontroller.  The library provides an interface to the simulated DIO used for:

Configuring up to 256 ports (ports range from 0 to 255; each port contains 8 I/O pins)

Configuring individual pins as inputs or outputs

Reading the state of input pins

Setting the state of an output pins

Generating an interrupt request when the state of an input pin changes

hmtoggle_plus1Initializing the DIO Sub-System
hmtoggle_plus1Configuring the DIO Sub-System
hmtoggle_plus1Updating Digital Outputs
hmtoggle_plus1Reading Digital Inputs and Digital Outputs
hmtoggle_plus1Harnessing DIO in AppIF.c
hmtoggle_plus1Generating Interrupt Requests
hmtoggle_plus1Interfacing with MxV

Example:

 

#define LED_PORT           0x0A

#define LED_PIN            4

#define LED_MASK           (1<<LED_PIN)

 

#define SWITCH_PORT        0x0A

#define SWITCH_PIN         5

#define SWITCH_MASK        (1<<SWITCH_PIN)

 

 

//In AppIF.c portdef table

//Note the portdef table uses the PIN not the MASK

MXVUC_DIO_OUTPUT("LED", LED_PORT, LED_PIN)

MXVUC_DIO_INPUT("Switch", SWITCH_PORT, SWITCH_PIN)

 

 

//Somewhere in the target code

//Note the API calls uses the MASK not the PIN

MxVuC_DIO_Clear(LED_PORT, LED_MASK);

MxVuC_DIO_ConfigOutput(LED_PORT, LED_MASK);

 

MxVuC_DIO_ConfigInput(SWITCH_PORT, SWITCH_MASK);

Related Topics:

µC Library Overview

EEPROM

CAN Sub-System

OSEK Library

Linking your code with the MxVMC