David,
Thanks for the reply.
The i2c functions in Codevision-AVR-Standard are not located in a library
file, so I cannot look at them to figure out whether data direction is
handled there.
The i2c functions are embedded in the main CV-AVR compiler (according to the
Pavel Haiduc) and are called as necessary during compilation.
The documentation of these functions is scant, and limited to just what is
in the Help file. The i2c Help file mentions nothing about data direction
nor does it say anything about initialization of the AVR.
There is a function called "i2c_init()" , which the Help file documents as
follows:
-----------------------------------------------
void i2c_init(void)
this function initializes the I2C bus.
This is the first function that must be called prior to using the other I2C
Functions.
Again, no mention of initialization or data direction for port pins.
Also, in the Help-file, there is an example of how to use the i2c functions
to write to and read from an external EEPROM. This code example includes an
assembly language snippet that assigns aliases for the AVR port to be used
for i2c and the specific port pins for SDA and SCL signals. But, no data
direction for those pins.
Here is the snippet:
asm
.equ __i2c_port=0x18; set PORTB of Mega 128 as i2c port
.equ __sda_bit=3
.equ __scl_bit=2
#endasm
It will do no harm to insert a DDR statement for PORTB in my code to see
whether that is the problem.
I'll try it.
Benny
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of David Kelly
Sent: Wednesday, March 19, 2008 2:19 PM
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] I2C Communicaton via Codevison
On Wed, Mar 19, 2008 at 11:54:07AM -0700, Benny Smith wrote:
>
> So far, no luck. I have followed the example shown in the CV-AVR Help
> file. Using an oscilloscope, I do not see any activity at either of
> the Mega128 ports that I have designated for I2C communication.
Start by re-re-re-reading the documentation for the code you are using.
Pay particular attention to initialization. Who is responsible for
setting the port data direction bits, you or the code module?
--
David Kelly N4HHE, dkelly@HiWAAY. <mailto:dkelly%40HiWAAY.net> net
========================================================================
Whom computers would destroy, they must first drive mad.
[Non-text portions of this message have been removed]Message
RE: [AVR-Chat] I2C Communicaton via Codevison
2008-03-19 by Benny Smith
Attachments
- No local attachments were found for this message.