Hi.
I use version 4.023 and have a problem with cpp.(i think)
Quote:
#include <16F877.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
When i compilied this code there no error. But the ccp1 and ccp2 pin only high for 1-2 us instead of 1.5 ms. Can you help with the code pls?
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
Posted: Thu Oct 11, 2007 10:36 pm
The CCP output latch is never set high!
The CCP latch is not the data latch. What is happening is that the the output pin is being set high by output_high() then immediately pulled low by setup_ccpx(CCP_COMPARE_CLR_ON_MATCH) because the default state of the CCP latch is low.
Don't switch between CCP mode and data mode.
Delete setup_ccpx(ccp_off);
Then to set the pin high, instead of output_high() use the technique shown in the CCS example EX_CCP1S.C
setup_ccp1(CCP_COMPARE_SET_ON_MATCH); // Configure CCP1 to set
CCP_1 = 0;
set_timer1(0); // C2 high now
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum