Reply by leon...@yahoo.com.br●March 30, 20102010-03-30
When you put while (!IBSR_IBIF); try while (;!IBSR_IBIF;);
see if that works.
Reply by "nielsen.daniel"●December 6, 20092009-12-06
Hello, I am trying to interface an SRF08 Ultrasonic Sensor to my Dragon-12 board
(I2C) via CodeWarrior and C language. I have tried and tried again but no
succes...I am pretty sure I am writing to the SRF08 but I dont think I am
reading correctly. Any help or suggestions or working code would be greatly
appreciated. Thanks.
This is my code.
#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"
#include "I2C.h"
#include "main_asm.h" /* interface to the assembly module */
void main(void) {
byte echo1;
PLL_init();
lcd_init();
clear_lcd();
Init_I2C();
I2C_write_byte(0xE0,0x00,0x50); // 99% sure it does what its suppposed to
ms_delay(65); //wait 65ms
set_lcd_addr(0x00);
type_lcd("Testing"); // lcd DOES display "Testing" so i know we are
atleast getting here
echo1 = I2C_read_byte(); // attmempts to read register 0x02, eventually want
to read 0x02 and 0x03
set_lcd_addr(0x40);
type_lcd("distance"); //lcd DOES NOT display "distance" so we dont even
get to here