Code for using and configuring I/O ports. More...
#include "nz_ioPortDefs.h"
Go to the source code of this file.
Macros | |
#define | portReadBitadr_MACRO(bitAdr) (*((volatile WORD*)((bitAdr)&0xFFF)) & (0x01 << ((bitAdr)>>12))) |
#define | portSetBitadr_MACRO(bitAdr) (*((volatile WORD*)((bitAdr)&0xFFF)) |= (0x01 << ((bitAdr)>>12))) |
#define | portClearBitadr_MACRO(bitAdr) (*((volatile WORD*)((bitAdr)&0xFFF)) &= (~(0x01 << ((bitAdr)>>12)))) |
#define | portWriteBitadr_MACRO(bitAdr, value) ((value==0) ? (*((volatile WORD*)((bitAdr)&0xFFF)) &= (~(0x01 << ((bitAdr)>>12)))) : (*((volatile WORD*)((bitAdr)&0xFFF)) |= (0x01 << ((bitAdr)>>12)))) |
#define | portGetTRIS_MACRO(portID) ((portID>PORT_ID_MAX) ? (BITADR_NA/*Returns BITADR_NA if not available or error*/) : TRIS_PORTID_BITADR_MAP[portID]) |
#define | HIGH 1 |
#define | LOW 0 |
Functions | |
void | portInit (void) |
BYTE | portConfig (BYTE portID, WORD typeConf) |
BYTE | ucportGetIndex (BYTE portID) |
BYTE | portGetUcportID (BYTE portID) |
BYTE | getPortIdForStr (const char *str) |
BOOL | portReadBitadr (WORD bitAdr) |
void | portSetBitadr (WORD bitAdr) |
void | portClearBitadr (WORD bitAdr) |
void | portWriteBitadr (WORD bitAdr, BOOL value) |
WORD | portGetLAT (BYTE portID) |
WORD | ucportGetLAT (BYTE ucportID) |
WORD | portGetPIN (BYTE portID) |
WORD | ucportGetPIN (BYTE ucportID) |
WORD | portGetODC (BYTE portID) |
WORD | ucportGetODC (BYTE ucportID) |
WORD | portGetTRIS (BYTE portID) |
WORD | portGetTRISwOffset (BYTE portID, BYTE offset) |
WORD | ucportGetTRIS (BYTE ucportID) |
WORD | ucportGetTRISwOffset (BYTE ucportID, BYTE offset) |
WORD | portGetCNPD (BYTE portID) |
WORD | portGetCNPDwOffset (BYTE portID, BYTE offset) |
WORD | ucportGetCNPD (BYTE ucportID) |
WORD | ucportGetCNPDwOffset (BYTE ucportID, BYTE offset) |
WORD | ucportGetCNPU (BYTE ucportID) |
WORD | portGetCNIE (BYTE portID) |
WORD | ucportGetCNIE (BYTE ucportID) |
void | portWritePullup (BYTE portID, BOOL val) |
void | portWritePulldown (BYTE portID, BOOL val) |
void | portConfigDir (BYTE portID, BOOL dir) |
void | portWrite (BYTE portID, BYTE value) |
BOOL | portRead (BYTE portID) |
void | digitalWrite (BYTE portID, BYTE value) |
BOOL | digitalRead (BYTE portID) |
Code for using and configuring I/O ports.
Code for using and configuring I/O ports
The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.
The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
File History
2013-11-20, David H. (DH):
#define portClearBitadr_MACRO | ( | bitAdr) | (*((volatile WORD*)((bitAdr)&0xFFF)) &= (~(0x01 << ((bitAdr)>>12)))) |
Set a Port bit with given "Port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portClearBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to clear. |
#define portGetTRIS_MACRO | ( | portID) | ((portID>PORT_ID_MAX) ? (BITADR_NA/*Returns BITADR_NA if not available or error*/) : TRIS_PORTID_BITADR_MAP[portID]) |
Gets a "Port bitAdr" for the requested port's TRIS register's. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to set or clear the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
#define portReadBitadr_MACRO | ( | bitAdr) | (*((volatile WORD*)((bitAdr)&0xFFF)) & (0x01 << ((bitAdr)>>12))) |
Reads a Port bit with given "port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portReadBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set or clear. |
#define portSetBitadr_MACRO | ( | bitAdr) | (*((volatile WORD*)((bitAdr)&0xFFF)) |= (0x01 << ((bitAdr)>>12))) |
Set a Port bit with given "Port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portSetBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set. |
#define portWriteBitadr_MACRO | ( | bitAdr, | |
value | |||
) | ((value==0) ? (*((volatile WORD*)((bitAdr)&0xFFF)) &= (~(0x01 << ((bitAdr)>>12)))) : (*((volatile WORD*)((bitAdr)&0xFFF)) |= (0x01 << ((bitAdr)>>12)))) |
Set a Port bit with given "port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portWriteBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set or clear. |
value | 0 will clear given port bit, 1 will set it |
BOOL digitalRead | ( | BYTE | portID) |
Read a Digital port.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
void digitalWrite | ( | BYTE | portID, |
BYTE | value | ||
) |
Write a Digital port.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
value | HIGH will set the port(3.3V), and LOW will clear(0V) the port pin. |
BYTE getPortIdForStr | ( | const char * | str) |
Gets the "Port ID" (a number from 0 to 41, also known as the "Netcruzer Port Name") for the given string. String must contain 1 or 2 digits. For numbers less than 10, can have an optional leading 0.
str | A string representing the "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". Can be "00" to "41", or "0" to "41". |
void portClearBitadr | ( | WORD | bitAdr) |
Set a Port bit with given "Port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portClearBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to clear. |
BYTE portConfig | ( | BYTE | portID, |
WORD | typeConf | ||
) |
Configure I/O Port (ports of SBC) with the given configuration data. The first parameter is the "Port ID", and the second is an ORed combination of PCFG_XX and PTYPE_XX defines. The PTYPE_XX define gives the type of port, and the PCFG_XX define give optional configuration. Common combinations are:
--— Details --— The upper byte (bit 8-15) of the given typeConf parameter is a PCFG_XXX_TYPE define, like PCFG_DIN_TYPE for example. The lower byte (bit 0-7) are PCFG_XXX flags, like PCFG_IN_FL_PULLUP for example.
The following example configures port 5 as a digital output:
The following example configures port 10 as a digital input, with pull-up resistor enabled:
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
typeConf | Type and configuration |
void portConfigDir | ( | BYTE | portID, |
BOOL | dir | ||
) |
Set direction of Digital port.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
dir | Direction of port, 0 sets port as an output, 1 as an input. |
WORD portGetCNIE | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's CNIE (CN Interrupt Enable) register. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to enable or disable the port's CN interrupts using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetCNPD | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's CNPD (Pull-Down) register. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to enable or disable the port's Pull-Down resistor using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetCNPDwOffset | ( | BYTE | portID, |
BYTE | offset | ||
) |
!!!!!!! IMPORTANT !!!!!!!!! This functions if used by the system, is not meant for general purpose use!
Gets a "Port bitAdr" for the requested port's CNPD (Pull-Down) register, adding the given offset to it.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
offset | An offset to add to returned value if it is NOT 0. |
WORD portGetLAT | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's LAT register's. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to set or clear the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
The "Port bitAdr" for all ports are also defined by the LAT_xx_BITADR defines! The following two lines will both return the requested port's "Port bitAdr" value:
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetODC | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's ODC (Open Drain Control) register's. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to enable or disable the Open Collector feature of the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetPIN | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's PORT register's. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to read or write the digital pin value of the port. The portWriteBitadr(), portSetBitadr() and portClearBitadr() functions can be used.
IMPORTANT! When writing a port pin, the LAT registers (port output latch) should be used in stead! Using the PORT register could fail if the port is driving low impedance loads (read-write effect)!
The "Port bitAdr" for all ports are also defined by the PIN_xx_BITADR defines! The following two lines will both return the requested port's "Port bitAdr" value:
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetTRIS | ( | BYTE | portID) |
Gets a "Port bitAdr" for the requested port's TRIS register's. The port is identified by it's "Port ID". The returned "Port bitAdr" can be used to set or clear the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD portGetTRISwOffset | ( | BYTE | portID, |
BYTE | offset | ||
) |
!!!!!!! IMPORTANT !!!!!!!!! This functions if used by the system, is not meant for general purpose use!
Gets a "Port bitAdr" for the requested port's TRIS register's, adding the given offset to it.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
offset | An offset to add to returned value if it is NOT 0. |
BYTE portGetUcportID | ( | BYTE | portID) |
Gets the "Microcontroller port ID"(a UCPORT_ID_xx define) that is mapped to the given "Port ID" (a number from 0 to 41, also known as the "Netcruzer Port Name"). For example, on the SBC66EC, port 1 is connected to Microcontroller port RB1. The following function will return UCPORT_ID_B1:
The returned "Microcontroller port ID" is used by many port functions.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
void portInit | ( | void | ) |
Initialization
BOOL portRead | ( | BYTE | portID) |
Read a Digital port.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
BOOL portReadBitadr | ( | WORD | bitAdr) |
Reads a Port bit with given "port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portReadBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set or clear. |
void portSetBitadr | ( | WORD | bitAdr) |
Set a Port bit with given "Port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portSetBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set. |
void portWrite | ( | BYTE | portID, |
BYTE | value | ||
) |
Write a Digital port.
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
value | HIGH will set the port(3.3V), and LOW will clear(0V) the port pin. |
void portWriteBitadr | ( | WORD | bitAdr, |
BOOL | value | ||
) |
Set a Port bit with given "port bitAdr". A "Port bitAdr" can be used to identify any of a port's control bits:
LAT, ODC (Open Drain), PORT, TRIS, Pullup and Pulldown registers
This function is useful if a variable (16-bit WORD) is required to represent a Port bit address. It is done by ORing the SRF's address with it's bit position (for PIC32 add 0x0088 for upper Word). The bit position is stored in the upper nibble (bits 12 to 15). For example, to represent bit 2 of a register with address 0x0C18, use 0x2C18.
If the "Port bitAdr" is available as a literal constant, the portWriteBitadr_MACRO() macro will generate a single line of code!
Many "Port bitAdr" constants have been defined in the "brd_xxx.h" include file for selected board. For example PIN_xx_BITADR and LAT_xx_BITADR defines are available for accessing bits in the PORT and LAT registers. Various portGetXxx() and getUcportXxx() functions are also available for getting the "Port bitAdr" for port TRIS, LAT, PORT, ODC, PULLUP and PULLDOWN registers.
bitAdr | The "Port bitAdr" of the bit to set or clear. |
value | 0 will clear given port bit, 1 will set it |
void portWritePulldown | ( | BYTE | portID, |
BOOL | val | ||
) |
Enables or disabled the pull-down resistor for the given port
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
val | If 0, the pull-down resistor is disabled, else it is enabled. |
void portWritePullup | ( | BYTE | portID, |
BOOL | val | ||
) |
Enables of disabled the pull-up resistor for the given port
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
val | If 0, the pull-up resistor is disabled, else it is enabled. |
WORD ucportGetCNIE | ( | BYTE | ucportID) |
Gets a "Port bitAdr" for the requested port's CNIE (CN Interrupt Enable) register. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to enable or disable the port's CN interrupts using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetCNPD | ( | BYTE | ucportID) |
Gets a "Port bitAdr" for the requested port's CNPD (Pull-Down) register. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to enable or disable the port's Pull-Down resistor using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetCNPDwOffset | ( | BYTE | ucportID, |
BYTE | offset | ||
) |
!!!!!!! IMPORTANT !!!!!!!!! This functions if used by the system, is not meant for general purpose use!
Gets a "Port bitAdr" for the requested port's CNPD (Pull-Down) register, adding the given offset to it.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
offset | An offset to add to returned value if it is NOT 0. |
WORD ucportGetCNPU | ( | BYTE | ucportID) |
Gets a "Port bitAdr" for the requested port's CNPU (Pull-Up) register. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to enable or disable the port's Pull-Up resistor using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
BYTE ucportGetIndex | ( | BYTE | portID) |
Gets an index for the given "Port ID". The index is for:
portID | The "Port ID" of the requested port. Is a number from 0 to 41, also known as the "Netcruzer Port Name". |
WORD ucportGetLAT | ( | BYTE | ucportID) |
WORD ucportGetLAT(BYTE ucportID)
Gets a "Port bitAdr" for the requested port's LAT register's. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to set or clear the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetODC | ( | BYTE | ucportID) |
Gets a "Port bitAdr" for the requested port's ODC (Open Drain Control) register's. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to enable or disable the Open Collector feature of the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetPIN | ( | BYTE | ucportID) |
WORD ucportGetPIN(BYTE ucportID)
Gets a "Port bitAdr" for the requested port's PORT register's. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to read or write the digital pin value of the port. The portWriteBitadr(), portSetBitadr() and portClearBitadr() functions can be used.
IMPORTANT! When writing a port pin, the LAT registers (port output latch) should be used in stead! Using the PORT register could fail if the port is driving low impedance loads (read-write effect)!
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetTRIS | ( | BYTE | ucportID) |
Gets a "Port bitAdr" for the requested port's TRIS register's. The port is identified by it's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). The returned "Port bitAdr" can be used to set or clear the port using the portWriteBitadr(), portSetBitadr() and portClearBitadr() functions.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
WORD ucportGetTRISwOffset | ( | BYTE | ucportID, |
BYTE | offset | ||
) |
!!!!!!! IMPORTANT !!!!!!!!! This functions if used by the system, is not meant for general purpose use!
Gets a "Port bitAdr" for the requested port's TRIS register's, adding the given offset to it.
ucportID | The port's "Microcontroller Port ID", is a UCPORT_ID_xx define (UCPORT_ID_01 for example). |
offset | An offset to add to returned value if it is NOT 0. |