CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

help please CCP for Duty cycle measurements on PIC24!!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JamesW



Joined: 23 Apr 2007
Posts: 91
Location: Rochester, England

View user's profile Send private message Visit poster's website

help please CCP for Duty cycle measurements on PIC24!!
PostPosted: Fri Sep 16, 2016 11:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 16, 2016 5:25 pm     Reply with quote

What happens if you measure the mean voltage?

Mike
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 16, 2016 6:51 pm     Reply with quote

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: 1911

View user's profile Send private message

PostPosted: Fri Sep 16, 2016 7:36 pm     Reply with quote

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. Laughing
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Thu Sep 22, 2016 3:00 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Wed Oct 05, 2016 10:58 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group