Quantcast
Viewing all articles
Browse latest Browse all 20596

BASCOM-AVR : simple spi soft problem : NEWTOPIC

hello, in order to understand well the SPI protocol I did 2 programs working on the same dev card: 1 Atmega644A as master, 1 atmega 168 as slave I doesn't want (for now) use the hard SPI protocol for M644: master Config Spi = Soft , Din = Pinc.2 , Dout = Portc.3 , Ss = Portc.4 , Clock = Portc.5 ' take care look at the mix of pin = input and port=output Var = &B10101010 Cls SPIINIT 'Init SPI state and pins. Do Spiout Var , 1 'send 1 byte Jinteger = Jinteger + 1 Waitms 200 loop ------------------------------ for M168 slave Config Spi = Soft , Din = Pinb.0 , Dout = Portb.1 , Ss = Portb.6 , Clock = Portb.7 Spiinit 'Init SPI state and pins. Cls Do Spiin Var , 1 'receive 1 byte Jinteger = Jinteger + 1 Waitms 200 Locate 1 , 1 : Lcd "send:" ; Jinteger Locate 2 , 1 : Lcd "Var:" ; Var Loop result var=255 ? pin Din(master) to din slave Dout(master) to dout slave and so on I try to cross Din and dout same result ! where is my fault ? Thanks JP [b:25cee91873][color=red:25cee91873](BASCOM-AVR version : 2.0.7.6 )[/b:25cee91873][/color:25cee91873]

Viewing all articles
Browse latest Browse all 20596

Trending Articles



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