Hello everybody;
The define of portTICK_RATE_MS is wrong for PIC24 :
Original :
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
If configTICK_RATE_HZ == 100, so 100 TICKs per second, then portTICK_RATE_MS egal 10, and the real rate is 100 ms, not 1 ms …
Correct version :
#if configTICK_RATE_HZ >= 1000
#define portTICK_RATE_MS ( configTICK_RATE_HZ / 1000)
#endif
Cordially.
Incorrect definitiion on portmacro.h PIC24
Incorrect definitiion on portmacro.h PIC24
configTICK_RATE_HZ is not used in the kernel code anywhere. It is provided just for convenience, so you can change the tick rate without having to change all delay and block times. It is used extensively in the demo tasks.
To convert ms into ticks, you divide the ms value by configTICK_RATE_HZ (provided the tick rate is equal to or slower than 1KHz).
If you want to block for 1 second, then you want to block for 1000ms. If your tick rate is 100Hz, you want to block for 100 ticks. In this case, with the definition as it stands, portTICK_RATE_MS would be 1000 / 100 = 10. Converting 1 second (1000ms) into ticks would be 1000ms / configTICK_RATE_HZ == 1000 / 100 == 10 == the right answer.
Regards.
Incorrect definitiion on portmacro.h PIC24
Correction:
To convert ms into ticks, you divide the ms value by configTICK_RATE_HZ (provided the tick rate is equal to or slower than 1KHz)should have read
To convert ms into ticks, you divide the ms value by configTICK_RATE_MS (provided the tick rate is equal to or slower than 1KHz)Regards.
Incorrect definitiion on portmacro.h PIC24
You can see that the macro name is confusing. Its the same for all ports though.