I need to read and write a variety of byte lengths to a slave, 1-158 bytes.
According to the Config twiSlave help this is done by enabling UserAck
But this part of the help text confuses me:
"You can use this to send data with variable length to the slave. In this case, BTR only serves as an index. You must make sure to reset TWI_ACK when you have send the last byte to the master."
It is the receiving end that does the Acking and Nacking, so the first part makes sense, when sending data to the slave, the slave will Ack or Nack.
But the second part; "make sure to reset TWI_ACK when you have send the last byte to the master." in this case the Master does the Acking and Nacking and will Nack the last byte... :-s
I can't get this to work without changing the BTR parameter of the Config statement, is there a way of dynamically changing it in code?
If so I could send a data length byte and set BTR before starting to read data from the slave...
[b:623daf1a89][color=red:623daf1a89](BASCOM-AVR version : 2.0.7.7 )[/b:623daf1a89][/color:623daf1a89]
↧