CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC 18f4525 and pin B3 digital input

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
FMOpt2000



Joined: 10 Jan 2008
Posts: 17

View user's profile Send private message

PIC 18f4525 and pin B3 digital input
PostPosted: Mon Jan 09, 2012 10:00 am     Reply with quote

Hi, I'm new in using PIC.

I did a firmware without problems but now I re-assigned my PINs
and I've a strange behaviour on pin B3 (pin 11 - tqfp)
I've some pulse in output (1ms) 500 ms(period), but for me this is a digital input.

Do you help me, about that?

This is the code (without some parts).

Code:

#include <18F4525.h>
#device ICD=TRUE
#device adc=10
#FUSES WDT128
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT                //Code not protected from reading
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
//#FUSES LVP                      //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                     //Data EEPROM not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES LPT1OSC                  //Timer1 configured for low-power operation


#use delay(clock=8000000)
#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS)




Code:


#include "main.h"
#include "functions.c"


// sezione debug da togliere alla fine
int1     app_debug=0;
int1     onda;


#int_RTCC
void  RTCC_isr(void)
{
//


}





void main()
{

   
   setup_adc_ports(AN0_TO_AN2|VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_6);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   
   
   //setup_timer_0(RTCC_INTERNAL);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);
   
   //disable_interrupts(INT_RTCC);
   enable_interrupts(INT_RTCC);
   
   //setup_oscillator(OSC_8MHZ|OSC_TIMER1|OSC_31250|OSC_PLL_OFF);  //OLD
   setup_oscillator(OSC_8MHZ);  //reccomended

   // TODO: USER CODE!!

   general_status[0]=0xFF;
 
 
 
 
   while(1)
 
   {
 // CODE
 
 
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 09, 2012 1:13 pm     Reply with quote

Will this code that you posted actually show the problem if we program it
into a PIC ? If not, post a complete program (but very short) that does
show the problem.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group