| Author | Sebastien Lelong, Copyright © 2009, all rights reserved. |
| Adapted-by | Rob Hamerling |
| Compiler | 2.4q3 |
This library provides a set of functions and procedures
to help users manipulating pins. For instance, you can dynamically access pins
using a specific mapping (RA0 is #0, RB1 is #2, etc...) and act on levels and
directions.
.
Using this library requires that an array "pintools_map" is defined before
including the library. This byte array is populated by pairs of elements:
* the first element of a pair corresponds to the port letter ("A", "B", ...)
* the second element of a pair is the pin number in this port (0, 1, 2, ...)
Pins can then be accessed with their index in this array.
Example: const byte pintools_map[] = { "A",1, "B",1, "D",3 }
This 6 elements array (of 3 pairs) specifies that:
* pin #0 refers to pin_A1
* pin #1 refers to pin_B1
* pin #2 refers to pin_D3
Example of use:
* To obtain the current level of pin_B1:
pin_level = pintools_level[1]
* To set the direction of pin_D3 to output:
pintools_direction[2] = OUTPUT
No dependency found
pintools_level'put(byte in pinnum, bit in level)
pintools_direction'put(byte in pinnum, bit in direction)
pintools_level'put(byte in pinnum, bit in level)
Title: Set pin level Usage: pintools_level[pinnum] = level -- 0 / 1
pintools_direction'put(byte in pinnum, bit in direction)
Title: Set pin direction Usage: pintools_direction[pinnum] = direction -- INPUT / OUTPUT
pintools_direction'get(byte in pinnum) return bit
Title: Get pin direction Usage: var bit pin_direction = pintools_direction[pin_number]
pintools_level'get(byte in pinnum) return bit
Title: Get pin level Usage: var bit pin_level = pintools_level[pinnum]
| 16f886 | 16f886_pintools.jal |
| 18f4550 | 18f4550_pintools.jal |