Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20600

BASCOM-AVR : how to transfer a single number from a atmega8 to another vi : REPLY

$
0
0
sorry i was not very clear. when using a uart or other simple serial protocol, you need a way to determine where the data starts. this is often done with a header byte, or a magic number. But for SPI it is simple : this is just a big shift register. when the master sends a byte, the slave will send the current data. And since the slave is clocked by the master there is no problem. Just make sure the slave loads the data register right away. with overlay you can access a variable as bytes : dim sN as single, b(4) as byte AT sn OVERLAY sn=1.1 'now the array b(1), b(2), b(3) and b(4) hold the single value of SN the master must read 4 bytes to get a complete single.

Viewing all articles
Browse latest Browse all 20600

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>