Your __config line doesn't have enough options in it ...
Code:
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
#ENDCONFIG
When using #CONFIG/#ENDCONFIG, ALL defaults are overridden and you must supply ALL config options.
The way it was would have left LVP ON.
This program with a 16F628A in an melabs LAB-X3 board, works fine with the ICD.
Code:
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
#ENDCONFIG
DEFINE OSC 4
LED1 VAR PORTB.4
CMCON = 7
Main:
HIGH LED1
PAUSE 500
LOW LED1
PAUSE 500
GOTO Main
But the ICD will never work if RS232 comms are not working.
Here's a simple LoopBack program. Compile it with the normal "Compile Program" button.
Use Serial Communicator at 19200, and whatever you send should be returned.
Once you get that working (strictly a hardware issue), the ICD will work.
Code:
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
#ENDCONFIG
DEFINE OSC 4
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 12 ' 19200 Baud @ 4MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Char VAR BYTE
CMCON = 7
Main:
HSERIN [Char]
HSEROUT [Char]
GOTO Main
Bookmarks