FMOpt2000
Joined: 10 Jan 2008 Posts: 17
|
PIC 18f4525 and pin B3 digital input |
Posted: Mon Jan 09, 2012 10:00 am |
|
|
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
}
}
|
|
|