|   |
![]() |
|||||
Home |
Data transfer can work both ways, which means that the Master can send data to the Slave or the Slave can send data to the Master.
But there may be times when the above mentioned methods are not suitable anymore.
For instance if you want to transfer a binary file from Master to Slave or visa versa.
That's where the real Data Transfer kicks in.
Normally a Slave wakes up in Command mode, which means that all characters it receives from the SB-Bus are interpreted as commands and parameters.
Some Commands however can select the Data transfer mode, in which all received characters are interpreted as data instead of Commands.
It is up to the used protocol how to terminate the Data transfer mode which makes the Slave switch back to Command mode again.
In any way, a possible transfer is always terminated when the Slave receives an Address byte!
The 7-bit ASCII limitation does imply that you can not simply send a binary file as legal data.
Other Slaves will interpret values above 127 as addresses, and act accordingly and results are unpredictably.
Other types of data may require a different approach. I don't want to prescribe any fixed rules to such transfers, I shall only give some suggestions.
Define a unique way in which a transfer is ended.
For instance end the transfer when an empty line is sent, or when a line is sent which only contains a period.
Sending an ASCII EOT ($04) character is also a possibility.
Strange characters may have to be escaped by a special character.
Common practise is to use for instance the back slash as escape character, which is then followed by the ASCII code of the special character to send.
For instance \130 would send a character with the value 130.
While \013 would send a CR character, without ending the line like a real CR would have done!
As a rule of thumb you should always terminate the transfer of data when one of the parties sends an ESC character. When a Slave receives an ESC character from the Master during a transfer it replies by sending an !> Prompt. |