Steve,
Ok I've downloaded the latest version of MPLAB so now I'm running ver 5.06 of MPASM and that cured the previous error (FC_MEN_OFF) so the following code compiled fine
The resulting LST file is attached (steve.txt as .lst won't upload) - However when programming it with winpic it errors - here's the logCode:ASM __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L __CONFIG _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_OFF_2L __CONFIG _CONFIG2H, _WDT_OFF_2H __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L ENDASM ADCON1=$0F TRISB=%00000000 'set PORTB as all output PORTB=0 ByteA var byte main: for bytea=0 to 7 PORTB=DCD BYTEA PAUSE 250 NEXT PORTB=255 PAUSE 250 goto main
On checking the config setting winpic reports 30C0 and FECE as the device config word (#1 and #2 respectively) - see attached image (config.jpg).Code:Device has been erased. Programming... Erasing ("bulk" or "chip") ... Programming CODE, 0x000000..0x0000B4 Verifying CODE, 0x000000..0x0000B4 Verifying 0x000000..0x0000B4 Programming CONFIG, 0x300000..0x300006 Verifying CONFIG, 0x300000..0x300006 Verifying 0x300000..0x300006 Verify Error: 300000: read 000000, wanted 0030C0, mask 00FFFF ==> diff=0030C0 Verify Error: 300002: read 001E0E, wanted 00FECE, mask 00FFFF ==> diff=00E0C0 Verify Error: 300004: read 008000, wanted 00F8FF, mask 00FFFF ==> diff=0078FF Verify Error: 300006: read 0000A1, wanted 00FFBB, mask 00FFFF ==> diff=00FF1A ERROR: Programming FAILED !
When programming MCLR is taken to around +13v by the programmer. Both Vss are connected and grounded.
Lastly here is the resulting HEX file that is compiled
Comparing the last but one line that was hilighted in your previous post there isn't any differenceCode::020000040000FA :1000000043EF00F00850070B1A0FF66EF76A000E68 :10001000F722F86A0800F5501200010204081020C7 :100020004080036A026EFF0E0226D8A00326D8A0E5 :1000300040EF00F0030E016EDF0E02D8F4D7016A24 :10004000E80F006E011EFC0ED8A003D00026D8B029 :10005000FDD700260400013EF9D700B000D000A271 :1000600002D0000000D01200086E02EC00F0006A1E :10007000016A08A6006E08B6016E005040EF00F05D :100080000001040012000F0EC16E936A816A1C6A9F :100090000400080E1C5CD8B056EF00F01C50E4DFE2 :1000A000816EFA0EBEDF1C2AD8A4F2D7FF0E816E35 :0600B000FA0EB7DFECD7E9 :020000040030CA :08000000C030CEFEFFF8BBFF8B :00000001FF
I therefore tried loading the HEX file via the PICpgm program and that loaded the code to the pic without errors. I then shutdown PICpgm and launched Winpic and read the code back. The log reported the following:Code:Your code :08000000C030CEFEFFF8BBFF8B My code :08000000C030CEFEFFF8BBFF8B
The device config words were reported as CF3F and 1F3F. However the resulting dump of the PIC isn't anything like the original file (see dumped.txt attached).Code:Info: Loading definitions for "PIC18F2550" from devices.ini . Info: Support for some newer PIC18F devices added by Martin v.d. Werff 2005 Couldn't find "C:\Program Files\Microchip\MPLAB IDE\PIC18F2550.dev", please borrow/copy from MPLAB ! PIC18F: family='21'=4550, WriteLatch=32 bytes, EraseLatch=64 bytes . Initialising PIC-Programmer: Success. Testing: delay(500ms) took 0.50 seconds, timer_freq=3.5795 MHz ... ok Reading 0x3FFFFE - 0x3FFFFF ... Reading 0x300000 - 0x30000D ... Reading 0xF00000 - 0xF000FF ... Reading 0x000000 - 0x007FFF ... Reading PIC ok.
Unless you can see anything glaringly obvious then the only other area must be hardware and until I get a different programmer I can't prove that one way or another. The only thing I can see in the logs is
Could this be the problem, as the dev files are in C:\Program Files\Microchip\MPLAB IDE\Device folder ??Couldn't find "C:\Program Files\Microchip\MPLAB IDE\PIC18F2550.dev", please borrow/copy from MPLAB !
As always mate, I appreciate your continued help and advice on this one !
EDIT:
Oh and this is the programmer I'm using![]()




Bookmarks