PDA

View Full Version : 18F1220 programming problem



jderson
- 26th June 2008, 03:34
I am trying to run Darrel Taylor's "Hello World" program. It compiles, but when trying to program, I get the following message:

"MicroCode Studio is unable to locate 'DT Hello World.hex'. Do you want to compile and assemble 'DT Hello World.pbp' now?" When I answer yes, it appears to compile, but the ME Labs U2 programmer window does not come up. What am I doing wrong? Code:

TRISA = %00100000
TRISB = %00000111
WDTCON = 0
ADCON0 = %00000000
ADCON1 = %01111111
LVDCON = %00000000
CCP1CON = %00000000
OSCCON = %01100010
RCON = %10000010
EECON1 = %00000100
INTCON2 = %00000000
INTCON3 = %01011011
PIE1 = %00000000
PIE2 = %00000000
IPR1 = %00000000
IPR2 = %00000000
RCON = %10000000
T1CON = %00000000
T2CON = %00000000
T3CON = %00000000
TXSTA = %00000000
RCSTA = %00000000
LVDCON = %00000000

@ __CONFIG _CONFIG1H, _IESO_OFF_1H & _FSCM_OFF_1H & _INTIO2_OSC_1H
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_27_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32K_2H
@ __CONFIG _CONFIG3H, _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_OFF_4L
@ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
@ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
@ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
@ __CONFIG _CONFIG7H, _EBTRB_OFF_7H


LED1 VAR PORTB.4

INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

@ INT_ENABLE INT_INT ; enable external (INT) interrupts

Main:
PAUSE 1
GOTO Main

'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN

Thank you for any help.

skimask
- 26th June 2008, 03:43
Try shortening the name itself, keep it under 8 characters, and possibly the path too, just to see what happens...
Other than that, looks like an MCS configuration problem.

jderson
- 26th June 2008, 04:47
I failed to mention: Other programs I have written for this part compile and program just fine, so it must have something to do with Instant Interrupts.

skimask
- 26th June 2008, 04:53
"MicroCode Studio is unable to locate 'DT Hello World.hex'. Do you want to compile and assemble 'DT Hello World.pbp' now?"
So it must know where Hello World is. It can't find the hex file...ok...it didn't compile fully the last time, and therefore didn't produce a .hex file.


When I answer yes, it appears to compile, but the ME Labs U2 programmer window does not come up.
The U2 programmer (or any other programmer) is an add-on to MCS and must be configured as such, either with the correct command line or at least with the correct options in MCS.

If the file compiled with errors in MCS, you would see other error messages at the bottom of the MCS screen, and most likely, if you think the error has something to do with the instant interrupts, the error would most likely have the words 'instant interrupts' in it.
But you didn't say anything about that, so I think I can safely assume you haven't connected MCS to the programmer correctly as of yet.
Or were there more errors?

jderson
- 26th June 2008, 05:53
I get the "Overwriting previous address contents" (Error 118), but as I said, other programs also give these error messages and still compile and program correctly.

Archangel
- 26th June 2008, 06:15
Hello jderson,
It compiles perfectly for me after commenting out the STD configs in the 18F1220.inc file and finds my programmer too, loads the hex too, My money is on Darrel's code is NOT at fault. EDIT: LVDCON = %00000000 is listed twice too

skimask
- 26th June 2008, 13:47
I get the "Overwriting previous address contents" (Error 118), but as I said, other programs also give these error messages and still compile and program correctly.

http://www.picbasic.co.uk/forum/showthread.php?t=543
applies to the overwriting problem

jderson
- 26th June 2008, 13:56
Thanks Joe! Indeed, the CONFIF1H line is the offender. I don't understand why, but I'll find out.

skimask
- 26th June 2008, 14:03
Thanks Joe! Indeed, the CONFIF1H line is the offender. I don't understand why, but I'll find out.
CONFIF1H? Huh? :)

I'm guessing here, 'cause I haven't/can't look at the 18f1220 inc file at the moment, but the link to the post above most likely will fix your problem.