Generic Slave

The generic peripheral api/command set allows you to implement "any" peripheral device to the VMC; and you can implement up to three devices concurrently in one single hardware (plus the specific cashless device implementation)

To ease timing for the host, the interface usually answers commands from the VMC which require an answer with an ACK, posts the message to the host, and when an answer from the host is received, it is put in a buffer and delivered to the VMC with the next poll cycle initiated by the VMC.

When implementing a peripheral, first the host will have to set the address of the peripheral to which the interface should listen/respond. Up to four such addresses can be set to allow the implementation of multiple peripheral functions within the interface.

Set Peripheral Address
Copy

With the "A" Command, the host can set the address (or multiple addresses) the interface should listen to. Up to three addresses can be set, independent of the possible address set by the cashless high level implementation. The address is represented in 2 hex digits. As defined in the MDB specification, each kind of peripheral has a specified address, depending on its functionality (Ex. Cashless Reader is 0x10, Coin Acceptor is 0x08 and bill acceptor is 0x03).

Example
Copy

Up to 3 addresses can be set

Possible Responses:

Interface Response
Copy

A,10 - register cashless device #1 address (this is actually range 0x10..0x17)

- note that the arguments are given in hexadecimal, 2 digits*

Enable/Disable Generic peripheral
Copy

Incoming Blocks from the Master

When the peripheralmode is started, messages from the master on the MDB bus to one of the previously set peripheraladdresses will be sent to the host in the following format:

Peripheral Request Responses
Copy

The host may provide an answer (but an answer is not required to all messages)

The interface itself will give ACK answers to comply with the short and strict timing requirements of the MDB specification

Answers sent to the Master

In the "P" and "Q" Responses, XXXXXXXX can have varying lengths, depending on what the peripheral is actually replying or informing the VMC.

For answer messages from the host to the MDB master one of two formats can be used ("P" and "Q" formats):

Answer to poll (Deprecated)

Poll Response
Copy

The message is buffered in the MDB interface until a “poll” is received from the host for the address XX (set as first address with the “A” command)

Example: First address is 0x08 (Coin Acceptor), but poll is made on 0B, so when the VMC polls 0B, the answer in P,XXXXXX will be sent back to it.

Bash
Copy

Please note that the two examples presented above differ in terms of length. The exact length and format is usually defined in the MDB specification . The decoding of these messages is a responsibility of the VMC.

Answer to Queries on a Specific Address

Address Request Response
Copy

The cashless device, if started, will set its address using the same mechanism and start the peripheral functionality. The address used by the cashless high-level implementation must not also be set by the host using the peripheral set command!

Example:

This Example includes Master Commands as well for a better perception. Master and PeripheralModes are enabled in the MDB for this example.

Queue Example
Copy

Store replies in cache

These commands are useful for situations where the response is not mutable, so the response can be always the same when a given address is requested.

In the command below, if there is no sub command, the value of YY should be "FF" , meaning "Don't Care".

Cache Example
Copy

Examples:

This Example includes Master Commands as well for a better perception. Master and peripheral Modes are enabled in the MDB for this example.

Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard