Hi Darrel,

I tried programming a new chip with ee_vars.pbp and I got the same results as before but I got the firecracker code working good using the saving routines below:

EEPROMData91 var BYTE
X VAR EEPROMData91
READ 91, EEPROMData91

'' To write to the eprom
'' ================
'EEPROMData91 = X
'Write 91, EEPROMData91
'-----------------------

EEPROMData92 var BYTE
Y VAR EEPROMData92
READ 92, EEPROMData92

'' To write to the eprom
'' ================
'EEPROMData92 = Y
'Write 92, EEPROMData92
'-----------------------

EEPROMData93 var BYTE
Z VAR EEPROMData93
READ 93, EEPROMData93

'' To write to the eprom
'' =================
'EEPROMData93 = Z
'Write 93, EEPROMData93
''-----------------------

I tried changing the starting address in EE_Vars.pbp from CON 0 to CON 91 and although it compiles it doesn't work but when I comment out your eeprom saving routine and use the program below, the X10 code turns On and Off the X10 appliance modules and saving to the eeprom works like a charm.

As I mentioned in my previous post, when I comment out the con 0 in EE_Vars.pbp and include it in my program as con 91 I get " ERROR Line 24: Redefinition of CON EE_start.(EE_Vars.PBP) " when I try to compile.

It was only a guess on my part that the firecracker code was using some of the same address's as EE_Vars.PBP was using. I still don't quite understand mathematically how the address's of the various eeprom and other registry locations work using the Decimal, Hex and Binary number Systems. I should have stayed in school instead of being a juvenile delinquent then this would be a lot easier but I guess it's better late than never to get a little savy and this is interesting! Any ideas on what's happening with this?

Thanks
jessey

Code:
'* Name    : Test Program for the Firecracker Interface 
'* Author  : Jessey Montgomery
'* Includes: Al Williams Firecracker Interface 
'* Date    : April 24/th 2009
'* Version : Using PicBasic Pro Ver 2.50, MPASM Ver 5.20, Using MicroCode
'*         : Studio 3.0.0.5, PICkit 2 programmer - Application Version
'*         : 2.50.02 - Device File Version 1.5100 - OS Firmware Version
'*         : 2.30.01. Using a Pic16F688-I/P 04470AY.


'(1) Comments & Objectives
'   =====================
' this program is just a test program for checking the firecracker

 '              Clear Each Port Before Setting The TRIS Registers  
                                
 Clear   ' Set all ram registers to zero
 PORTA = 0
 PORTC = 0                           

 '                            VSS VDD Pins  
 
 'VDD +       '(pin 1)
 'VSS -       '(pin 14)
                       
 '                    SET THE TRIS 

 '                     PORTA PINS

 TRISA.0 = 0 '(pin 13) Not Used VAR PORTA.0   
 TRISA.1 = 0 '(pin 12) ..........................................Led VAR PORTA.1    
 TRISA.2 = 1 '(pin 11) ..................................Push_Button VAR PORTA.2
 TRISA.3 = 0 '(pin 4)  Not Used VAR PORTA.3       
 TRISA.4 = 0 '(pin 3)  .....connect to red wire of firecracker - dtr VAR PORTA.4         
 TRISA.5 = 0 '(pin 2)  ...connect to green wire of firecracker - rts VAR PORTA.5      
                                                   
 '                     PORTC PINS 
 
 TRISC.0 = 0 '(pin 10) Not Used VAR PORTC.0   
 TRISC.1 = 0 '(pin 9)  Not Used VAR PORTC.1 
 TRISC.2 = 0 '(pin 8)  Not Used VAR PORTC.2             
 TRISC.3 = 0 '(pin 7)  Not Used VAR PORTC.3  
 TRISC.4 = 0 '(pin 6)  Not Used VAR PORTC.4    
 TRISC.5 = 0 '(pin 5)  Not Used VAR PORTC.5


