I2C general call address

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
luibra63
Posts: 36
Joined: Mon Aug 29, 2016 3:21 pm
Has thanked: 3 times
Been thanked: 6 times
Contact:

I2C general call address

Post by luibra63 »

Hi
I have a question, I use the arduino nano , or arduino uno with one master and twenty comunication slave.
I need have double address, single address for only card and a call address for all card for comon comunication (general call address). Is there an esample for me ?
thanks and sorry for my english

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C general call address

Post by Benj »

Hello,

There are lots of ways to do this but an easy way I have used before is like this.

I2C addresses are 7-bits plus 1 bit for the read/write flag. So you have 128 different values you could use 0 - 127.

As you handle the address in the slave software you can easily pick up a single address 1-20 for an individual unit or have a global address that all units will respond to, for example 127.

An example would be as follows maybe using a state machine to control which byte is being received from the master.

Code: Select all

if (mode == 0)    //Address Byte Mode
{
  if ( (rxbyte == 1) || (rxbyte == 127) )    //Address match or global address
  {
     mode = 1   //Address match, Move to next mode
  }
}
A tutorial on state machines is available here: https://www.matrixtsl.com/wikiv7/index. ... ateMachine

I use a similar technique to address pixel nodes on my gaming table here (Step 4 : Node Firmware): https://www.instructables.com/id/RGB-LE ... ing-Table/

luibra63
Posts: 36
Joined: Mon Aug 29, 2016 3:21 pm
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: I2C general call address

Post by luibra63 »

thank you Benj, very good, next week I try the firmware
best regards

Post Reply