|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using CCP modules
I'm trying to count a fast-moving encoder, and instead of having thousands of interrupts firing every second I thought it would be a good idea to use the CCP modules in Capture mode to count the number of ticks. However, ifi_aliases.h says that CCP2-5 all have output buffers on them that prevent them from being used in Capture mode, even if you select USER_CCP in the code. Is it true that there is _no_ way to do this? If not, what happened to CCP1? I couldn't find it mentioned anywhere in the documentations, and cross-referencing from the PIC datasheet to the RC docs didn't turn up anything. Anyone know if CCP1 is available for use?
Thanks, Steven |
|
#2
|
||||
|
||||
|
Re: Using CCP modules
Quote:
-Kevin |
|
#3
|
|||
|
|||
|
Re: Using CCP modules
Thanks very much for pointing those out - here's what I'm reading from them. ECCP2 can change which pin it uses, depending on how you set up the register. By default it is assigned to RC1, which is PWM13 and IFI says is unusable as a Capture input. If you are in microcontroller mode, it goes to RE7 which is not available for use. If not, it is attached to RE3 which is Relay 4 Fwd. Is it possible to use that as an input, or is there circuitry on the inside preventing this? Can I simply set the appropriate pin to input and not use relay 4? Are we in "microcontroller" mode? It seems to be set by the configuration register, which is programmed by IFI, correct?
Thanks for any pointers, Steven |
|
#4
|
|||
|
|||
|
Re: Using CCP modules
Ok, a few more things:
I tried to read the contents of CONFIG3L and CONFIG3H, which have the information regarding microcontroller mode and the ECCP2 multiplexing. Code:
char *CONFIG3L = 0x300004, *CONFIG3H = 0x300005;
printf("Init CONFIG3L=%d CONFIG3H=%d",(int)(*CONFIG3L),(int)(*CONFIG3H));
|
|
#5
|
||||
|
||||
|
Re: Using CCP modules
Quote:
-Kevin |
|
#6
|
||||
|
||||
|
Re: Using CCP modules
Post a message over at ifirobotic's forum.
|
|
#7
|
|||
|
|||
|
Re: Using CCP modules
It doesn't have the CONFIG registers memory-mapped, unfortunately. Thanks for your help; I guess I'll have to go for an external solution or maybe just interrupt really quickly... If anyone else has any ideas (or has gotten it working in the past!), though, I'd be happy to hear them!
![]() [EDIT] Joel: good idea, I think I'll do that... |
|
#8
|
|||
|
|||
|
Re: Using CCP modules
For the record:
http://www.ifirobotics.com/forum/vie....php?p=588#588 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about kevin's code | ImmortalAres | Programming | 3 | 23-06-2005 11:13 |
| Vishay IR Reciever modules | EIROBOTICS86 | Electrical | 4 | 04-02-2004 00:18 |
| Calling all PHP/ASP programmers! | blueWarrior | FIRST-related Organizations | 15 | 27-01-2004 13:24 |
| The Lowerr LEGO Swerve | rlowerr_1 | Robot Showcase | 4 | 21-12-2003 23:41 |
| Pre-Season Kit Learning Modules | kmcclary | Robotics Education and Curriculum | 10 | 21-11-2002 11:37 |