|
|
View previous topic :: View next topic |
Author |
Message |
bc_max
Joined: 08 Feb 2006 Posts: 1 Location: Gatineau
|
18F4550 doesn't work but 16F877 do WHY??? |
Posted: Wed Feb 08, 2006 3:16 pm |
|
|
I need to use a PIC18F4550 but I can just work with 16F877 WHY??? I use PIC WIZARD to do my program (and I reduce it do flashing A0). When I use the PIC18F4550 the delay_ms doesn't look to be working. I use a PIC 16F877 with the very same circuit and it works.
I think the option of 18F4550 is not working in the program...
Could anyone help me please ?!?!?
Maxime |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Thu Feb 09, 2006 7:36 am |
|
|
Post the relevant code, the compiler and the compiler version. It's hard to help without that info _________________ The difference between genius and stupidity is that genius has its limits... |
|
|
Guest
|
|
Posted: Thu Feb 09, 2006 2:50 pm |
|
|
PCW C Compiler IDE
version 3.224
and the code for the .c file:
#include "W:\projet\buz16f877.h"
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
while(TRUE)
{
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
delay_ms(1000);
}
}
and the code for the .h file :
#include <16F877.h>
#device ICD=TRUE
#device adc=8
#fuses NOWDT,HS, NOPUT, NOPROTECT, BROWNOUT, LVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9) |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Thu Feb 09, 2006 3:07 pm |
|
|
Don't you need the PCWH compiler to compile for the PIC18? You have only listed the PCW compiler. _________________ The difference between genius and stupidity is that genius has its limits... |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Thu Feb 09, 2006 3:12 pm |
|
|
Assuming you have the correct compiler, could it be something as simple as forgetting to change the header file to grab the new device?
I mention this because I did exactly that last night. I moved a working program from the 16F877 to the 16F452 and was beating my head against the wall for an hour trying to figure out why it was so dead, and realised I had forgotten to modify the header file to change the device type. _________________ The difference between genius and stupidity is that genius has its limits... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 09, 2006 3:19 pm |
|
|
Quote: |
#include <16F877.h>
#device ICD=TRUE
#device adc=8
#fuses NOWDT,HS, NOPUT, NOPROTECT, BROWNOUT, LVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9) |
1. Are you using a LVP programmer ? Most programmers, such as ICD,
ICD2, Warp-13a, PicStart-Plus, etc. are High Voltage programmers.
You use the NOLVP fuse with those programmers.
2. Your serial port is set for 9 bits. Most people use 8 bits.
Also, you should add the ERRORS directive.
3. You have NODEBUG in your #fuses statement, but then you have
#device ICD=TRUE which will override the NODEBUG statement.
Instead of posting the code for the 16F877, you should post the code
for the 18F4550 that fails. Fix any of the problems shown above
that are in that program before you post it. |
|
|
|
|
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
|