Hi all,
I have a project where I have been using hi2c to send data to another picaxe and it has been working fine. I am using a 28X1.
I have an input interupt that is counting revolutions of a motor. I ran into a problem where I needed a pause of about 4 seconds, which was jumping out of the pause. After reading the forum I discovered the issue with jumping out of pause when an interrupt occurs. So I created a custom p_ause routine using the timer as follows:
Now I have a problem where my i2c stops working after using this p_ause routine. From the forum I discovered the issue with "settimer and hpwm" and "settimer and i2c" in pre V4 firmware. Please note that my original code has always had the command
in my initial setup because I use it create a random number.
I checked my firmware and I had V3. I swapped for a V5 firmware. And the problem still existed. After some experiementing I discovered if I set the timer back to 65520 after I have used the p_ause routine then my i2c starts working again!
Is there a reason that I need to set the timer back to 65520 for i2c to work correctly? I havnt tried going back to firmware V3 but I suspect it would work fine when setting the back back to this value.
Thanks
I have a project where I have been using hi2c to send data to another picaxe and it has been working fine. I am using a 28X1.
I have an input interupt that is counting revolutions of a motor. I ran into a problem where I needed a pause of about 4 seconds, which was jumping out of the pause. After reading the forum I discovered the issue with jumping out of pause when an interrupt occurs. So I created a custom p_ause routine using the timer as follows:
Code:
p_ause:
pause_time = 65535 - pause_time
pause_time = pause_time +1
timer=pause_time
settimer 63973
time_loop:
if toflag=0 then time_loop
return
Code:
settimer 65520 ' set timer for creating random number
I checked my firmware and I had V3. I swapped for a V5 firmware. And the problem still existed. After some experiementing I discovered if I set the timer back to 65520 after I have used the p_ause routine then my i2c starts working again!
Is there a reason that I need to set the timer back to 65520 for i2c to work correctly? I havnt tried going back to firmware V3 but I suspect it would work fine when setting the back back to this value.
Thanks