|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
18F252 to 18F2620 upgrade problem |
Posted: Wed Apr 11, 2007 9:45 am |
|
|
I've been using the 18F252 for a couple of years now but a program I've written is too big to fit into it's ROM so I got hold of a couple of 18F2620s instead. Unfortunately, the code itself seems to work but I can't get anything through the output pin A0. I've tried everything I could think of but it doesn't seem to work, even resorting to the most basic program shown below which works fine on my 18F252 but not the 2620. Is there a new flag or something I need to set to enable the outputs? Help!!!
Thanks
Simon
Code: | #include <18F2620.h>
#device adc=8
/*#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPROTECT //Code not protected from reading
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV21 //Brownout reset at 2.1V
#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 PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES MCLR //Master Clear pin enabled*/
#fuses HS, NOWDT, NOPROTECT, NOBROWNOUT
#use delay(clock=8192000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,ERRORS)
void main()
{
/* setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
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);
setup_low_volt_detect(FALSE);
setup_oscillator(False);*/
output_float(PIN_A0);
while(1)
{
output_high(PIN_A0);
printf("high\r\n");
delay_ms(5000);
printf("low\r\n");
output_low(pin_A0);
delay_ms(5000);
}
return;
}
|
|
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Wed Apr 11, 2007 10:18 am |
|
|
I'm not sure if I'm reading the default states correctly from the datasheet. But, I think it may default to LVP if not specifically set to NOLVP.
Try adding that fuse and see if it helps...
I've never had problems with the 2620.
John |
|
|
|
|
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
|