View previous topic :: View next topic |
Author |
Message |
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
Hex code doesn't work on PIC18F4458 |
Posted: Fri Jul 15, 2011 12:44 pm |
|
|
Dear members;
I am trying to be familiar with the PIC18F4458 as I will be use it in my final year project.
I used a simple example to output 0xFF to port B (B is set as output bit). I used CCS compiler both with MPLAB and CCS IDE. The project compile successfully but when I upload the hex code to the PIC18F4458 (upload successfully) nothing happened (I am using easypic6 dev board).
So I tried C18 C compiler using MPLAB but this time did work.
As I intend to choose CCS as my compiler, does any one know how to resolve the problem.
It is just confusing when a small program like doesn't want to work.
Appreciate any help.
NB: I tried CCS compiler with PIC16F877A to achieve the same thing and it did work. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 15, 2011 12:49 pm |
|
|
Quote: | is just confusing when a small program like doesn't want to work. |
Post it. We're not mind-readers.
Post the #include for the PIC, #fuses, #use delay, other #use statements
(if any), variable declarations and #defines (if any), main(), etc. |
|
|
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
|
Posted: Fri Jul 15, 2011 3:36 pm |
|
|
PCM programmer wrote: | Quote: | is just confusing when a small program like doesn't want to work. |
Post it. We're not mind-readers.
Post the #include for the PIC, #fuses, #use delay, other #use statements
(if any), variable declarations and #defines (if any), main(), etc. |
Here the code :
Code: |
#include "E:\Microchip\bin\PICC\blink3\blink3.h"
//#include<18F4458.h> // when I un-coment this it will generate an error ' Unkown device type PIC18F4458'
#use fast_io(B)
#use delay(clock=20000000)
#fuses HS,NOWDT,NOLVP
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_tris_b(0x00);
while(1)
{
output_b(0xff);
delay_ms(1000);
output_b(0x00);
delay_ms(1000);
} |
The code above work for PIC16F877a ( when including 16F877A.h) while exactly the same code don't ( just changing the header file to 18F4458). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 15, 2011 4:18 pm |
|
|
Quote: | #include "E:\Microchip\bin\PICC\blink3\blink3.h"
|
Post the contents of this file.
Also, what's your CCS compiler version ? |
|
|
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
|
Posted: Fri Jul 15, 2011 4:36 pm |
|
|
PCM programmer wrote: | Quote: | #include "E:\Microchip\bin\PICC\blink3\blink3.h"
|
Post the contents of this file.
Also, what's your CCS compiler version ? |
Thanks for the reply.
That line of code has been added by the IDE its self and the code is below
Code: |
#include<18F4458.h>
|
The CCS compiler I am using it is an evaluation version that I downloaded from the CCS website. IDE version 3.36
Does the evaluation version does not cover PIC18 series when it come to compiling and uploading to the target microcontroller? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 15, 2011 4:42 pm |
|
|
The compiler version is given at the top of the .LST file. The .LST file is
generated after a successful compilation. It will be in the project directory.
The compiler version is a 4-digit number in this format: x.xxx
Look in the .LST file for your project and post the version.
Example of CCS version numbers:
http://www.ccsinfo.com/devices.php?page=versioninfo |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Jul 16, 2011 2:17 am |
|
|
The version you have is unbelievably old.
I've never heard of IDE 3.36, but the _last_ V3 IDE, dates to late in 2008. About three years old. At this point the 4458, was not supported (it was only launched at about this time, with beta devices available).
The current demo compiler, is over 2.5 years later than the one you have.....
Best Wishes |
|
|
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
|
Posted: Sat Jul 16, 2011 8:09 am |
|
|
PCM programmer wrote: | The compiler version is given at the top of the .LST file. The .LST file is
generated after a successful compilation. It will be in the project directory.
The compiler version is a 4-digit number in this format: x.xxx
Look in the .LST file for your project and post the version.
Example of CCS version numbers:
http://www.ccsinfo.com/devices.php?page=versioninfo |
Thanks for the reply.
When clicking on the About in the Help menu, the information displayed in the About box are:
PCW COMPILER
Registred to: LIMITED EVALUATION VERSION
IDE version 3.36
PCM Version 3.170b
PCH Version 3.170b
When activating the compiler, its windows shows: version 3.170b.
So I guess the compiler version is 3.170b. |
|
|
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
|
Posted: Sat Jul 16, 2011 8:17 am |
|
|
Ttelmah wrote: | The version you have is unbelievably old.
I've never heard of IDE 3.36, but the _last_ V3 IDE, dates to late in 2008. About three years old. At this point the 4458, was not supported (it was only launched at about this time, with beta devices available).
The current demo compiler, is over 2.5 years later than the one you have.....
Best Wishes |
Thanks for the reply.
The IDE 3.36 I got from the About box ( help-->About).
The evaluation I am using was recently downloaded from http://www.ccsinfo.com/downloads.php
Are you saying that the actual demo version is 2.5 years old and doesn't support the PIC18F4458?
If it is the case where I can get beta version and does free version for student exist.
I appreciate your help.
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Jul 16, 2011 8:20 am |
|
|
Yes. 3.170, dates to late 2003, predating the 4558, by at least four years. No wonder it is not working!.
Also the early test compiler was limited only supporting a couple of standard chips. It is only in the last couple of years that the test compiler has offered full chip support.....
Best Wishes |
|
|
rabmerab
Joined: 15 Jul 2011 Posts: 8
|
|
Posted: Sat Jul 16, 2011 8:45 am |
|
|
Ttelmah wrote: | Yes. 3.170, dates to late 2003, predating the 4558, by at least four years. No wonder it is not working!.
Also the early test compiler was limited only supporting a couple of standard chips. It is only in the last couple of years that the test compiler has offered full chip support.....
Best Wishes |
Thanks man, I think that what it is then.
Do you know if there is another version for student or should stick with C18 compiler from microchip? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Jul 16, 2011 2:33 pm |
|
|
Download the current version.
What you have is not what is currently supplied for test/education.
Best Wishes |
|
|
|