______________________________________________________________________ > < > MCP6S2X library v1.02 < > for < > PICos18 release 2.07 < > < > PICos18 - Real-time kernel for PIC18 family < > < > < > www.picos18.com www.pragmatec.net < >______________________________________________________________________< This file contains all necessary informations to use properly the MCP6S2X library for PICos18 v2.07. Download the last PICos18 kernel version from www.picos18.com. ______________________________________________________________________ > < > I - Zip file content < >______________________________________________________________________< The mcp6s2x zip file contains : - mcp6s2x.c : to use the mcpx100, x digital potentiometer with SPI - mcp6s2x.h : header file - mcp6s2x.txt : this file this mcp6s2x library needs the PICos18 SPI driver to work. So please, configure the SPI driver first. Place the C and H file in your project directory. Adapt settings properly depending of your MCP6S2X configuration (#define present at the top of the C file). This library is supposed to be use with PICos18 and has been tested with MPLAB 7.22 and C18 v3.00. Do not use this driver at a frequency lower than 8 Mhz (use the PIC18 PLL to increase the internal frequency). ______________________________________________________________________ > < > II - Hardware settings < >______________________________________________________________________< In the mcp6s2x.c, update the local defintions to match your hardware: /********************************************************************** * ----------------------- MCP6S2X USER SETTINGS --------------------- **********************************************************************/ // Chip select definition #define MCP6S2X_CS_PORT PORTB #define MCP6S2X_CS_BIT 2 ______________________________________________________________________ > < > VI - LCD driver usage < >______________________________________________________________________< In the application task, include the driver header: #include "mcp6s2x.h" See hereafter an basic example : #include "define.h" #include "stdio.h" #include "mcp6s2x.h" /********************************************************************** * Definition dedicated to the local functions. **********************************************************************/ #define ALARM_TSK0 0 /********************************************************************** * ------------------------------ TASK0 ------------------------------- * * First task of the tutorial. * **********************************************************************/ TASK(TASK0) { unsigned char consigne = 0; Init_mcp6s2x(); SetRelAlarm(ALARM_TSK0, 300, 100); while (1) { WaitEvent(ALARM_EVENT); ClearEvent(ALARM_EVENT); LATEbits.LATE0 = ~LATEbits.LATE0; mmcp6s2x_SelectChannel(CH_0); mcp6s2x_SetGain(GAIN_8); } } ______________________________________________________________________ > < > VII - Conclusion < >______________________________________________________________________< This mcp6s2x is provided from the PICos18 web site with other drivers dedicated to other peripherals. Do not hesitate to check periodicaly the www.picos18.com web site in order to download the last versions of PIC18 drivers for PICos18. /* End of File : mcp6s2x.txt */