Page 1 of 1

I2C general call address

Posted: Sun Feb 25, 2018 4:55 pm
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

Re: I2C general call address

Posted: Mon Feb 26, 2018 6:15 pm
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.flowcode.co.uk/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/

Re: I2C general call address

Posted: Fri Mar 09, 2018 7:20 pm
by luibra63
thank you Benj, very good, next week I try the firmware
best regards