Hi,
Since it seems to work when you're using SPWM on one port (PortB for example) while the I2C is on another (PortC) I don't think it's a timing thing.
Since it does NOT seem to work when the SPWM is on the SAME port as the I2C I think it's some other sort of interference where the SPWM is messing with the I2C pins, possibly due to R-M-W but I don't know for sure.
As for the hardware PWM....
Well, then that IS the problem you're having - you're trying to run it at TO LOW frequency, which was the point I was trying to make.The original code hadCode:'******************************************************************************* 'Send pulses to drivers hpwm 1,W_PWM,200 hpwm 2,B_PWM,200 '*******************************************************************************
At 20MHz oscillator frequency there is no way to actually get 200Hz from the CCP module, the lowest possible frequency is 1221Hz.
/Henrik.
Bookmarks