zxOutputToggle does something slightly different than switching to the complementary output state: there seems to be a decay in one direction, making for transitions that are not sharp and don't reach logic level thresholds for quick toggles.
Just curious why this occurs...
Toggle Pin vs. High/Low
Re: Toggle Pin vs. High/Low
That description strongly suggests that the pin wasn't an output before the call to toggle the pin. If the pin is an input, calling PutPin() with zxOutputToggle simply toggles the state of the pullup resistor (enabled or not). The description of PutPin() clearly states that the pin must be an output prior to the call.pjc30943 wrote:there seems to be a decay in one direction
The sample code below demonstrates that the DDR and Port registers are set correctly by a call to PutPin() with zxOutputToggle. If you comment out the first two lines of Main(), you'll see that the pin remains an input.
Code: Select all
Dim pin as Byte = 12
Sub portStatus(ByVal s as String)
Debug.Print s
Debug.Print "DDRC = 0x"; CStrHex(Register.DDRC); ", PortC = 0x"; CStrHex(Register.PortC)
Debug.Print
End Sub
Sub Main()
Call portStatus("Before zxOutputLow")
Call PutPin(pin, zxOutputLow)
Call portStatus("After zxOutputLow")
Call PutPin(pin, zxOutputToggle)
Call portStatus("After zxOutputToggle")
Call PutPin(pin, zxOutputToggle)
Call portStatus("After zxOutputToggle")
End Sub
- Don Kinzer