JMLStamp2p
01-25-2008, 05:13 AM
Good Evening,
The code listed below works with a remote transciever transmitting the values "$01" and "$04". When I install the line··" repeat while rxbyte := (1)·" my LED "18"·toggles. If I change the line to "·repeat while rxbyte := (0)·" The LED stops toggling and my transmitter starts outputting "$01" &
"$04" as shown in the code below.
My Question is this:
I want to compare the number recieved by FullDuplexSerials "rx" Method
with a certain value and then jump to a method contingent upon what number is recieved. Could someone Please Edit the code below to help me
accomplish this.
Thanks,
JMLStamp2p
John.
.................................................. ..........................................
My Program Below:
.................................................. ..........................................
CON
·_CLKMODE = XTAL1 + PLL1X····· 'External crystal 5MHZ times "1"
·_CLKFREQ = 5_000_000········· '5 Million cycles per second
VAR
·byte rxbyte
·byte byte_recieved
OBJ
·DELAY: "Clock"
·DATA: "FullDuplexSerial"
..................................
PUB Main····
·················
·dira[0]~~
·dira[1]~
·dira[16]~~
·dira[17]~~
·dira[18]~~
·dira[20]~~
·'data.Stop
·data.start(1,0,2,9600)
·Recieve
·'Transmit
.................................................. ........................................
PUB Recieve
· data.rx······················· 'FullDuplexSerial recieve byte
·
· repeat while rxbyte := (1)······ 'Repeat while rxbyte is True or "1"
···· waitcnt(5_000_000 + cnt)
····· !outa[18]
······· waitcnt(5_000_000 + cnt)
· data.rxflush····················· ' Flush the recieve buffer
· Transmit·······
.................................................. ........................................
·
PUB Transmit
·waitcnt(5_000_000 + cnt)
·data.tx($01)
·waitcnt(5_000_000 + cnt)
·data.tx($04)
·Main
·
The code listed below works with a remote transciever transmitting the values "$01" and "$04". When I install the line··" repeat while rxbyte := (1)·" my LED "18"·toggles. If I change the line to "·repeat while rxbyte := (0)·" The LED stops toggling and my transmitter starts outputting "$01" &
"$04" as shown in the code below.
My Question is this:
I want to compare the number recieved by FullDuplexSerials "rx" Method
with a certain value and then jump to a method contingent upon what number is recieved. Could someone Please Edit the code below to help me
accomplish this.
Thanks,
JMLStamp2p
John.
.................................................. ..........................................
My Program Below:
.................................................. ..........................................
CON
·_CLKMODE = XTAL1 + PLL1X····· 'External crystal 5MHZ times "1"
·_CLKFREQ = 5_000_000········· '5 Million cycles per second
VAR
·byte rxbyte
·byte byte_recieved
OBJ
·DELAY: "Clock"
·DATA: "FullDuplexSerial"
..................................
PUB Main····
·················
·dira[0]~~
·dira[1]~
·dira[16]~~
·dira[17]~~
·dira[18]~~
·dira[20]~~
·'data.Stop
·data.start(1,0,2,9600)
·Recieve
·'Transmit
.................................................. ........................................
PUB Recieve
· data.rx······················· 'FullDuplexSerial recieve byte
·
· repeat while rxbyte := (1)······ 'Repeat while rxbyte is True or "1"
···· waitcnt(5_000_000 + cnt)
····· !outa[18]
······· waitcnt(5_000_000 + cnt)
· data.rxflush····················· ' Flush the recieve buffer
· Transmit·······
.................................................. ........................................
·
PUB Transmit
·waitcnt(5_000_000 + cnt)
·data.tx($01)
·waitcnt(5_000_000 + cnt)
·data.tx($04)
·Main
·