Table of Contents        Previous topic       Next topic       

Virtual Workshop Interface->General Purpose Interface Calls->GetPortPins()

extern "C" void GetPortPins(LONG nExtensionState, DWORD nPortAddress, DWORD* pnPins, DWORD* pnHandledPins, LONG bSimulating, DWORD AnalogInputs[32], DWORD* pnHandledAnalogPins)

This is called when the simulator is reading the port address nPortAddress.  It is called continously after the simulation of each instruction and the simulator will detect any transitions and levels that are required to for instance trigger interrupts.

The extension should set or clear any port pins that it is using as inputs to the peripherals by writing 1's or 0's into the appropriate bit positions of *pnPins.  It should leave unchanged any bits that it is not using, therefore allowing other extensions to handle these pins.

The simulator needs to know which pins have been set or cleared by the extension and so the appropriate bits of *pnHandledPins should be set to indicate which pins have been set or cleared.

If no extensions handle any of the pins, the simulator will use it's internal methods to simulate a read from this port.

Analog Inputs

If a variant has an integral A/D converter and this is supported by the extension for this variant , then the AnalogInputs array should be used to apply the analog levels to the appropriate port pins. In addition to setting the levels for the appropriate A/D input pins, the corresponding bits of *pnHandledAnalogPins should be set to indicate which AnalogInputs arrays contain valid data.