I have two Arduino micros, one which sends sensor data via Xbee to the other. The receiving micro retains its program when power is interrupted but the sending micro does not. Any thoughts?
That sounds unlikely. Why do you think it’s “losing its program?”
It may be this. The Micr’s boot loader takes a few seconds after the board is powered up to listen for a new program being uploaded. If no serial activity is detected, it goes ahead and runs the previously loaded program. There is a sensor chip connected to the MIcro that uses I2C communication and I imagine that the clock signal is generated as soon as the board is powered. Perhaps the boot loader is always detecting this and so never loads the previously loaded program. The Uno that I used before I substituted the Micro has pull up resistors on the I2C lines which the Micro does not have and this seems to prevent the Uno’s boot loader from detecting the clock signal allowing the previously loaded program to run.
Pullups on the I2C lines are absolutely required.
Last night I shut everything down including unplugging the breadboard on which the Micro sits. This morning I plugged the USB cable back into the Micro, turned on the computer and the program, which previously had to be reloaded before it would run, started immediately. No changes to anything had been made. I would really like to know what is going on here. I need to have a reliable system, not one that works when it feels like it.
Also, I ran a program to reveal the state of some of the pins on the Micro and they all appear to be set to high. If they were floating, would they not be randomly high and low?
I appreciate the advice that the pull ups are required on the I2C lines.