![]() CP2102 USB to UART TTL Module (one that has a DTR pin), with the connections:.16MHz ceramic resonator connected between chip pins 33 and 34, with resonator's ground pin connected to chip's GND.LED x 1 and 1k current limiting resistor x 1 connected between D/13 (chip pin 26) and GND, this is same as the Arduino Mega "L" LED, to be us as indicator to test prototype.10k pull-up resistor x 1 connected between RESET (chip pin 30) and VCC/AVCC.0.1uF bypass capacitor x 3, connected in parallel to 3 of the VCC/AVCC and GND pairs (chip pins ).ATmega2560 chip from an Arduino Mega2560 clone (functional chip and bootloader) removed with a hot-air gun, soldered on to a TQFP100 breakout PCB.Serial.A prototype board was made as proof of concept, the components, placements, and connections are: Serial.println( "\nLooking for 1-Wire devices." ) String print_string = "Temperature sensors: " Build a serial degug output string and print it. This seems to force a local event call this routine again ( see setup ) Temp3 = random( 1000 ) // round( sensors.getTempFByIndex( 3 )*10 ) Temp2 = random( 1000 ) // round( sensors.getTempFByIndex( 2 )*10 ) Temp1 = random( 1000 ) // round( sensors.getTempFByIndex( 1 )*10 ) Temp0 = random( 1000 ) // round( sensors.getTempFByIndex( 0 )*10 ) No sensors when testing the I2C bus only. Unsigned int temp0, temp1, temp2, temp3 // Typed for I2C as 2-bytes each. Serial.print( NAME ) // Serial debug commenting. Wire.onRequest( requestEvent ) // register I2C request event handler Initialize Dallas Temperature setup with the oneWire reference Setup oneWire instance to communicate with Temperature sensor #define ONE_WIRE_BUS 12 // DS18B20 1-wire temperature data pin Int count = Wire.requestFrom( SLAVE, 8, true ) Request from MegaSlave 4 temperature sensor readings 2 bytes ints each. Master polling mode.\n" ) ĭigitalWrite( LEDpin, ( digitalRead( LEDpin ) != HIGH ? HIGH : LOW ) ) #define NAME "sensors_unoMaster"ĭelay( setupPause ) // Pause for a second. UnoMaster I2C sketch - simply loops polling the MegaSlave for data - random samples or temperature readings, printing them as a formatted debug string to the Serial Monitor. This is where the troubled "event handler" looping plays in. Then one sample with the slave enabling the one-wire temperature sensor polling and reading. Serial debug for two cases is also included - I2C only with just random data returned from the sensors module showing both the Master and Slave outputs. Temp0 = sensors.getTempFByIndex( 0 ) * 10 // Only one sensor attached. Sensors.requestTemperatures( ) // This causes looping, or so I think. Serial.println( "Request Handler Looping." ) * - Uncomment this section to realize the problem looping. ) and the sensors.requestTemperatures( ) interrupts It seems that I need to better differentiate the forcing an event handler loop ( I2C from Master - onRequest ) until The mega's initial configuration is with the offending (?) code, the following three lines, commented out: // This seems to force a local event call this routine again ( see setup ) I plan to attach here my code - uno as master and mega as slave. "A day without learning something new is a wasted Again, Thank you for your time. And I still do not know that.īut Thank You for your time and I hope to provide better posts in the future. ![]() I will post a sequel here later today in hopes that you or another may help in this matter.īTW: My thinking was simple: Is there any known reason that this dual software serial bus configuration, I2C and 1-wire, will not work due to know issues. I apologize for wasting your time with my inadequate original post. But I am pursuing this path as an activity to keep my brain active, learning and to remind myself of what's going on and what needs doing in the Aquaponics system I am building. Not an excuse, just a problem I have to manage. Micro-electronics, circuit boards, even resistors are all new to me and I find that I can forget most of what I learned yesterday overnight. I am a sixty seven years old man that has not worked in sixteen years with serious memory problems. But even if I add all that, as I should have, it sounds like you still can not help - "Sorry, we can't help you." But that I can fix - I can add the Master/Slave sketches and even a picture and outputs. And you are correct I can be very stupid at times.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |