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

Compiler issues with PIC18F25J10

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



Joined: 04 Apr 2006
Posts: 22
Location: Sebastopol, CA

View user's profile Send private message Send e-mail Visit poster's website

Compiler issues with PIC18F25J10
PostPosted: Wed Jan 17, 2007 2:13 pm     Reply with quote

Complier version 3.249 was useless programming the
25j10. The ICD-U40 gave an error message saying it couldn't detect the MCU.
In version 4.20 it programs fine put the MCU does nothing. The oscillator doesn't even run.
In noticed there are a few errors the Header file and device editor.
The 25j10 had 1536 bytes of ram not 1024.setup_oscillator() is useless among other things.
There appears to be a few configuration fuses missing.

Has anyone had any of these issues?

Well, I have to go to lunch with the CEO so more on this later.
_________________
RAA
Richard A
Guest







PostPosted: Wed Jan 17, 2007 3:51 pm     Reply with quote

Ah ,1024 is correct. And timer 3 is defined. There is no timer 3 on this device.
Richard Arroyo



Joined: 04 Apr 2006
Posts: 22
Location: Sebastopol, CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Jan 18, 2007 8:54 pm     Reply with quote

I have found the problem.
The ICD-U40 cannot program the j series processors correctly.
It doesn't set the configuration words correctly.
In fact, I think they are in the wrong location for this pic.
I used a different programmer and the pic runs fine.

I have noticed the ICD-U40 circuit board layout isn't the best. I could pick up noise up to 300Mhz on my spectrum analyzers 10 feet across the room
emitting form the U40. I had to install capacitors in the unit to keep it quiet.
_________________
RAA
Ttelmah
Guest







PostPosted: Fri Jan 19, 2007 3:58 am     Reply with quote

The configuration words on these chips are not stored at all in the way they are on the others. Basically, the configuration data is held in the last few locations of the main program memory. Then when the chip boots, it automatically copies this data to the normal configuration address, which is RAM, rather than ROM, and is writable during the boot up. This write is a 'hardware' function, and done automatically, before the code starts running. Once written, the data become read-only, till the next boot up.
You can use the chips, with 3.249, by writing the required configuration data into the program memory, using a #ROM statement. You can also program them with the ICD, the same way. However you can't run the 'ICD' functions, because the ICD code, overlays the memory area where the configuration data resides.

Best Wishes
Richard Arroyo



Joined: 04 Apr 2006
Posts: 22
Location: Sebastopol, CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Jan 19, 2007 6:01 pm     Reply with quote

Hello, Ttelmah

Correct, I have found that in the data sheet though there are typo's and missing information as usual.
The device errata states to write the configuration bits starting at 7FF4h and not 300000h but the address is really
starts at 7FF8h. 300000h? lol

so #rom 0x7FF8 = {0b11110.... does the job.

I could not find the address for the OSCTUNE register in the data sheet to set the PLLEN bit.
It appears F9Bh is the correct address for the OSCTUNE register. I had to waste time finding it by programming the unimplemented registers.
Damn Microchip morons. The data sheet clames F9Bh is an unimplemented register.

The ICD-U40 still cannot program the j series processor correctly. Maybe it's because I updated the firmware
and introduced more bugs... bugware .
_________________
RAA
Richard Arroyo



Joined: 04 Apr 2006
Posts: 22
Location: Sebastopol, CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Jan 22, 2007 9:55 pm     Reply with quote

Tell me if I am wrong but it appears the adcon registers are being set incorrectly according to the code.
Here is the output:

Code:


setup_adc(ADC_CLOCK_DIV_4 |VSS_VDD|ADC_START_AND_READ|ADC_TAD_MUL_16);

1AEE:  MOVF   FC0,W
1AF0:  ANDLW  C0
1AF2:  IORLW  37
1AF4:  MOVWF  FC0
1AF6:  BSF    FC0.7
1AF8:  BSF    FC2.0




FC0(ADCON2) is set to (00110111) 55
resulting in FRC (A/D RC oscillator)
and not Fosc/4 selected.

FC2(ADCON0) A/D calibration bit (FC0.7) is set and not FC0.0
so the A/D converter is always disabled.

Very Happy
_________________
RAA
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 22, 2007 10:18 pm     Reply with quote

Quote:
setup_adc(ADC_CLOCK_DIV_4 |VSS_VDD|ADC_START_AND_READ|ADC_TAD_MUL_16);

The third constant is used with read_adc(), not with setup_adc().
From the 18F25J10.H file:
Code:

// Constants used in READ_ADC() are:
#define ADC_START_AND_READ     7   // This is the default
                                   //  if nothing is specified
#define ADC_START_ONLY         1
#define ADC_READ_ONLY          6



Quote:
setup_adc(ADC_CLOCK_DIV_4 |VSS_VDD|ADC_START_AND_READ|ADC_TAD_MUL_16);

Also, the 2nd constant is used with setup_adc_ports(), not with setup_adc():
Code:
// Constants used in SETUP_ADC_PORTS() are:
#define NO_ANALOGS  0x0F  // None
#define AN0_TO_AN6  0x08  // A0 A1 A2 A3 A5 F0 F1
// etc.

// The following may be OR'ed in with the above using |
#define VSS_VDD    0x00  // Range 0-Vdd
#define VREF_VREF  0x30  // Range VrefL-VrefH
#define VREF_VDD   0x20  // Range VrefL-Vdd
#define VSS_VREF   0x10  // Range 0-VrefH
Richard A
Guest







PostPosted: Mon Jan 22, 2007 11:17 pm     Reply with quote

How could I be so blind.
I've always done it right in the past.
It must be the solder fumes.
I've been doing electronics
since the 1980's so maybe I have lead poisoning.
Laughing

I'll correct it tomorrow.
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