Thank you for quick reply!
Yes i have, this is configuration for my pic
ADCON1 = $0F
CMCON = 7
UCFG.3 = 1
PORTA = 0
PORTB = 0
PORTC = 0
Thank you for quick reply!
Yes i have, this is configuration for my pic
ADCON1 = $0F
CMCON = 7
UCFG.3 = 1
PORTA = 0
PORTB = 0
PORTC = 0
Just want to add,when I turn off TRM1 before reading i2c, rtc is operating normally, but problem is with LED strips on PWM channel they strart flashing.
T1CON.0=0
I2CRead sda,scl,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCDay,RTCDate,RTCMonth,RTCY ear]
T1CON.0=1
Last edited by DaTiNs; - 31st May 2012 at 13:09.
Damir,
I can duplicate the issue here, which appears to be the old R-M-W hardware problem.
I moved the PWMs over to PORTC, and everything works fine.
Since I2C uses pull-ups instead of bi-polar driven outputs, it's more susceptable to R-M-W problems.
If you cannot move pins around on your project, you can get away with the following.
In general, I do not recommend doing this type of modification.
But in your specific case, it should work.
Code:SPWM_LIST macro SPWM_PIN LATA, 2, _CH1 SPWM_PIN LATA, 3, _CH2 SPWM_PIN LATA, 4, _CH3 SPWM_PIN LATA, 5, _CH4 endm
DT
I should have also mentioned that when using the LATA register, you'll need to set the pins to output manually.
Code:TRISA = %11000011
Last edited by Darrel Taylor; - 31st May 2012 at 19:56.
DT
Thank you very much!
I must add TRISA = 0 to the begin of code, and then start work great.
One more time, thank you, Damir.
Darrel,
While poking around and getting ideas, I got to looking at ver 1.2 of "Elapsed_INT-18.bas". I was particularly interested in the nice routine to calculate the timer reload constant:
But, I think there is an error in the formula. The absolute time it takes to execute the 8 instruction cycles doesn’t change. But, the time in relation to the TMR1L will be proportional to the prescaler. So, that should be accounted for in the formula, as such:Code:' -------------- calc timer reload Constants ------------------------------- ASM T1PS = 1 ; start with 1:1 postscaler TimerConst = ((OSC*1000000)/4/100) ; how many timer ticks will it take while TimerConst > 65400 ; if it's more than the timer can count T1PS = T1PS * 2 ; double the postscaler TimerConst = TimerConst / 2 ; halve the count endw TimerConst = 65536 - TimerConst + 8 ; final reload value
Since it's not likely the prescaler will need to be above 1:8, the 8/T1PS shouldn’t get too low.Code:TimerConst = 65536 - TimerConst + (8/T1PS) ; final reload value
Thanks again for your great work and inspiring examples,
Steve
Last edited by SteveB; - 5th December 2012 at 22:38. Reason: typo
The code could also be changed thus, not that it makes a difference:
Code:T1PS = 1 ; start with 1:1 postscaler TimerConst = ((OSC*1000000)/4/100)+8 ; how many timer ticks will it take while TimerConst > 65400 ; if it's more than the timer can count T1PS = T1PS * 2 ; double the postscaler TimerConst = TimerConst / 2 ; halve the count endw TimerConst = 65536 - TimerConst ; final reload value
Hi Darryl,
Currently getting an error with Latest MPLAB IDE:
MPLAB 8.90.00.00
PIC is an 18F45K22 and DT_INTS-18 is latest from your website, both MPLAM and DT_INTS were downloaded from the respective sites on 15/3/2013
ERROR: Unable to execute mpasmwin.Warning[206] M:\<FOLDERPATH><FILE>ASM 2170 : Found call to macro in column 1. (INT_ENABLE)
Error[116] M:\<FOLDERPATH><FILE>.ASM 696 : Address label duplicated or different in second pass (Z00032)
Error[116] M:\<FOLDERPATH><FILE>.ASM 759 : Address label duplicated or different in second pass (Z00033)
Error[116] M:\<FOLDERPATH><FILE>.ASM 812 : Address label duplicated or different in second pass (Z00034)
Error[116] M:\<FOLDERPATH><FILE>.ASM 843 : Address label duplicated or different in second pass (Z00035)
Can you advise if there is any fix for this or do i need to use an older version of MPLAB IDE
Bookmarks