Here's an example fix for i2c_hardware.jal (untested), for my eirlier
suggestion that the library should make a 2nd start condition into a
restart.
var byte i2c_has_start = FALSE
--
-----------------------------------------------------------------------------
-- i2c_start - Sends Start bit and waits untill finished
--
-----------------------------------------------------------------------------
procedure i2c_start() is
if i2c_has_start == FALSE then
SSPCON2_SEN = high
i2c_has_start = TRUE
while SSPCON2_SEN == high loop end loop
else
i2c_restart()
end if
end procedure
--
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
-- i2c_restart - Sends Restart bit and waits untill finished
--
-----------------------------------------------------------------------------
procedure i2c_restart() is
SSPCON2_RSEN = high
while SSPCON2_RSEN == high loop end loop
end procedure
--
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
-- i2c_stop - Sends Stop bit and waits until finished
--
-----------------------------------------------------------------------------
procedure i2c_stop() is
SSPCON2_PEN = high
i2c_has_start = FALSE
while SSPCON2_PEN == high loop end loop
end procedure
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.