'(2) PIC Config Fuse Definitions for 16f688 
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF & _BOD_ON 
@ ERRORLEVEL -306; 

 '(3) PIC Hardware Definitions (ie Pin-Out & Port Assignments)
 ANSEL = 0          ' all pins are digital 
 CMCON0 = 7         ' turn off comparators
 OSCCON.3 = 1       ' Use internal clock 
 OSCCON = %1110111  ' Use Internal OSC at 8MHz

 Push_Button VAR PORTA.2 ' pin 11 
 Led var PORTA.1         ' pin 12 

' Firecracker Interface (Al Williams)
 rts VAR PORTA.5 ' pin 2 connects to DB9 pin 4 of the firecracker (green wire)
 dtr VAR PORTA.4 ' pin 3 connects to DB9 pin 7 of the firecracker (red wire)

 a VAR BYTE
 a = 0  
 Timer VAR byte
 Timer = 0 

' byte to send 
 byt var byte  
 tmp var byte
 i var BYTE 'was a nib
 state var bit(4)
 house var byte '0=A 1=B...
 unit var BYTE  ' 0-15  (must be 0 for bright/dim) 'was a nib
 cmd var BYTE  ' 0=off 1=on 2=bright 3=dim 'was a nib

 Is_Pressed CON 0
 Is_Not_Pressed CON 1
 Is_Turned_On CON 1
 Is_Turned_Off CON 0

 h1 con $D5
 h2 con $AA
 foot con $AD

'4a. EEPROM Assignments
'    ================== 
' Data for house and unit codes
housetbl data $60,$70,$40,$50,$80,$90,$A0,$B0,$E0,$F0,$C0,$D0
      data $00,$10,$20,$30
unittbl data 0,$10,$8,$18,$40,$50,$48,$58 

EEPROMData91 var BYTE
X VAR EEPROMData91
READ 91, EEPROMData91 
'' To write to the eprom 
'' =====================
'EEPROMData91 = X 
'Write 91, EEPROMData91         
'------------------------ 
EEPROMData92 var BYTE
Y VAR EEPROMData92 
READ 92, EEPROMData92 
'' To write to the eprom 
'' =====================
'EEPROMData92 = Y 
'Write 92, EEPROMData92         
'------------------------ 
EEPROMData93 var BYTE
Z VAR EEPROMData93
READ 93, EEPROMData93 
'' To write to the eprom 
'' ===================== 
'EEPROMData93 = Z 
'Write 93, EEPROMData93        
''------------------------- 

 gosub resetfirecracker 

' Reset the three X10 modules to the states they were before the power-loss 

 IF X = 1 THEN   
    house = 0 : unit = 4 : cmd = 1 'when unit = 4 in code, set X10 receiver to 5
    gosub sendcmd : PAUSE 1000    
 ELSE 
    house = 0 : unit = 4 : cmd = 0  
    gosub sendcmd : PAUSE 1000   
 ENDIF

 IF Y = 1 THEN 
    house = 0 : unit = 2 : cmd = 1 'when unit = 2 in code, set X10 receiver to 3 
    gosub sendcmd : PAUSE 1000   
 ELSE   
    house = 0 : unit = 2 : cmd = 0 
    gosub sendcmd : PAUSE 1000   
 ENDIF

 IF Z = 1 THEN
    house = 0 : unit = 3 : cmd = 1 'when unit = 3 in code, set X10 receiver to 4 
    gosub sendcmd : PAUSE 1000   
 ELSE  
    house = 0 : unit = 3 : cmd = 0  
    gosub sendcmd : PAUSE 1000   
 ENDIF 
 Led = Is_Turned_On
 PAUSE 200
 Led = Is_Turned_Off

IF a = 0 THEN MainLoop ' a always equals zero, use instead of GOTO... 

' Start Of Subroutines Area Below 
' ===============================

' Firecracker Interface by (Al Williams)
' http://www.awce.com/firecracker.htm 
sendcmd:
  byt=h1
  gosub sendbyte
  byt=h2
  gosub sendbyte
  read housetbl+house,byt
  if unit<9 then lowunit
  byt=byt+4
