kushal nandanwar
Full Member level 3
- Joined
- Jun 9, 2013
- Messages
- 177
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 18
- Activity points
- 1,258
sounds like you are getting an overflow with integer calculations, e.g. when adding to an unsigned 16 bit integer if the result goes over 65535 it starts from 0 againI'm trying to measure on time of a PWM signal using dsPIC30F4011 (Input capture mode), when I increase duty cycle of my signal from 20% to 50% it show correct value , but when increase it form 50% to 80% it's again display 50% to 20% duty cycle on my LCD display. Can someone help me, why this is happening .
sounds like you are getting an overflow with integer calculations, e.g. when adding to an unsigned 16 bit integer if the result goes over 65535 it starts from 0 again
can you show the algorithm use are using to calculate the PWM %
could you be getting overflow in the calculations within expressionsThanks for replay ,
I am using long and double variable for holding data.
unsigned int a=50000, b=60000;
unsigned long int c=a+b;
printf("c = %lu",c);
when you get an interrupt on change read the PORT value to see if it was a rising or falling edge?it's also same as duty cycle .
I think my controller start interrupt at positive cycle t0 ,t1 and t2.
after that it start again interrupt at negative cycle t0 , t1 and t2.
when i try to display duty cycle at low frequency it's duty cycle toggling
30% and 70%
20% and 80%
40% and 60%
sorry i do't understand that , can you pls elaborate it little more.
are you using input capture interrupt on rising edge or falling edge or both?There is no input change pin for IC1 and I have my LCD at IC8 and IC7
sprintf(Buffer1,"%Lf",duty);
try
Code:sprintf(Buffer1,"%Lf",duty);
%Lf does not seem to work in C30 or X16Showing Lf on display
- - - Updated - - -
sprintf(Buffer1,"%f",(double) duty);
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?