9. RAD-IO2-DIO
9.0 RAD DIO
9.1 Digital inputs have 2 shared settings Pre-scaler and Trip voltage. All channels use the settings found in channel 1.
9.1.1 Pre-scaler is a clock divider on the 1.2MHz main clock
9.1.1.1 The Prescaler denotes the range in which frequency can be measured. For example:
9.1.1.1.1 Prescaler=200 for 1hz to 200hz,
9.1.1.1.2 Prescaler=20 for 10hz to 2kHz
9.1.1.1.3 Prescaler =1 for 100Hz to 20kHz
9.1.1.2 The same holds true for Period a higher number will measure a slower period but will not be able to measure short periods. Prescaler can be changed “on the fly” to suit your measurement needs.
9.1.2 Trip voltage is the Threshold voltage that separates high values from low.
9.1.3 Each channel has an invert bit that will cause the resulted input to be inverted.
For example if the PWM output is 20% and you set the Invert bit, the PWM will be inverted so it will then be 80%.
9.2 There are 6 possible modes for DI, all of these modes can be changed “on the fly” while the unit is under operation. This allows the same physical input to sequence through the modes to take different measurements, such as Analog In, PWM and frequency.
9.2.1 RADIO2DIN_MODE_DISABLE:
9.2.1.1 This disables the channel
9.2.1.2 No values when this mode is set.
9.2.2 RADIO2DIN_MODE_DIGITAL:
9.2.2.1 This mode returns the digital state of the input as a single byte
9.2.2.2 0x00 = input low
9.2.2.3 0x01 = input high
9.2.2.4 These are reversed if invert = 1
9.2.3 RADIO2DIN_MODE_PWM:
9.2.3.1 This mode returns the PWM duty cycle of the input as a single byte from 0 to 100 (%).
9.2.3.2 The result will be 100 - duty cycle if invert set.
9.2.4 RADIO2DIN_MODE_PERIOD:
9.2.4.1 Returns the high period of the last pulse in as a 16bit int
9.2.4.2 The prescaler value can be used here to measure longer pulses
9.2.4.3 The invert bit will switch to measuring the low time period
9.2.4.4 Period = (value * prescaller) / 1200000 (seconds)
9.2.5 RADIO2DIN_MODE_FREQ:
9.2.5.1 Returns the frequency of the given signal as 16 bit value
9.2.5.2 Frequency = value / prescaler (Hz)
9.2.6 RADIO2DIN_MODE_ANALOG:
9.2.6.1 This returns a 12bit values for the input voltage
9.2.6.2 You can convert to voltage by (value * 40) / 4096 (Volts)
9.3 Digital Output (DO)
The RAD-IO-DIO outputs are comprised of 4 Banks of digital outputs.
9.3.1 PIN1 is the power input to the each bank a Power, Channel A, Channel
9.4 Signals:
9.4.1 Channel_Output: Selects between Channel A or Channel B
9.4.1.1 Channel_Output is controlled by Byte1, Bit0 and it represents channel A or B.
9.4.1.2 To set Channel_Output to Channel A set Byte1, Bit0 = “0” for Channel B, Byte1, Bit0 = “1”
9.4.1.3 Note if the H-Bridge configuration is full bridge, only Channel A values will be accepted.
9.4.2 H_Bridge:
9.4.2.1 The two Half Bridges can be separated or joined as a Full H-Bridge by setting Byte1, Bit7 to “1”. again- if the full bridge bit is set then channel B settings are ignored
9.4.3 Output_Config:
9.4.3.1 There are 4 modes for Digital Output (DO) that are represented by Bits
9.4.3.2 Disabled, Byte1, Bit ; which is the same as setting RADIO2DOUT_SET_HIZ, output is disabled. Digital Outputs do not change and are There is no value for digital mode
9.4.3.3 DO: This sets it as a simple digital output ON or OFF.
9.4.3.4 PWM: PWM mode sets a % duty cycle (0-100%) and a frequency (0Hz to 65535Hz).
9.4.3.5 Period or Oneshot: This sends a single pulse. The value sets the length of the pulse in milli-seconds
9.4.4 There are 4 output states for the H-Bridge
9.4.4.1 RADIO2DOUT_SET_HIZ = 0; This is the equivalent to disabled, Outputs are not driven.
9.4.4.2 RADIO2DOUT_SET_LOW_REV. In this mode the H-bridge mode OUT1 is low and OUT2 is high: this would cause a motor hooked up to spin in reverse.
9.4.4.3 RADIO2DOUT_SET_HIGH_FWD. In this mode the H-bridge mode OUT1 is high and OUT2 is low: this would cause a motor hooked up to spin forwards.
9.4.4.4 RADIO2DOUT_SET_BRAKE. This sets all outputs low: in H-Bridge mode this would cause a motor to brake. If you turn a motor it will act as a generator. BRAKE mode shorts the windings of a motor together. This will stop a spinning motor much from faster than just setting HiZ the shorting action causes the magnetic fields to collapse immediately.
9.4.5 Frequency is a 16 bit value in Hz, this gives a range of 0Hz to 65535Hz
9.4.6 Duty cycle is an 8 bit value in percent%, it range is 0-255% but of course only 0-100 will be accepted by the DIO this give’s it a range of 0-100% with a granularity of 1%.
9.5 The GUI program has an interface for the DIO module that allows control over the Inputs and Outputs.
9.6 All DIO INPUT banks have 3 channels per bank that can be configured as Digital Input, Analog Input, Period or Frequency. For example below, BANK1 has 3 channels modes, CH1 is digital, CH2 is PWM and will report back a frequency.
9.7 All DIO OUTPUT banks can be configured as Half Bridge or FULL Bridge, and as Digital output, PWM or Period; and the STATE as HIZ, Forward, Reverse or Brake. Please keep in mind the default is HIZ which means the outputs are at high impedance; therefore no output will be generated in that mode. Brake mode shorts out the H-Bridge for faster stopping of motors.