Page 1 of 1

Problem with PWM in DSPIC P33FJ256GP710A

Posted: 29 Dec 2019 19:48
by GTV
Good
I tell you that for many years I have not used this compiler and it may be a bit rusty in its use. I am using a TFT DSPIC P33FJ256GP710A plate from MIKROE and I am presented with a couple of problems that I commented to you:

Configuration of the Card to use the FLASH memory integrated in the board, therefore I use it in the compiler
Project -> edit project -> resources -> Externally
I compile again and the screens stop working
How do you load a library to use the on-board memory?


Also with the PWM I am trying to use two PWM channels, channel 1 and channel two. I attached the code I use.
The problem is in the duty cycle and the frequency of the second channel. If the first channel is different, the cycle is not fulfilled and on other occasions the output frequency is not.
The code used is:

Code: Select all

Sub procedure Inicializa_PWM()
Dim PWM_Period1 as word
Dim PWM_Period2 as word
'         PWM 1
' Inicia Canal 1 del Con el TIMER 2
PWM_Period1 = PWM_Init(F_Base_PWM1,1,8,2)
' Ajuste al 50% el Canal 1
PWM_Set_Duty(PWM_Period1 div  2,1)
if PWM_1_ON = 0 then
   PWM_Stop(1)
else
   PWM_Start(1)
End if
'         PWM 2
' Inicia Canal 2 del Con el TIMER 3
PWM_Period2 = PWM_Init(F_Base_PWM2,2,8,3)
' Ajuste al 50% el Canal 2
PWM_Set_Duty(PWM_Period2 div  2,2)
if PWM_2_ON = 0 then
   PWM_Stop(2)
else
   PWM_Start(2)
End if
end sub
Do you see anything strange?
Variables are reviewed and load the correct values
What can be?

Thank you so much

Re: Problem with PWM in DSPIC P33FJ256GP710A

Posted: 27 Jan 2020 15:17
by stefan.filipovic
Hi,

Unfortunately, there's no VTFT hardware pattern that stores resources externally to the Serial Flash.
You can select the MMC as media and try to adjust it to store resources to the Serial Flash.
Here you can find the Serial Flash example.

As for the PWM issue, I'm not sure if I fully understand the problem you are facing. Could you please provide me with more details?

Kind regards,