PDA

View Full Version : Compiling for 18F26K22 - Does anyone have a solution for me?



Balachandar
- 28th August 2012, 09:31
Hi,

I am using PBP 2.60C with MicroCode Studio 4.0.0.0 for compiling a simple "Blink the LED" test program for 18F26K22. The short program is shown below. My problem is that no matter what I do, the compiling is not successful. MCS provides the option to select 18F26K22 device, but does not create the hex file and shows a series of error messages. Either I am making a mistake or there is an issue with PBP/MCS or some problem with the inc file.


DEFINE OSC 4 'Clock Speed: 4MHz

OSCCON = %11010010 'Internal oscillator is set to 4MHz
OSCTUNE = %10000000 'HFINTOSC selected; PLL disabled; Factory calibrated frequency
ADCON0.0 = 0 'Disable ADC
ANSELA = 0
ANSELB = 0
ANSELC = 0
ANSELE = 0
CM1CON0.7 = 0 'Disable comparator1
CM2CON0.7 = 0 'Disable comparator2

'Port direction
TRISA = 0 'All are Outputs
TRISB = 0 'All are Outputs
TRISC = 0 'All are Outputs

'An LED is connected to PORTC.3 through a 470 ohm resistor.

START:
PORTC.3= 1
PAUSE 500
PORTC.3 = 0
PAUSE 500

GOTO START

END


First I found that MPASM version 5.2 downloaded from MELabs site did not have the include file "P18F26K22.inc". I took the file from MPLAB version 8.87 and copied it to MPASM folder and tried to compile the code. The 23 error messages displayed by MC Studio are shown in the attached jpg file.

My idea is to use 18F26K22 in a complex project that currently uses 18F2620. I would highly appreciate help/suggestion from anyone that can lead to the resolution of my problem.

Regards,
Bala

Balachandar
- 28th August 2012, 10:53
Sorry, the error message file was not attached. The 21 messages from MCS are shown below.


Error[32] c:\pbp\18f26k22.inc 18 : Unknown processor [18F26K22]
Message]301] c:\mpasm\p18f26k22.inc 33 : MESSAGE: (Processor-header file-header file mismatch. Verify selected processor.)
Error[131] c:\pbp\18f26k22.inc 20 : Processor type is undefined
Error[131] c:\pbp\18f26k22.inc 21 : Processor type is undefined
Error[131] c:\pbp\18f26k22.inc 22 : Processor type is undefined
Warning[207] c:\pbp\pbppic18.lib 1237 : Found label after column1. (goto)
Error[122] c:\pbp\pbppic18.lib 1237 : Illegal opcode (INIT)
Error[122] c:\pbp\pbppic18.lib 6584 : Illegal opcode (clrf)
Error[122] c:\pbp\pbppic18.lib 6585 : Illegal opcode (movwf)
Error[122] c:\pbp\pbppic18.lib 6586 : Illegal opcode (clrf)
Warning[207] c:\pbp\pbppic18.lib 6587 : Found label after column1. (decf)
Error[122] c:\pbp\pbppic18.lib 6587 : Illegal opcode (R1)
Warning[207] c:\pbp\pbppic18.lib 6588 : Found label after column1. (subwfb)
Error[122] c:\pbp\pbppic18.lib 6588 : Illegal opcode (R1)
Warning[207] c:\pbp\pbppic18.lib 6589 : Found label after column1. (btfss)
Error[122] c:\pbp\pbppic18.lib 6589 : Illegal opcode (STATUS)
Warning[207] c:\pbp\pbppic18.lib 6590 : Found label after column1. (goto)
Error[122] c:\pbp\pbppic18.lib 6590 : Illegal opcode (DUNN)
Warning[207] c:\pbp\pbppic18.lib 6591 : Found label after column1. (movlw)
Error[108] c:\pbp\pbppic18.lib 6591 : Illegal character (0
too many errors

- Bala

HenrikOlsson
- 28th August 2012, 11:05
Hi,
According to the version history (http://support.melabs.com/content/29-PicBasic-Pro-Version-History) support for the 18F26K22 was added in 2.60A so you should be OK. Is it possible that you have multiple versions of the compiler installed and that MCS is pointed to an older version without support for the 18F26K22?

If that's not the case I'd probably try reinstalling MPLAB. Perhaps the file you copied isn't compatible with the version of MPASM you're trying to use with - the error message seems to indicate something in that direction.

/Henrik.

Balachandar
- 28th August 2012, 11:49
Thanks Henrik, for your helpful suggestion.

The compiler is installed in C:\MPASM and there is no other version residing anywhere else. MCS also shows under 'Compile and Program Options' that the assembler is located in this folder.

I installed MPLAB 8.87 today precisely for the purpose of getting the "P18F26K22.INC" file which I copied on to C:\MPASM folder. Yes, there is a possibility that this inc file is not compatible with the MPASMWIN.EXE (from MELabs) that I am using. So I copied the MPASMWIN.EXE file provided by MPLAB to my C:\MPASM folder and tried to compile. But no luck, I get similar error messages and compiling is not successful.

- Bala

HenrikOlsson
- 28th August 2012, 12:03
Hi,
Since you now have MPLAB 8.87 installed make sure you point MCS to the MAPSMWIN.EXE installed with THAT version instead of the "original" (or copied) one in C:\MPASM, there might be other support files in the new MPLAB installation that's needed so simply copying the "new" MPASMWIN.EXE into the old installation might not be enough.

If all fails uninstall ALL MPLAB installations and reinstall 8.87 to its default location (don't just install MPASM), then make sure the assembler selction in MCS points to that location.

/Henrik.

Balachandar
- 28th August 2012, 13:49
Hi Henrik,

Thanks a million. Tried your suggestion and it worked like a charm! You hit the nail on the head.

I changed the assembler folder in MCS from C:\MPASM where Mpasm 5.2 from MELabs was installed, to C:\Program Files (x86)\Microchip\Mpasm suite and hit the Compile button. After a few seconds, I saw in the left hand bottom corner that pleasant message "Success: 134 bytes used."

I got my 18F26K22 samples a year ago and at that time I tried to compile a program for this PIC trying different techniques, but finally gave up. Thanks for your help, now I can look forward to spending several hours playing with this PIC.

Regards,
Bala