works perfectly for me if you don't try to use qualifier before you actually set it to a meaningful value as rocket troy indicated
Code:
#CONFIG; set CONFIG1 for internal oscillator, watchdog on, MCLR pin as OFF
__config _WDTE_ON & _MCLRE_OFF & _INTOSCIO & _PWRTE_ON
#ENDCONFIG
OSCCON = % 01100000 ' Set system clock 4MHz
DEFINE OSC 4 ' PBP timing to 4MHz system clock
OPTION_REG.7 = 0 ' Enable Weak Pullups Control
WPU = % 00100000 ' Disable all Weak Pullups except GPIO.5
ANSEL = 0 ' No analog inputs
TRISIO = % 00111001 ' Make GP1, GP2 outputs. GP0, GP3, GP4 & GP5 = inputs
CMCON0 = % 00000111 ' Turn off comparators
IDByte var byte ' Receiver ID.
IDByteRx var byte ' New IDByte
Z1Alarm var GPIO.2 ' Zone1 Alarm LED
Z2Alarm var GPIO.1 ' Zone2 Alarm LED
ProgIDRx var byte ' Received Programmer ID
PrgIn var GPIO.5 ' Programmer Detect & Data Port
ProgIDRx = $d ' define qualifier
gpio=0
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
MainLoop:
Serin PrgIn,1,[ProgIDRx],IDByteRx ' Wait for new I.D. to arrive
GOSUB UpdateID ' Verify arrival and execute UpdateID Subroutine
GOTO MainLoop
UpdateID:
Z1Alarm = 1 : Z2Alarm = 1 ' LEDs to Confirm programing Subroutine
PAUSE 500
Z1Alarm = 0 : Z2Alarm = 0 ' Turn off LEDs
PAUSE 1000
Z1Alarm = 1 : Z2Alarm = 1 ' LEDs to Confirm in programing mode
PAUSE 1000
Z1Alarm = 0 : Z2Alarm = 0 ' Turn off LEDs
IDByte = IDByteRx
'Write 1, IDByte ' Write new ID to EEPROM
RETURN
ENd
Bookmarks