RedDifferentialManchesterCodeNegative:
Filter:
Classes (extension) | Red > redTools

RedDifferentialManchesterCodeNegative
ExtensionExtension

Differential manchester encoding with negative edge clock
Location: NOT INSTALLED!

Description

Also known as biphase mark code (BMC). See http://en.wikipedia.org/wiki/Differential_Manchester_encoding

NOTE: There are two classes... one with positive edge clock (RedDifferentialManchesterCode) and one with negative edge clock (RedDifferentialManchesterCodeNegative).

Class Methods

.new

Creates a new encoder.

Arguments:

numBits

The maximum number of bits in the data to be encoded. The default 8 can deal with values between 0 and 255.

initPhase

Initial phase.

Inherited class methods

Instance Methods

.reset

To reset the phase to the initial value.

.encode

The lowest level method for encoding. Give and return arrays with raw 0/1 bits.

Arguments:

bits

An array of raw bits (zeros and ones) representing the n-bit value to be encoded. The length of this array should match numBits.

Returns:

An array of raw bits (zeros and ones) with encoded clock and data bits.

NOTE: The array returned will be double in length of the argument array (and also 2*numBits in length).

.encodeValue

A method for encoding single numbers. Converts the number to bits and then calls -encode.

Arguments:

value

Some number to be encoded. Make sure to not go above the current set numBits capacity (0-255 by default).

Returns:

Same as -encode above

.encodeArray

A method for encoding arrays of numbers.

Arguments:

array

Some array of numbers to be encoded.

Returns:

Same as -encode above

.numBits

Get or set the number of bits dynamically.

.phase

Get or set the phase dynamically (either 0 or 1).

Inherited instance methods

Examples