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
I2C general call address
Moderator: Benj
- 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
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.
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/
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
}
}
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/
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel