| 数据搜索系统,热门电子元器件搜索 |
|
MCP9808 数据表(PDF) 43 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
MCP9808 数据表(HTML) 43 Page - Microchip Technology |
|
43 / 52 page ![]() © 2011 Microchip Technology Inc. DS25095A-page 45 MCP9808 Software License Agreement The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended and supplied to you, the Company’s customer, for use solely and exclusively with products manufactured by the Company. The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. 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 STATU- TORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU- LAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. APPENDIX A: SOURCE CODE /******************************************************************** FileName: I2C.c Processor: PIC18 Microcontrollers Complier: Microchip C18 (for PIC18) or C30 (for PIC24) Company: Microchip Technology, Inc. #include <p18cxxx.h> // This code is developed for PIC18F2550 //It can be modified to be used with any PICmicro with MSSP module /** PRIVATE PROTOTYPES *********************************************/ void i2c_init(void); void i2c_start(void); void i2c_repStart(void); void i2c_stop(void); unsigned char i2c_write( unsigned char i2cWriteData ); unsigned char i2c_read( unsigned char ack ); /******************************************************************** * Function Name: i2c_init * Return Value: void * Parameters: Enable SSP * Description: This function sets up the SSP1 module on a * PIC18CXXX device for use with a Microchip I2C ********************************************************************/ void i2c_init(void) { TRISBbits.TRISB0 = 1; // Digital Output (make it input only when reading data) TRISBbits.TRISB1 = 1; // Digital Output SSPCON1 = 0x28; // enable I2C Master mode SSPCON2 = 0x00; // clear control bits SSPSTAT = 0x80; // disable slew rate control; disable SMBus SSPADD = 19; // set baud rate to 100 kHz (Fosc = 48 MHz) PIR1bits.SSPIF = 0; PIR2bits.BCLIF = 0; SSPCON2bits.SEN = 0; // force idle condition } |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |