Re: microTCU
Posted: Wed Apr 10, 2013 4:58 pm
All,
I have put new 4.114 beta code on the beta release page (http://www.msgpio.com/manuals/mshift/V41code.html).
This code correctly sets the lever input 5V pull-ups when using the microTCU using the PPSAD and PERAD registers, without requiring separate pull-ups circuits, either in the box or externally.
The PPSAD (Pullup Polarity Select for Analog/Digital) and PERAD (Pullup Enable Register Analog/Digital) registers were set in the previous code, but the respective AD pins were not set to be digital inputs, they were left as ADC pins. In order to activate the pull-ups, the appropriate pins had to be switched from ADC to digital (otherwise the pull-up registers have no effect). The code does this by changing the port inputs from ADCs to digital inputs using the ATD0DIEN register when microTCU is set as the hardware AND digital lever inputs is set. Note that changes to the hardware setting (GPIO vrs. microTCU) require a power cycle to take full effect.
In normal operation, this latest code then assigns:
- 1023 to the input 1, 2, or 3's analog-digital count variable when a port pin is 'high' - greater than about 3.25V, and
- 0 when a port pin is 'low' - less than about 1.75V
(but only if 'digital inputs' are selected for the manual lever determination, see: http://www.msgpio.com/manuals/mshift/V41tune.html#i).
These values are reported in TunerStudio as usual. Assigning 'faked' ADC counts simplified the rest of the code, which was built with ADC counts in mind. I mention it here because some users might find it odd that such 'perfect' high and low states are achieved.
(Setting the values to the extremes of the range ensures that the 'Digital Voltage Threshold' does not come into play (http://www.msgpio.com/manuals/mshift/V41tune.html#i).)
The code appears to work on all three inputs (I didn't test input 4, it is already digital and has a pull-up on the PCB).
If anyone has trouble with the lever determination function in this code, please let me know and I will get it sorted.
Lance.
I have put new 4.114 beta code on the beta release page (http://www.msgpio.com/manuals/mshift/V41code.html).
This code correctly sets the lever input 5V pull-ups when using the microTCU using the PPSAD and PERAD registers, without requiring separate pull-ups circuits, either in the box or externally.
The PPSAD (Pullup Polarity Select for Analog/Digital) and PERAD (Pullup Enable Register Analog/Digital) registers were set in the previous code, but the respective AD pins were not set to be digital inputs, they were left as ADC pins. In order to activate the pull-ups, the appropriate pins had to be switched from ADC to digital (otherwise the pull-up registers have no effect). The code does this by changing the port inputs from ADCs to digital inputs using the ATD0DIEN register when microTCU is set as the hardware AND digital lever inputs is set. Note that changes to the hardware setting (GPIO vrs. microTCU) require a power cycle to take full effect.
In normal operation, this latest code then assigns:
- 1023 to the input 1, 2, or 3's analog-digital count variable when a port pin is 'high' - greater than about 3.25V, and
- 0 when a port pin is 'low' - less than about 1.75V
(but only if 'digital inputs' are selected for the manual lever determination, see: http://www.msgpio.com/manuals/mshift/V41tune.html#i).
These values are reported in TunerStudio as usual. Assigning 'faked' ADC counts simplified the rest of the code, which was built with ADC counts in mind. I mention it here because some users might find it odd that such 'perfect' high and low states are achieved.
(Setting the values to the extremes of the range ensures that the 'Digital Voltage Threshold' does not come into play (http://www.msgpio.com/manuals/mshift/V41tune.html#i).)
The code appears to work on all three inputs (I didn't test input 4, it is already digital and has a pull-up on the PCB).
If anyone has trouble with the lever determination function in this code, please let me know and I will get it sorted.
Lance.