lowunit:
  gosub sendbyte
  byt=$20
  if cmd=0 then addunit
  byt=0
  if cmd=1 then addunit
  byt=$88              
                     
  if cmd=2 then nounit 
  byt=$98              
  if cmd=3 then nounit 
' huh???

addunit:
  read unittbl+(unit//8),tmp
  byt=byt+tmp
nounit:
  gosub sendbyte
  byt=foot
  gosub sendbyte
return

' Send 1 raw byte
sendbyte:
  debug hex byt," "
  for i=0 to 7
   if (byt & $80) = $80 then xmit1
   gosub send0
nextbit:
   pause 1
   byt=byt*2
   next
   return

' Send a 1
xmit1:
  gosub send1
  IF a = 0 THEN nextbit

' Send bits (0 or 1)
send0:
  low rts
  pause 1
  high rts
  return

send1:
  low dtr
  pause 1
  high dtr
  return

' Always reset firecracker first   
resetfirecracker:
low rts
low dtr
pause 50  ' reset
high rts
high dtr
pause 50
return
'============'

Turn_On_Or_Off_4:
    if X = 0 then ' X toggles the #4 X10 module On/or/Off with each button press 
       X = 1      ' Turn On
       house = 0 : unit = 4 : cmd = 1 'when unit=4 in code,set X10 receiver to 5
       gosub sendcmd  
    ELSE
       X = 0      ' Turn Off 
       house = 0 : unit = 4 : cmd = 0   
       gosub sendcmd 
    ENDIF
    EEPROMData91 = X 
    Write 91, EEPROMData91         
'@  EE_write_var  _X    
RETURN

Turn_On_Or_Off_3:
    if Y = 0 then ' Y toggles the #3 X10 module On/or/Off with each button press 
       Y = 1      ' Turn On
       house = 0 : unit = 2 : cmd = 1 'when unit=2 in code,set X10 receiver to 3 
       gosub sendcmd 
    ELSE
       Y = 0      ' Turn Off
       house = 0 : unit = 2 : cmd = 0  
       gosub sendcmd 
    ENDIF 
    EEPROMData92 = Y 
    Write 92, EEPROMData92          
'@  EE_write_var  _Y 
RETURN

Turn_On_Or_Off_5:
    if Z = 0 then ' Z toggles the #4 X10 module On/or/Off with each button press 
       Z = 1      ' Turn On
       house = 0 : unit = 3 : cmd = 1 'when unit=3 in code,set X10 receiver to 4 
       gosub sendcmd
    ELSE
       Z = 0      ' Turn Off
       house = 0 : unit = 3 : cmd = 0  
       gosub sendcmd
    ENDIF
    EEPROMData93 = Z
    Write 93, EEPROMData93
'@  EE_write_var  _Z  
RETURN 

'XXXXXXXXXXX'

MainLoop:

 IF Push_Button = Is_Pressed THEN 
   Timer = 0
   WHILE Push_Button = Is_Pressed
     Timer = Timer + 1 
     IF Timer = 1 THEN Led = Is_Turned_On
     IF Timer = 2 THEN Led = Is_Turned_Off
     IF Timer = 3 THEN Led = Is_Turned_On
     IF Timer = 4 THEN Led = Is_Turned_Off
     IF Timer = 5 THEN Led = Is_Turned_On
     IF Timer = 6 THEN Led = Is_Turned_Off
     PAUSE 500
   WEND
     Led = Is_Turned_Off                
     PAUSE 100 ' Debounce   
     IF Timer = 1 THEN GOSUB Turn_On_Or_Off_3
     IF Timer = 2 THEN GOSUB Turn_On_Or_Off_3
     IF Timer = 3 THEN GOSUB Turn_On_Or_Off_4
     IF Timer = 4 THEN GOSUB Turn_On_Or_Off_4 
     IF Timer = 5 THEN GOSUB Turn_On_Or_Off_5
     IF Timer >= 6 THEN GOSUB Turn_On_Or_Off_5
 ENDIF 
         
IF a = 0 THEN MainLoop 

End