Hi Richard,
Thank you and appreciate for your input.
The function of this program is to allow the reprogramming of the Receiver's ID.
The program is structured to provide a five second period of time upon power up of the Receiver to allow the attachment of a PIC based programmer (My design) to reprogram the ID of the respective receiver before the programs "MainLoop" begins.
I added your modifications and still couldn't get it to work. BTW, why the GPIO=0? Does that clear all GPIO ports, I presume?
Below is the modified code.
************************************************** *****************
********************** Receiver Code *********************************
************************************************** *****************
#CONFIG
__config _WDTE_ON & _MCLRE_OFF & _INTOSCIO & _PWRTE_ON
#ENDCONFIG
OSCCON = %01100000 ' Set system internal clock 4MHz
DEFINE OSC 4 ' Calibrate PBP timing to 4MHz system clock
OPTION_REG =% 00000000 ' Enable Weak Pullups Control
WPU =% 00100000 ' Disable all Weak Pullups except on GPio.5
ANSEL = %000000 ' No analog inputs
TRISIO = %111001 ' Make GP1, GP2 outputs. GP0, GP3, GP4 & GP5 = inputs
CMCON0 =%000111 ' Turn off comparators
ADCON0 = 0 ' Turn off A/D
AlarmByte var Byte ' Received Alarm
AlarmVal var byte ' Alarm Zone(s)
RxIn var GPIO.0 ' Incoming Packet Port
Z1Alarm var GPIO.2 ' Zone1 Alarm LED
Z2Alarm var GPIO.1 ' Zone2 Alarm LED
ByteSum var Byte ' IDByte & AlarmByte Sum Value
ChkSum var byte ' ChkSum value to test
ProgID var byte ' Programmer Present Verify
PrgIn var GPIO.5 ' Programmer Detect & Data Port
IDByte var byte ' Receiver ID.
IDByteRx var byte ' New IDByte
ProgIDRx var byte ' Received Programmer ID
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Pause 500 ' Pause for Register initialization
ProgIDRx = $D ' Define qualifier
GPIO=0
Z2Alarm = 1 'Confirm in programing mode
Serin PrgIn,1,5000,MainLoop,[ProgIDRx],IDByteRx ' Check for new I.D.
if ProgIDRx = $A then ' Match Programmer ID
IDByte = IDByteRx
Write 1, IDByte
Z1Alarm = 1 : Z2Alarm = 1 ' Confirm programing Subroutine
pause 500
Z1Alarm = 0 : Z2Alarm = 0
pause 1000
Z1Alarm = 1 : Z2Alarm = 1 'Confirm in programing mode
pause 1000
Z1Alarm = 0 : Z2Alarm = 0
endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; START ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MainLoop:
I suspect that I may have a protocol issue in that my packet isn't in proper form for SERIN? Below is a JPG of my oscilloscope screen showing the packet received from the Programmer (Transmitter).
Thank you for your help!




Bookmarks