|
|
View previous topic :: View next topic |
Author |
Message |
Francesc Guest
|
16F873 and I2C |
Posted: Sun Feb 29, 2004 6:03 am |
|
|
Hi all, we try to read for A/D ports from I2C and after send it over RS-232.
Actually capture data from I2C and after send to RS-232 not are possible.
Here an small part of our code.
The I2C code run OK if display data to LCd display.
How we do to capture from I2C and send to RS-232????
Please Help????
My compiler version is 2.732
#include <16f873.h>
#use delay(CLOCK=4000000,RESTART_WDT)
#use RS232(BAUD=9600,BITS=8,XMIT=PIN_C6,RCV=PIN_C7)
#use I2C(MASTER,SDA=PIN_C4,SCL=PIN_C3,SLOW,RESTART_WDT)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
int ACU1,ACU2,ACU3,ACU4;
main()
{
while(1)
{
//***I2C Code
i2c_start();
i2c_write(AnalogWrite);
i2c_write(Reg_Control_Inc);
i2c_stop();
i2c_start();
i2c_write(AnalogRead);
ACU4=i2c_read();
ACU1=i2c_read();
ACU2=i2c_read();
ACU3=i2c_read(0);
i2c_stop();
delay_ms(100);
//***RS232 Code
send RS-232();
}
} |
|
|
Ttelmah Guest
|
Re: 16F873 and I2C |
Posted: Sun Feb 29, 2004 6:14 am |
|
|
Francesc wrote: | Hi all, we try to read for A/D ports from I2C and after send it over RS-232.
Actually capture data from I2C and after send to RS-232 not are possible.
Here an small part of our code.
The I2C code run OK if display data to LCd display.
How we do to capture from I2C and send to RS-232????
Please Help????
My compiler version is 2.732
#include <16f873.h>
#use delay(CLOCK=4000000,RESTART_WDT)
#use RS232(BAUD=9600,BITS=8,XMIT=PIN_C6,RCV=PIN_C7)
#use I2C(MASTER,SDA=PIN_C4,SCL=PIN_C3,SLOW,RESTART_WDT)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
int ACU1,ACU2,ACU3,ACU4;
main()
{
while(1)
{
//***I2C Code
i2c_start();
i2c_write(AnalogWrite);
i2c_write(Reg_Control_Inc);
i2c_stop();
i2c_start();
i2c_write(AnalogRead);
ACU4=i2c_read();
ACU1=i2c_read();
ACU2=i2c_read();
ACU3=i2c_read(0);
i2c_stop();
delay_ms(100);
//***RS232 Code
send RS-232();
}
} |
To have any idea of what is wrong, we need to see the RS232 code. However one comment leaps to mind - you cannot have spaces in function names...
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|