Go to Post Every team should have a rule about not shouting "ROBOT!" when transporting a robot around the pits/arena. - frasnow [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2006, 11:59
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #2   Spotlight this post!  
Unread 11-02-2006, 12:47
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Using CCP modules

Quote:
Originally Posted by steven114
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
Section 17.1.2 of the data sheet might be of interest. This document might also help: http://kevin.org/frc/robot_controller_signal_map.pdf

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #3   Spotlight this post!  
Unread 11-02-2006, 13:05
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #4   Spotlight this post!  
Unread 11-02-2006, 14:51
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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));
prints out two sets of 0. Any reason this wouldn't work? It seems that most of the registers have handy named variables, but none of the CONFIG registers do. The documentation says that they are mapped into the memory space, so I don't see why a pointer dereference wouldn't grab the value... any other way to read these registers?
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #5   Spotlight this post!  
Unread 11-02-2006, 15:21
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Using CCP modules

Quote:
Originally Posted by steven114
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));
prints out two sets of 0. Any reason this wouldn't work? It seems that most of the registers have handy named variables, but none of the CONFIG registers do. The documentation says that they are mapped into the memory space, so I don't see why a pointer dereference wouldn't grab the value... any other way to read these registers?
Sorry, I don't really have time to research this. Try using the p18f8722.h header file for the memory-mapped variables.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #6   Spotlight this post!  
Unread 11-02-2006, 16:02
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Using CCP modules

Post a message over at ifirobotic's forum.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
  #7   Spotlight this post!  
Unread 11-02-2006, 16:04
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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...
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #8   Spotlight this post!  
Unread 13-02-2006, 12:43
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Using CCP modules

For the record:
http://www.ifirobotics.com/forum/vie....php?p=588#588
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 09:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi