View previous topic :: View next topic |
Author |
Message |
Guest Guest
|
PIC18F6680 and the CCP2 Multiplexer |
Posted: Mon Jul 25, 2005 2:07 pm |
|
|
Hi,
I'm using the 18F6680 (64pin package) and having trouble with the CCP2 input. The CCP1 input is working fine, but no matter what I do the CCP2 input is stuck on E7. E7 is actually an output driving a display and each transistion on that triggers the CCP2 ISR. This confirmed to me that the E7 pin was attached to CCP2 and defined as an output.
Setting the fuse CCP2C1 in the fuses did not change this. I also tried CCP2E7 just in case the logic was wrong but with no joy.
I guess the questions are:
1) Has anybody else had experience using the 6680 in this mode?
2) Can CCS confirm this code portion has been tested?
I think the CCP2 should default to C1 anyway, so I'm a little confused about how it is being set to E7.
Other than this problem I have ported code from two 458s onto one 6680 and have no problems in any other areas.
Hope someone can shed some light?
Thanks,
Alistair. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 25, 2005 2:46 pm |
|
|
I compiled the program shown below with PCH vs. 3.188, and it
did set the CCP2MX = 1, which puts it on Pin C1.
At the end of the .LST file, it shows this:
Code: | Word 3: 8100 CCP2C1 MCLR |
If I go to the MPLAB (vs. 7.20) menu for Configure / Configuration Bits,
it shows this:
Code: | Address Value Category Setting
300005 81 CCP2MUX RC1 |
Code: |
#include <18F6680.h>
#fuses XT, NOWDT, NOPROTECT,PUT,BROWNOUT,NOLVP, CCP2C1
#use delay(clock=4000000)
//======================
void main()
{
while(1);
} |
|
|
|
Guest Guest
|
|
Posted: Tue Jul 26, 2005 2:23 am |
|
|
Word 3: 8383 CCP2C1 MCLR
This appears in my list file.
The fact is with this in the list file I'm getting IRQ on my CCP2 ISR when the pin E7 changes.
It must be something to do with modes or something not set elsewhere. I think I'll drop support an email.
Thanks for the input.
Alistair |
|
|
Guest
|
|
Posted: Tue Jul 26, 2005 2:25 am |
|
|
Word 3: 8383 CCP2C1 MCLR
This appears in my list file.
The fact is with this in the list file I'm getting IRQ on my CCP2 ISR when the pin E7 changes.
It must be something to do with modes or something not set elsewhere. I think I'll drop support an email.
Thanks for the input.
Alistair |
|
|
Guest
|
|
Posted: Tue Jul 26, 2005 2:33 am |
|
|
The fuse values seem different or am I reading that wrong? |
|
|
Guest
|
|
Posted: Tue Jul 26, 2005 2:35 am |
|
|
Word 3: 8383 CCP2C1 MCLR
This is the output with PCWH 3.228
I assume they should be the same? |
|
|
Guest
|
|
Posted: Tue Jul 26, 2005 6:07 am |
|
|
Actually according to the 6680 data sheet, 8383 for the config register is or should be the default values used. The correct bit seems to twiddle for the CCP2E7 huse as well!
There is a worrying comment on bit 1 for this config register for teh ECCPMX bit. This is reserved for the 6680............
So according to the data sheet the manual is twiddling the correct bits. The compiled list file from PCM is different using an older set of tools.
So the only thin left to do is go in and start reading back this register once all the code is running and see if it is a runtime thing with this register resetting. Otherwise I'll change the PCB layout! :-) |
|
|
Guest
|
|
Posted: Tue Jul 26, 2005 12:46 pm |
|
|
Problem Sorted:
The EPIC programmer I use has a config base and mask settings. These were incorrect for the device. Due to the program 0 nature of the device and these bits being masked out of the config registers then the CCP mux was being forced to E7, as well as a number of other things.
For any body using EPIC programmers check your EPIC.INI file for your particular device.
Thanks for your help.
Alistair. |
|
|
|