View previous topic :: View next topic |
Author |
Message |
JamesW
Joined: 23 Apr 2007 Posts: 91 Location: Rochester, England
|
help please CCP for Duty cycle measurements on PIC24!! |
Posted: Fri Sep 16, 2016 11:15 am |
|
|
Hi folks
I've been using pic's since the mid 90's but up to this point have never needed to use CCP to measure anything.
I've now got an application using a PIC24FJ64GA306-I/PT (running at 32Mhz), where I am connected to a Digi 868 wireless module & loads of peripherals.
I need to monitor the signal strength of the wireless, and the module provides a PWM signal with a period of about 72uS to allow you to monitor this.
I've set it up on pin B8, using timer1 and had a go at it, and despite two of us ending up tinkering with it have got absolutely nowhere sensible! (And the code has got more and more complicated and messed up).
I've got quite a few other sources of interrupt, and the unit is pretty busy (and to be honsest, the only thing I am going to be using the signal strength for is a number on the LCD display)
All I really need is a percentage number, to reflect how good the strength currently is.
Given the above details - can anyone please explain how to it simply (it's been a long week!)
Thanks in advance
James |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Sep 16, 2016 5:25 pm |
|
|
What happens if you measure the mean voltage?
Mike |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Sep 16, 2016 6:51 pm |
|
|
Honestly, I'd start 'fresh'. Simply cut code to measure the PWM signal and display on a local LCD (if your project has one) or send to PC terminal program. For test purposes I'd use a 2nd PIC as the PWM signal, that way YOU can control the 'signal strength', maybe 3 buttons for 25, 50, 75us.
You need to eliminate all the other stuff and concentrate on the PWM capture and display. Once that works THEN integrate the code into your main program.
Jay |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Fri Sep 16, 2016 7:36 pm |
|
|
Mike Walne wrote: | What happens if you measure the mean voltage? |
I was about to suggest the same approach but you beat me to it. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Thu Sep 22, 2016 3:00 am |
|
|
I have to say, stop.....
Look at the paperwork for these units:
Quote: |
PRODUCT EOL NOTICE #150619 – XBEE-PRO 868
Date: June 19, 2015
Product:
XBee-PRO 868 Products
Notice:
Effective June 19, 2015 Digi will begin the EOL process for all XBee-PRO 868 products. This EOL is due to the obsolescence and limited inventory of a critical component used in the product. All affected part numbers are listed below for reference
|
If you are designing new code, 'think again'. They have other modules that can do the job, and now it the time to realise this, and not waste effort on these modules. They are cheap now, because they are old stock. |
|
|
JamesW
Joined: 23 Apr 2007 Posts: 91 Location: Rochester, England
|
|
Posted: Wed Oct 05, 2016 10:58 am |
|
|
Sorry for the delay in replying folks, I enabled the PWM output - fed it through an RC network, and am getting an analogue signal that is measureable/useable - thanks for the advice.
I also believe I got to the bottom of why the CCP wasn't working as planned, as the CCS Modbus code/driver (being used to talk to a sensor in the background) uses the same timer interrupt - but buries it deep down in the driver code, so it's not immediately apparent that the timer is enabled, interrupting and in use.
With regards to the xbee PRO 868's, I'm not using these - but rather the XBee 868LP's instead, which are not end of life.
Thanks for all the help
James |
|
|
|