Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:48 04 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : I2C setup uMite MMbasic4.5

Author Message
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:05am 28 May 2014
Copy link to clipboard 
Print this post

Working with a 2 uMite setup using I2C. One uMite (we'll call it UnitA) will send a 1 byte command to the other (call it unitB). When UnitA sends the one byte command, UnitB does some things which could take up to 30 seconds or so to complete. During this time, UnitA will just wait for UnitB to send 1 byte back to indicate that it has done it's job.

I noticed in the manual that the master and slave modes can be enabled simultaneously. So would the approach to this be to

1 - set up UnitA as the master to send the command byte to UnitB set up as slave - UnitA loops using I2C read until the "im done" byte from UnitB is received, or

2- set up both units as master and slave simultaneously, UnitA as master sends command byte, UnitB as slave does its thing, UnitB as master sends "im done" byte to UnitA as slave so that it sees an interrupt caused by that

I played with a slimmed down version of Geoff's I2C example and did notice a bit of strangeness with data as I started sending just 1 byte at a time in a for next loop from master to slave and checking what was coming in on the slave, however upon cycling power to the slave and re-starting the slave routine, all data sent by master was received properly. So there might be a slight problem initially clearing a buffer or something like that.

My setup is using 4.7k pull ups with about 12" of cable between units. I tried, with a simple master to slave 1 byte transfer in a for next loop, speeds from 10 to 400 and everything worked well.

I remember a post or two from MOBI about the I2C thing and he seems to be the guru on that subject (and probably many others). Maybe, since this I2C capability is right up the uMite's alley, he can chime in on this and maybe enlighten us newbies with a simple example or two that shows how to use this protocol effectively between just uMites in MMbasic. The example by Geoff is a great one, but for the above described setup, I cannot make it work right because of the amount of time it takes for the slave to do it thing (up to 30 seconds). I for one would be very happy to paypal a few cold ones for this type of informative stepping stones. MOBI, if I speak out of line, you can reach across the interweb and shut me up. As always, I appreciate all the info from all the members of this great forum.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024