View previous topic :: View next topic |
Author |
Message |
NivNavick
Joined: 01 Nov 2010 Posts: 47
|
|
Posted: Sun Jan 30, 2011 1:01 pm |
|
|
When I programmed on the 18F4520 I had two methods,
I that return value from Ultra Sonic Ranger(SRF05) and the second return angle from CMPS03
from when I added the PWM bug fix those two methods aren't working any more, I think the pins are not changed to input and they are only outputs even I write SET_TRISA(0b000001);
What could be the problem?
Thanks!! |
|
|
NivNavick
Joined: 01 Nov 2010 Posts: 47
|
|
Posted: Mon Jan 31, 2011 9:10 am |
|
|
Does anybody knows? |
|
|
NivNavick
Joined: 01 Nov 2010 Posts: 47
|
|
Posted: Tue Feb 01, 2011 9:59 am |
|
|
hi
I have a month until my final project which I am working in it right now,
please answer
|
|
|
NivNavick
Joined: 01 Nov 2010 Posts: 47
|
|
Posted: Wed Feb 02, 2011 12:04 am |
|
|
I talked to CCS support and they told ne that
CCP3 registers aren't correct,
Is there anybody that know how to setup the
CCP3 registers and fix them?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 02, 2011 12:55 am |
|
|
I showed you how to make a work-around routine for CCP2 in this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=44564&start=8
Just do it the same way for CCP3.
Copy the #byte statements and change the register names so they
refer to CCP3 instead of CCP2. Look up the addresses of the CCP3
register in the PIC data sheet. Enter them into the new #byte
statements.
Make a copy of the "my_setup_ccp2()" routine and rename it for ccp3.
Edit the register names in the new function so they are the ones
associated with CCP3. Look up the default pin for CCP3 PWM output
in the PIC data sheet and edit the output_low() statement to use that pin.
Then in main(), call my_setup_ccp3(CCP_PWM) and set_pwm3_duty(128).
CCP3 also uses Timer2 by default, so the setup_timer_2() function will
work and can be left unchanged. The set_pwm3_duty() function
should also work without any changes.
It's really quite easy to make these changes, and they will probably work
if you're careful. |
|
|
|