Part3 Student Example

Part3 Student Example - #define F_CPU 1000000UL #include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#define F_CPU 1000000UL #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #define START 0x?? //TWSR code for start condition transmission #define MT_SLA_ACK 0x?? //TWSR code for SLA_W transmission and ACK received #define MT_DATA_ACK 0x?? //TWSR code for data byte transmitted and ACK received #define SLA_W 0x?? //Slave address (zeroth bit = 1 read command, 0 = write command) unsigned char string[11] = {'H','e','l','l','o',' ','W','o','r','l','d'}; unsigned char string2[15]= {'H','o','l','l','a',' ','B','a','c','k',' ','3','4','1','1'}; unsigned int DataSize; //Global variable used to hold string lengths //value before transmitting in SendLcdData() //------------------------------------------------------------------------- //My delay function //------------------------------------------------------------------------- void my_delay_in_ms(unsigned int millisecs) { unsigned int i; for (i=0; i <= millisecs; i++) _delay_ms(1); } //------------------------------------------------------------------------- //Initialize the two wire interface (I2C) //------------------------------------------------------------------------- void I2C_Init(void) { TWBR = ??; //Sets SCL frequency to ?kHz.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Part3 Student Example - #define F_CPU 1000000UL #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online