fat16lib wrote:I suspect you have an option other than "No line ending" enabled in the serial monitor.
This is at the bottom of the serial monitor near the baud rate selector.
The input function needs to be fixed to treat any combination of CR and LF as end-of-line.
I keep meaning to post a new version of the I2C stuff but have not found time to finish the new version. Sorry!
Yep, you are right!
I had it set to 'Carriage Return', when switched to 'No line ending everything's fine!
May be it's worth of making a comment in softDS1307 code.
Thank you for your prompt and effective reply!!
Helo, I am trying to use this library with an Arduino UNO R3 and a DS1307.
The DS1307 works fine when using std SDA and SCL ports
but I want to use different ports for SDA and SCL (A2 and A3).
This file also contains fast digital I/O classes and a fast software SPI class template.
The DigitalPin.h file contains the fastest pin I/O class and functions. These functions require a constant pin number.
These function execute in two cycle with constant arguments. On an Uno, two cycles is 0.125 usec. This is about 25 times faster than the standard Arduino digitalWrite().
The PinIO class has run time pin numbers and is four to five times faster than the standard digitalRead() and digitalWrite() functions. For pin 13 on an Uno, write() executes in about 0.8 usec and toggle() is faster. The standard Arduino digitalWrite() function takes about 4 usec.
This class saves overhead by not disabling PWM mode on each read/write call and by storing the port register addresses and pin bit mask in private variables.
The template class SoftSPI uses fast pin I/O to implement a software SPI bus at about 2 MHz.
The two classes FastI2cMaster and SoftI2cMaster implement software master mode I2C.
FastI2cMaster is a template class and runs at about 400 kHz.
SoftI2cMaster uses run time pin numbers and runs at about 100 kHz.
I'm attempting to use the latest software i2c library to read a DS1307, but I'm only ever getting zeroes back from SoftI2CMaster.transfer(). My logic analyzer shows that the signals on the wire are *perfect* - I can read the date straight off the I2C analysis window, so the bits are getting lost somewhere in the library!
Edit: Just tried it on different pins. Same signals on the wire, but this time it works.
(for reference, before it was SCL=D12, SDA=D13, now it's SCL=D11, SDA=D12)
If someone can point me in the right direction, I'd really appreciate it.
I'm trying to connect two UNOs with I2C. (It's more complicated - several slaves and one master eventually on the bus - but I can't get just two to talk at this point). One of these (the one that wants to be a master) has a radio attached, so SDA and SLC are tied up. SoftI2C to the rescue!! I thought.....
The two UNOs communicate just fine with <Wire.h> if I remove the radio, so at least something works. But, I need softI2C on the master. I reverse-engineered the DS1307 program and developed (I think) read and write functions to an arbitrary slave address. But, I'm having no luck with the slave even detecting (receiveEvent and requestEvent are not being triggered) any activity.
The next step is watching bits wiggle with a scope, unless someone can provide some words of wisdom. I'd think the I2C protocol would be common, and I could talk from softI2C to wire and back, but right now it doesn't look that way. Sample code for master and slave would be awesome, but any help would be greatly appreciated.
Regarding my earlier post (above) I have
1. Added pull up resistors (thought that would do it, but no joy).
2. Tried softi2c sample programs (master) and wire sample programs (slave) with the following results:
a) i2cScanAddress, and I actually get a response from the slave. ID is 2x actual ID, but this makes sense when you look at itcScanAddress code. So it seems this shows master must be wired properly and proper pins are in use.
b) i2cScopeTest Nothing. Nada. Neither read mode or write mode. I tried both the both the slave_receiver and slave_sender from wire examples.
So at this point I've got 'standard' programs with only pin number mods. Other than getting a successful result from (effectively) rtc.start(address << 1 | IC2_WRITE) and rtc.start(address << 1 | IC2_READ) in itcScanAddress I haven't gotten anything else to work.
I'd sure appreciate a suggestion. Thanks in advance.
StanZ wrote:i2cScanAddress, and I actually get a response from the slave. ID is 2x actual ID, but this makes sense when you look at itcScanAddress code. So it seems this shows master must be wired properly and proper pins are in use.
That would be correct for an I2C control byte. The top 7 bits are the device address, and the LSB is the Read/Write bit.
I'm not sure what "write" function you're referring to? There aren't any write functions in the TinyWireM library that take an address argument. Where are you looking?
I am in the I2cMaster library. It is linked in the home page.
Sorry, I didn't explain what I want. I am precisely in the softDS1307 example which come with the I2cMaster library.
That's the header of te function I working on :
I don't know what does the first argument stand for but I am sure that it is not the device DS1307 address since the latter is already declared as a global variable.