PDA

View Full Version : Trouble with PIC 18F2220



cpayne
- 13th August 2005, 03:43
I have Microcode Studio Plus and EPIC programmer. I am trying to program the 18F2220 for the first time. I have of course bought a 100 of these chips and had a PCB built on the speculation that I would be able to program the 18F2220. 2 things

Microcode says it does not support this chip (even though it available in the drop down). It them wants to find MPASM as an assembler, which causes nothing but errors on all my @ device INTRC_OSC_NOCLKOUT statements, so I took them out and get a successful compile, change all the configurations in EPICWin, then download. Does Microcode Studio Plus support this chip, why does it need MPASM and how do I get my picbasic special lines back in?

When I download to the chip EPICWin just gives a Code programming error at 00000. The 2001 EPIC Programmer 40/28 Pin ZIF Adaptor I have does not have a part number other than "01189 JMS" on the back, is it the right one for the chip? Is there some unique way to put the chip in the socket (I was just putting pin 1 up by the lever handle of the ZIF)? Or is it a problem with the compiling?

I tryed a simple program in CodeDesigner too, it did not work, nothing but errors...

my PBP directory has files for the PIC18F2220

Any help would be great, I really need this to work.

Thanks

Ioannis
- 13th August 2005, 12:29
The PM assembler (used by PBP compiler) does not support 18F chips for the moment. So you have to use Microchip Assembler mpasm (download from microchip site).

Also you have to note that mpasm does not have the same directives as PM.exe so you have to change the headers and other assembler commands as you already noticed.

Ioannis

cpayne
- 13th August 2005, 13:40
OK, so I used the MPASM and got it so there were zero errors, but when I go to download using the EPIC programmer, why do I get the program error 00000, which implies it can't find the chip right? any idea what I have to do with the epicwin program? Thanks!

CHarlie

Ioannis
- 13th August 2005, 19:20
Can't tell you about EPIC, sorry!
Ioannis

cpayne
- 15th August 2005, 01:07
OK I got the program to load backwards. I think it was sucessfull. I imported the hex into the MPLAB and programed it with my ICD2, it seemed to work.

Now that I am using MPASM and the ICD2, I don't know how to turn on the internal oscillator or mclr since they are not legal statements for the PIC18s

how do I program the following statemements in now?
@ device INTRC_OSC_NOCLKOUT
'@ DEVICE XT_OSC ' System Clock Options
@ DEVICE WDT_ON ' Watchdog Timer
@ DEVICE PWRT_ON ' Power-On Timer
@ DEVICE BOD_ON ' Brown-Out Detect
@ DEVICE MCLR_OFF ' Master Clear Options
@ DEVICE LVP_OFF ' Low-Voltage Programming
@ DEVICE CPD_OFF ' Data Memory Code Protect
@ DEVICE PROTECT_OFF ' Program Code Protection

OSCCON = $60 'sets the oscillator speed
DEFINE OSC 4 'Oscillator speed in MHz: 3(3.58) 4 8 10 12 16 20 24 25 32 33

I actually really only need the internal osc at 8mHz and the MCLR off, the rest would be nice to know for future reference.

Any help? Thanks

Ioannis
- 16th August 2005, 07:38
the commands/directives of the mpasm assembler are different from PM.exe so you have to read the manual of the mpasm to understand the syntax and commands.

I'd be happy to read for you but I do not have the time to do so.

Ioannis

cpayne
- 19th August 2005, 13:17
got it. in the front of the code, i put the following
@ __CONFIG _CONFIG1H, _INTIO2_OSC_1H
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
@ __CONFIG _CONFIG3H, _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L

but you have to go into PBP's 18F2220.INC and remark out the following...
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2220, r = dec, w = -311, f = inhx32
INCLUDE "P18F2220.INC" ; MPASM Header
; __CONFIG _CONFIG1H, _XT_OSC_1H
; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
; __CONFIG _CONFIG3H, _MCLRE_ON_3H
; __CONFIG _CONFIG4L, _LVP_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8

Thanks...