Quote Originally Posted by HenrikOlsson View Post
Hi,
I have NO idea what's going on with this Illegal Character error. The only thing I can think of is, as I've said before, some kind of hidden character that makes the compiler hick up. I copy/pasted all of the sections in the previous post into MCS, resulting in the following:
Code:
Blue_On_Time_H var byte
Blue_on_Time_M var byte
Blue_Off_Time_H var byte
Blue_off_Time_M var byte

White_On_Time_H var byte
White_on_Time_M var byte
White_Off_Time_H var byte
White_off_Time_M var byte

data    14      'Blue ON time hours
Data    00      'Blue ON time minutes
data    15      'Blue OFF time hours
Data    00      'Blue OFF time minutes
Data    14      'Whites ON time hours
data    01      'Whites ON time minutes
data    14      'Whites OFF time hours
Data    20      'Whites OFF time minutes
    
write 10,white_on_time_h              'Whites ON time hours
write 11,white_on_time_m              'Whites ON time minutes
write 12,white_off_time_h             'Whites OFF time hours
write 13,white_off_time_m             'Whites OFF time minutes
write 14,blue_on_time_h             'Whites ON time hours
write 15,blue_on_time_m             'Whites ON time minutes
write 16,blue_off_time_h            'Whites OFF time hours
write 17,blue_off_time_m            'Whites OFF time minutes

Read 10,white_on_time_h              'Whites ON time hours
Read 11,white_on_time_m              'Whites ON time minutes
read 12,white_off_time_h             'Whites OFF time hours
read 13,white_off_time_m             'Whites OFF time minutes
read 14,blue_on_time_h             'blue ON time hours
read 15,blue_on_time_m             'blue ON time minutes
read 16,blue_off_time_h            'blue OFF time hours
read 17,blue_off_time_m            'blue OFF time minutes

END
Needles to say it compiles just fine for the 12F683, 16F877, 18F8620 and any other device I try with onboard EEPROM. I've tried this with both PBP3.0.7.4 and with PBP2.60. My MPBLAB installation is v8.88 containing MPASM v5.47.

/Henrik.
Just created a new blank page in MCS and copied and pasted the above from post #17, added the config settings etc and tried compiling

Code:
'*******************************************************************************
'  18F4520 config settings - for use with MPSAM
'*******************************************************************************

ASM 
  __CONFIG    _CONFIG1H, _OSC_HS_1H
  __CONFIG    _CONFIG2L, _PWRT_ON_2L  
  __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
  __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H  
  __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM

'*******************************************************************************
' Defines and LCD (20 x 4) set up
'*******************************************************************************

DEFINE  OSC 20  ; 48 was old config settings 18F4520, 20mhz crystal
ADCON1 = $0F
clear

DEFINE  WRITE_USED  1

DEFINE LCD_DREG  PORTB           ' LCD Data port
DEFINE LCD_DBIT  0               ' starting Data bit (0 or 4)
DEFINE LCD_EREG  PORTB           ' LCD Enable port
DEFINE LCD_EBIT  5               '     Enable bit  (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB           ' LCD Register Select port
DEFINE LCD_RSBIT 4               '     Register Select bit   (on EasyPIC 5 LCD)
DEFINE LCD_BITS  4               ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4               ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000        ' Command delay time in us 
DEFINE LCD_DATAUS 50             ' Data delay time in us 

'*******************************************************************************
'DS18B20 setting
'*******************************************************************************

DQ              VAR     PORTA.5         ' One-wire data pin
temperature     VAR     WORD            ' Temperature storage
count_remain    VAR     BYTE            ' Count remaining
count_per_c     VAR     BYTE            ' Count per degree C

'*******************************************************************************
'analog and Comparator settings
'*******************************************************************************

ADCON0 = 0                      'Set ADCON0
ADCON1 = %00001111              'Set D i/o
CMCON = 7                       'Disable Comparators

'*******************************************************************************
'Port and Register settings
'*******************************************************************************

CCP1CON = %00001100             ' 
CCP2CON = %00001100             '     
TRISA  = %11101111              '
TRISB  = %00000011 
TRISD  = %00000011              '
T0CON  = %11000111

Blue_On_Time_H var byte
Blue_on_Time_M var byte
Blue_Off_Time_H var byte
Blue_off_Time_M var byte

White_On_Time_H var byte
White_on_Time_M var byte
White_Off_Time_H var byte
White_off_Time_M var byte

data    14      'Blue ON time hours
Data    00      'Blue ON time minutes
data    15      'Blue OFF time hours
Data    00      'Blue OFF time minutes
Data    14      'Whites ON time hours
data    01      'Whites ON time minutes
data    14      'Whites OFF time hours
Data    20      'Whites OFF time minutes
    
write 10,white_on_time_h              'Whites ON time hours
write 11,white_on_time_m              'Whites ON time minutes
write 12,white_off_time_h             'Whites OFF time hours
write 13,white_off_time_m             'Whites OFF time minutes
write 14,blue_on_time_h             'Whites ON time hours
write 15,blue_on_time_m             'Whites ON time minutes
write 16,blue_off_time_h            'Whites OFF time hours
write 17,blue_off_time_m            'Whites OFF time minutes

Read 10,white_on_time_h              'Whites ON time hours
Read 11,white_on_time_m              'Whites ON time minutes
read 12,white_off_time_h             'Whites OFF time hours
read 13,white_off_time_m             'Whites OFF time minutes
read 14,blue_on_time_h             'blue ON time hours
read 15,blue_on_time_m             'blue ON time minutes
read 16,blue_off_time_h            'blue OFF time hours
read 17,blue_off_time_m            'blue OFF time minutes
Guess what - I got the error

If I comment out the write statements it compiles....