Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] problem in updating the duty cycle values of 18f4431

Status
Not open for further replies.

prem123

Newbie level 5
Newbie level 5
Joined
Jul 11, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,380
problem in assigning the duty cycle values of 18f4431

usually according to the data sheet, the highest PDCn value should be PTPER register value. but when assigning duty cycles,largest duty cycle comes when PDCn=127.
why is that???
when we assign 128 the output stays in ON state.
bellow is the mikroc code..


void main()
{
PDC0L=0;
PDC1L=0;
PDC2L=0;
OVDCONS=0;
PTCON1=0;
PTCON0=0;


PTCON0=252; //Free running mode, Input clock is 1:64, Postscale is 1:16
PTCON1.PTEN=1; // Starts the generation of signals
PTPERH=137>>8; //storing the value 137 in PTPER
PTPERL=137; // which generates a PWM signal of 18 KHz
PWMCON0=80; //ALL PWM ARE INDEPENDENT, ONLY 0,1,2AND 3 IS ACTIVATED
PWMCON1=1; //Output overrides via the OVDCON register are synchronized to the PWM time base
DTCON=69; //dead time assignment
OVDCOND=255; //Output on PWM I/O pin is controlled by the value in the Duty Cycle register and the PWM time base
FLTCONFIG=0;
SEVTCMPH=0;
SEVTCMPL=0;
PWMCON1.UDIS=0;


while (1)
{
PDC0H=127>>6;
PDC1H=35>>6;
PDC2H=56>>6;
PDC0L=127;
PDC1L=35;
PDC2L=56;

delay_ms(5000) ;

PDC0H=70>>6;
PDC1H=56>>6;
PDC2H=42>>6;
PDC0L=70;
PDC1L=56;
PDC2L=42;

delay_ms(5000) ;

}

}
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top