View previous topic :: View next topic |
Author |
Message |
freddayz
Joined: 05 Oct 2009 Posts: 9
|
PIC16F917 Port D2 problem |
Posted: Mon Oct 05, 2009 6:06 pm |
|
|
I am using the PIC16F917 device with the following code:
Code: |
// Include files
#include "16F917.h"
#device adc=10
#define CCP_OFF
// PIC Configuration
#use delay ( clock = 8MHZ, type = internal )
#fuses HS // Crystal Osc (> 4 MHz)
#fuses NOWDT // No watch Dog Timer
#fuses NOPROTECT // Code not protected from reading
#fuses NOPUT // No Power Up Timer
#fuses NOBROWNOUT // No Brownout Reset
#fuses NOIESO // Internal External Switch Over mode disabled
#fuses FCMEN // Fail-safe clock monitor enabled,
#fuses NOMCLR // Master Clear pin used for I/O
void main ()
{
// CCA Initialization
Disable_Interrupts(INT_CCP2);
output_high(PIN_D3);
output_high(PIN_D2);
}
|
The problem is that I can enable an LED out of Port D3 but not D2 and I am using the same circuitry. I read that Port D2 is related to the CCP2 function of the PIC but have hit a wall and cant get it to work.
Any ideas on my problem?
Thanks-N-Advance |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 05, 2009 10:58 pm |
|
|
Post your compiler version. |
|
|
freddayz
Joined: 05 Oct 2009 Posts: 9
|
|
Posted: Tue Oct 06, 2009 9:19 am |
|
|
Compiler Version:
4.071 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 06, 2009 1:05 pm |
|
|
I installed vs. 4.071 and ran the following test program in hardware
on a 16F917 on a PicDem2-Plus board. It works. Both pins D2 and D3
are toggling, every 500 ms, as seen on an oscilloscope.
Code: |
#include <16F917.H>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, PUT
#use delay(clock=8000000)
//======================================
void main()
{
while(1)
{
output_high(PIN_D2);
output_high(PIN_D3);
delay_ms(500);
output_low(PIN_D2);
output_low(PIN_D3);
delay_ms(500);
}
}
|
|
|
|
freddayz
Joined: 05 Oct 2009 Posts: 9
|
|
Posted: Wed Oct 07, 2009 9:34 am |
|
|
It appears it may be a HW problem within the PIC...will swap and see results.
Thanks for the help. |
|
|
freddayz
Joined: 05 Oct 2009 Posts: 9
|
|
Posted: Thu Oct 15, 2009 4:33 pm |
|
|
It was the HW...thanks |
|
|
|