I want to lock the I/O pins in a certain I/O type.
I wired 2 LEDs to each pin of bank RB so that when the I/O pin was in tri-state then both LEDs would be ON (1/2 intensity).
When the I/O pin was ON one LED1 would be on, LED2 would be off.
When the I/O pin was OFF one LED2 would be on, LED1 would be off.
By using an output block and writing a 0 to each pin as part of an initialization routine only run on power up I can lock these pins in output mode.
Can this be done for inputs and ANx pins as well?
If yes, how?
Digital Inputs
Analog Inputs
Thanks
Ron
Tri-State mode
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Hello Ron,
I/O pins generally remain in the last state they were set. On power-up all I/O pins are configured as inputs (the output buffers are tri-state - both the high and low output drivers are off). In Flowcode they will remain as inputs unless they are accessed by an output command, or an associated peripheral function is enabled (USART, SPI etc.) when the I/O will be configured as required.
When an I/O is configured as an output, the high or low output driver will be enabled as appropriate, and will remain in that state until changed by the program.
Reading a port or pin as an input will configure the associated I/O as inputs, by tri-stating the relevant output drivers before reading. These states will remain until changed by the program.
Analogue inputs are normal I/O that are read by the ADC (via the analogue multiplexer). If used, these I/O pins should be configured as inputs (tri-state) to allow the external analogue signals to control them. The Flowcode component will momentarily force an I/O pin to be an input while it is being read as an analogue input, and will return it to its original state when the conversion has been completed (this will have no effect if the pin was already an input).
I/O pins generally remain in the last state they were set. On power-up all I/O pins are configured as inputs (the output buffers are tri-state - both the high and low output drivers are off). In Flowcode they will remain as inputs unless they are accessed by an output command, or an associated peripheral function is enabled (USART, SPI etc.) when the I/O will be configured as required.
When an I/O is configured as an output, the high or low output driver will be enabled as appropriate, and will remain in that state until changed by the program.
Reading a port or pin as an input will configure the associated I/O as inputs, by tri-stating the relevant output drivers before reading. These states will remain until changed by the program.
Analogue inputs are normal I/O that are read by the ADC (via the analogue multiplexer). If used, these I/O pins should be configured as inputs (tri-state) to allow the external analogue signals to control them. The Flowcode component will momentarily force an I/O pin to be an input while it is being read as an analogue input, and will return it to its original state when the conversion has been completed (this will have no effect if the pin was already an input).