Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:38 20 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 simultaneously

Author Message
viscomjim
Guru

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

In the 4.5 manual it says that for I2C, the master and slave modes can be enabled simultaneously, so does this mean 2 uMites would have this type of code (different addresses of course) running and can be both a master and a slave at the same time just making sure that they are all timed correctly to talk to each other?

I2C OPEN 100,100
I2C SLAVE OPEN &34, 0, 0, WRITED, READD
DO
....
LOOP

READD
...
IRETURN

WRITED
...
IRETURN

I2C CLOSE
I2C SLAVE CLOSE
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:05am 29 May 2014
Copy link to clipboard 
Print this post

Yeah, that is about right.

I would suggest to use the newer/better/clearer/fancier :) way of using a subroutine (It prevents code from accidentally entering a subroutine.) and change the order of it a little.

Like:
[code]
I2C OPEN 100,100
I2C SLAVE OPEN &34, 0, 0, WRITED, READD

DO
....
LOOP

I2C CLOSE
I2C SLAVE CLOSE

SUB READD
...
END SUB

SUB WRITED
...
END SUB
[/code]




Edited by TZAdvantage 2014-05-30
Microblocks. Build with logic.
 
viscomjim
Guru

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

Thanks TZ! I will be trying this Master Slave idea once I get a better handle on I2C. So far with playing around, this is a great way of making simple inexpensive I2C devices when one is not well versed in programming pic chips using assembler.
 
Print this page


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

© JAQ Software 2024