Since CCP1 represents a 16 bit value I recommend to use uint16.
For sure you may use a nother variable: new_ccp (just local in ISR)
And you need the variable: delta_t (global)
I must assume you dind´t put much effort in finding the solution on your own.
I´m not "C" specialist, thus I can´t give you a perfect answer. But your solution of post#23 is obviously wrong.
If you follow the internet search of post#22 you will find many suitable soultions.
It really takes less than a minute ... I wonder why you didn´t do this on your own.
There are even video tutorials in the first hits of the internet search.
Additionally MPLAB comes with documentation: Is it asking to much to read this documentation?
--> "MPLAB ® XC8 C Compiler User’s Guide", Chapter 5.3.6.2
I must assume you dind´t put much effort in finding the solution on your own.
I´m not "C" specialist, thus I can´t give you a perfect answer. But your solution of post#23 is obviously wrong.
If you follow the internet search of post#22 you will find many suitable soultions.
It really takes less than a minute ... I wonder why you didn´t do this on your own.
There are even video tutorials in the first hits of the internet search.
Additionally MPLAB comes with documentation: Is it asking to much to read this documentation?
--> "MPLAB ® XC8 C Compiler User’s Guide", Chapter 5.3.6.2
In chapter 5.3.6.2 there are only two lines of code. Did you read them?
You may even "copy and paste" them ..and then modify the variable_names to your need. That´s it.
I won´t do this for you.
There are million of example codes, documents and video tutorials.
CCPR1H and CCPR1L are the high and low bytes of a 16 bit register. They need to be combined respectively. I can hardly imagine that have never seen similar constructs in a C programming tutorial or text book.
Code:
New_ccp = (int)CCPR1H << 8 | CCPR1L;
- - - Updated - - -
As far as I'm aware of, the PIC special register issue (specific read order required) discussed in 5.3.6.2 doesn't apply to CCPR1 register. But it doesn't hurt to use the specified method. In any case <<8 shift of high byte or equivalent operation is required.