I recently wrote code for the 18F14K50 chip and it seemes that i cannot get the code to run at all. When i power up the board the LCD stays blank. I added the debug value write to eeprom just to see if the code was moving and when i read back the eeprom values on pickit 2 it shows that the value is not being written. I have posted the beginning of the code below. Any help at all would be much appreciated.
\\code\\
'************************** Configuration Registers ****************************
@__CONFIG _CONFIG1H, _FOSC_XT_1H & _IESO_ON_1H ; Set for an External Crystal
@__CONFIG _CONFIG2L, _PWRTEN_ON_2L & _BOREN_ON_2L ; Brown out detect set for OFF, Power On Timer set for OFF
@__CONFIG _CONFIG2H, _WDTEN_OFF_2H ; WDT set for OFF
@__CONFIG _CONFIG3H, _MCLRE_OFF_3H ; MCLR is disabled
'@__CONFIG _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L ' Code Protect Blocks 0-1 is enabled
'@__CONFIG _CONFIG6L, _WRT0_ON_6L & _WRT1_ON_6L ' Write Protect Blocks 0-1 is enabled
WDTCON = %00000000 ' Assures the WDT is disabled
'************************** Configuration Registers ****************************
'''''''''''''''''''''''''''''' Microchip Definitions '''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
include "modedefs.bas"
DEFINE OSC 4
DEFINE SER2_BITS 9
DEFINE ADC_BITS 10 ' set number of bits in result
DEFINE ADC_CLOCK 5 ' set clock source
DEFINE ADC_SAMPLEUS 50 ' set sampling time for microseconds
DEFINE LCD_DREG PORTC ' set LCD DATA port
DEFINE LCD_DBIT 0 ' set starting DATA bit (0 or 4) if 4-bit
DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
DEFINE LCD_RSBIT 7 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 6 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 1500 ' Set command delay time in us
DEFINE LCD_DATAUS 10 ' Set data delay time in us
'''''''''''''''''''''''''''''' Microchip Definitions '''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
''''''''''''''''''''''''''' Register Definitions '''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
TRISA = %00011011 ' Register A has 4 buttons(UP,SET,FNC,open)
TRISB = %10000000 ' Register B has 1 button(DN)
TRISC = %00010011 ' Register C is all outputs(LCD Control)
PORTA = %00000000 ' Initialize all registers to zero
PORTB = %00000000
PORTC = %00000000
INTCON = %00000000 ' No Interupts on programmer software
CCP1CON = %00001100
OSCCON = %01011100 ' Setup the PWM module for single output on RC5
''''''''''''''''''''''''''' Register Definitions '''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
''''''''''''''''''''''''''' Variable Declarations ''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
'INPUTS AND OUTPUTS
UP_BUTTON VAR PORTA.0 'PIN 19 (A0)
SET_BUTTON VAR PORTC.4 'PIN 6 (A2)
FUNCTION_BUTTON VAR PORTA.3 'PIN 4 (A3)
COMM_OUT VAR PORTB.4 'PIN 13
DOWN_BUTTON VAR PORTB.7 'PIN 10 (A1)
REMOTE_FNC_RESET VAR PORTB.5 'PIN 12
LCD_DRIVE var PORTC.5
'SETTINGS SET BY USER (PROGRAMMER)
DUTY VAR WORD ' LCD CONTRAST SETTING (EEPROM - 2 & 3)
TEST1_PROG_NUM VAR BYTE
TEST1_OPERATING_PRESSURE VAR BYTE
TEST1_PSI_DIFF VAR BYTE
TEST1_CYCLE_TIME VAR BYTE
TEST1_STABIL_TIME VAR BYTE
TEST1_MAX_FILL_TIME VAR BYTE
TEST1_MIN_PSI_PERCENT VAR BYTE
TEST2_PROG_NUM VAR BYTE
TEST2_OPERATING_PRESSURE VAR BYTE
TEST2_PSI_DIFF VAR BYTE
TEST2_CYCLE_TIME VAR BYTE
TEST2_STABIL_TIME VAR BYTE
TEST2_MAX_FILL_TIME VAR BYTE
TEST2_MIN_PSI_PERCENT VAR BYTE
'SOFTWARE VARIABLES
TEST1_CHECKSUM VAR WORD ' USED TO MAKE SURE DATA WAS SENT WITH NO ERROR
TEST2_CHECKSUM VAR WORD
A0 VAR BYTE ' Byte Variables for Button Inputs
A1 VAR BYTE
A2 VAR BYTE
A3 VAR BYTE
i VAR BYTE
DEBUG_VALUE var byte
''''''''''''''''''''''''''' Variable Declarations ''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
'''''''''''''''''''''''LCD Display Configuration''''''''''''''''''''''''''''''''
' 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
DATA 0, 0, 0, 0, 0, 0, 0, 0, 10, 1, 1, 1, 1, 10, 10, 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data @ 224, "S","P","V","_","S","L","A","M","D","U","N","K","2 ","_","R","0","0"
' T2CON = %00000101 ' Turn on Timer2, Prescale=4
'' Use formula to determine PR2 value for a 1KHz signal,
'' 4MHz clock, and prescale=4. (4E6/(4*4*1E3))-1=249
' PR2 = 249 ' Set PR2 to get 1KHz out
'' Use formula to determine CCPR1L:CCP1CON<5:4> value for
'' ends of range 20% to 80%. (249+1)*4*0.2=200 (20% value)
'' (249+1)*4*0.8=800 (80% value)
' READ 2, DUTY.HIGHBYTE
' READ 3, DUTY.LowBYTE
' Pause 10
' DUTY = DUTY
' CCP1CON.4 = duty.0 ' Store duty to registers as
' CCP1CON.5 = duty.1 ' a 10-bit word
' CCPR1L = DUTY >> 2
' duty = duty + 10 ' Increase duty cycle
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
'''''''''''''''''''''''LCD Display Configuration''''''''''''''''''''''''''''''''
'-------------------------Program Starts Here-----------------------------------
'-------------------------------------------------------------------------------
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
'''''''''''''''''''''''''Start Up Procedure'''''''''''''''''''''''''''''''''''''
INITIALIZE:
DEBUG_VALUE = 456
LCD_DRIVE = 1
A0 = %00000000
A1 = %00000000
A2 = %00000000
A3 = %00000000
TEST1_PROG_NUM = 1
TEST2_PROG_NUM = 2
write 30, DEBUG_VALUE
pause 500
RUN_START_SCREEN:
GOSUB CLEAR_LCD
LCDOUT " ", "Spartan SPV"
LCDOUT $FE, $C0, " ", "Slamdunk 2"
\\code\\
Please help!
Bookmarks