Hi, welcome to the forum!
There are several thing "going on" here. First of all it would be nice to know what version of PBP you're using - I'm going to assume (since you're using the now reserved word Loop as a label) that it's not the latest PBP3 but some earlier version.
OK, as far as I can see the C-code you posted is setup to use the internal oscillator of the 46K20 device (I suspect this is how the debug express board is layed out) but the default setting when compiling for the 46K20 with PBP is to use an external x-tal and I suspect this is the main reason for it not to work.
The way to rectify this problem depends on the version of PBP you're using and the following holds true for version prior to PBP3.
In your PBP inatallation folder, look for and open the file named 18F45K20.INC (make sure you open the correct file), in it you'll find the following:
Code:
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F45K20, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F45K20.INC" ; MPASM Header
__CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32
See that first __CONFIG _CONFIG1H, _FOSC_HS_1H..... that I highlighted? That is what is telling the PIC to run with an external x-tal, which I don't think you have on that board. Try changing from _FOSC_HS_1H to _FOSC_INTIO67_1H - make sure you backup the file before making changes to it! The line should look like:
Code:
__CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
Next, there's no need to make aliases to register names in the context you've done (with the SYMBOL "command"), all the register names and their respective adresses are already defined for you in header-files for all the PICs that the compiler supports and they get included automatically when you compile for a particular device (the one you select in the dropdown list within Micro Code Studio in this case).
Also, Peek and Poke is not needed or even recomended with PBP, you can write directly to the registers referring to them by their name, like:
Code:
TRISD.0 = 0 ' Make PortD.0 an output
Main:
PortD.0 = 1
Pause 500
PortD.0 = 0
Pause 500
Goto Main
/Henrik.
Bookmarks