EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #322 background imageLoading...
Page #322 background image
322
PCF8591.c
#include "PCF8591.h"
void PCF8591_write(unsigned char control_value, unsigned char data_value)
{
SW_I2C_start();
SW_I2C_write(PCF8591_write_cmd);
SW_I2C_wait_ACK();
SW_I2C_write((control_value & 0xFF));
SW_I2C_wait_ACK();
SW_I2C_write(data_value);
SW_I2C_wait_ACK();
SW_I2C_stop();
}
unsigned char PCF8591_read(unsigned char control_value)
{
unsigned char value = 0;
SW_I2C_start();
SW_I2C_write(PCF8591_write_cmd);
SW_I2C_wait_ACK();
SW_I2C_write((control_value & 0xFF));
SW_I2C_ACK_NACK(I2C_ACK);
SW_I2C_stop();
SW_I2C_start();
SW_I2C_write(PCF8591_read_cmd);
SW_I2C_wait_ACK();
value = SW_I2C_read(0);
SW_I2C_wait_ACK();
SW_I2C_stop();
return value;
}
main.c
#include <msp430.h>
#include "delay.h"
#include "SW_I2C.h"
#include "PCF8591.h"
#include "lcd.h"
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void lcd_print(unsigned char x_pos, unsigned char y_pos, unsigned char value);
void main(void)
{
unsigned char adc0 = 0;

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals