Netcruzer Library API  V2.03
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
nz_pt66ei10p.h File Reference

PT66EI-10P Driver Functions. More...

Go to the source code of this file.

Detailed Description

PT66EI-10P Driver Functions.

Author
Modtronix Engineering
Compiler:
MPLAB XC16 Compiler

Description

This file includes hardware specific defines for the PT66EI-10P board. This board has 2 iMod ports allowing many different iMod modules to be added. The pins of the iMod ports can be configured, read and written using functions defined in this file.

Configuration

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.

// *********************************************************************
// -------------- PT66EI-10P Configuration --------------------
// *********************************************************************
//LED Brightness, a value from 0 to 3
//#define PT66EI_10P_LED_BRIGHTNESS 1

Usage

To use the PT66EI-10P with iMod modules in a project, the following must be done:

  • Copy the Configuration section above (from nz_pt66ei10p.h) to the projdefs.h file.
  • In this "Configuration" section, change any default values if required (if default values should be used, define is not required in projdefs.h).
  • Add nz_pt66ei10p.c and nz_imod.c to the MPLAB project.
  • Include nz_pt66ei10p.h in the c file it is used in.
  • In HardwareProfile.h, add defines for this board, and any iMod modules used.

For example, if the im2BL (2 buttons and LEDs) is mounted in iMod port 1, and the im4MOS (4 MOSFET outputs) is mounted in iMod port 2, the following code is required:

//Define any expansion boards, is a XBRD_xxx define (see nz_board.h for supported boards).
#define XBRD_PT66EI_10P_R1 //This demo uses the PT66EI-10P expansion daughter board
//Define iMod modules
#define IMOD1_IS_IM2BL //iMod port 1 has a im2BL module
#define IMOD2_IS_IM4MOS //iMod port 2 has a im4MOD module

This code will make iMod specific functions available for the defined modules. These functions will appear in MPLAB X as code completion suggestions if the module name is types. For the example above, if "im2bl_" is typed in the editor, and "Control-Space" pressed (code completion), all available im2BL functions for iMod port 1 are shown, like:

im2bl_ReadButton1Imod1()
im2bl_ReadButton2Imod1()
im2bl_WriteLed1Imod1()
im2bl_WriteLed2Imod1()

To configure an iMod port pin as an input or output, the ConfDirPin functions are provided. For example:

imod1_ConfDirPin3(INPUT_PIN); //Configure iMod port 1, pin 3 as an output
imod2_ConfDirPin2(OUTPUT_PIN); //Configure iMod port 2, pin 2 is an output

To write or read to/from an iMod port pin, the WritePin and ReadPin functions are provided. For example:

imod1_ReadPin2(); //Read iMod port 1 pin 2
imod2_WritePin5(1); //Set iMod port 2 pin 5

To enable or disable pull-up and pull-down resistors on iMod port pins, the ConfPullupPin and ConfPulldownPin functions are provided. For example:

imod2_ConfPulldownPin2(0); //Disable pull-down resistors on iMod 2 pin 2
imod1_ConfPullupPin4(1); //Enable pull-up resistors on iMod 1 pin 4

Software License Agreement

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

2012-02-22, David Hosken (DH):

  • Initial version