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

BASCOM-AVR : Problem with I2creceive versus I2crbyte : NEWTOPIC

$
0
0
I have a problem with M328 stopping and have tracked it down to I2creceive the device being read is a LM75A the program works sometimes once reading the lm75a sometimes it goes for 20 minutes but mostly stops very quickly. Now after a lot of head scratching I have found the cause. In the code below if I use I2cwbyte & I2crbyte it runs with no problems but if I use I2creceive it stops so should the I2creceive produce exactly the same result as using I2cwbyte & I2crbyte? Regards Paul [code:1:197f2133ef] $regfile = "m328def.dat" $crystal = 8000000 'using internal RC $hwstack = 80 $swstack = 80 $framesize = 80 $baud = 19200 $lib "i2c_twi.lbx" 'use hardware TWI (I2C) ' Config Sda = Portc.4 'must match the hardware TWI pins Config Scl = Portc.5 Config I2cdelay = 20 Dim Lm75temp As Integer Dim Lm75buf(2) As Byte At Lm75temp Overlay I2cstart I2cwbyte &H9F I2crbyte Lm75buf(2) , Ack I2crbyte Lm75buf(1) , Nack I2cstop 'I2creceive &H9F , Lm75temp [/code:1:197f2133ef] [b:197f2133ef][color=red:197f2133ef](BASCOM-AVR version : 2.0.7.6 )[/b:197f2133ef][/color:197f2133ef]

Viewing all articles
Browse latest Browse all 20773

Trending Articles



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