Hello, I'm new in this forum and I hope someone can help me.
I'm using a PIC32MX to measure a PWM. I'm working with a function generator that gives me 450KHz wave. My period is 2.2us and I work with 20%. It means my pulse has a high edge around 444ns and my low edge around 1.77us.
I have an interrupt, change notification, and I use a timer45 mode 32bits to measure the time in high and low edge when my change notification happens. Every 100ms I send the time measured via CAN.
When I check my message with PCAN-Explorer I see 500ns and not 444ns for high and 1.2us and not 1.77us for low. My questions are: am I doing something wrong with the timer45? How should it be the timer45 configuration? How can I have more accuracy? Can I measure this fast with PIC32MX?
I'm using 10MHz oscilator and my timer45 configuration is:
Thanks in advance
I hope someone can help me
Regards
I'm using a PIC32MX to measure a PWM. I'm working with a function generator that gives me 450KHz wave. My period is 2.2us and I work with 20%. It means my pulse has a high edge around 444ns and my low edge around 1.77us.
I have an interrupt, change notification, and I use a timer45 mode 32bits to measure the time in high and low edge when my change notification happens. Every 100ms I send the time measured via CAN.
When I check my message with PCAN-Explorer I see 500ns and not 444ns for high and 1.2us and not 1.77us for low. My questions are: am I doing something wrong with the timer45? How should it be the timer45 configuration? How can I have more accuracy? Can I measure this fast with PIC32MX?
I'm using 10MHz oscilator and my timer45 configuration is:
Rich (BB code):
#define T45_CONFIG ( T4_ON | T4_IDLE_CON | T4_GATE_OFF | T4_PS_1_1 | T4_32BIT_MODE_ON | T4_SOURCE_INT )
#define T45_INT_CONFIG ( T45_INT_ON | T45_INT_PRIOR_1 | T45_INT_SUB_PRIOR_0 )
#define T45_PERIOD 0xFFFFFFFF
I hope someone can help me
Regards