communicate with a Parallax 433 MHz RF Transmitter to a propeller board using a
chris jones
Posts: 391
Hello
i am tryinbg to setup a communication link with my propeller board and my basic stamp board to let me know when the board comes online.i seem to be geting blank data i have it looking for the sync bit in my basic stamp board
CODE
· SERIN Rx,Baud,[noparse][[/noparse]WAIT ("S!"), strLen, STR string\strLen,···
in my propeller code its sending out a sync bit
CODE
PUB Send_Sync(Num)
··· repeat Num
····· Term.str(string("!"))
··· Term.str(string("S"))
can anyone point me in the right direction as of why i cant send the data to the BS2 board
i am tryinbg to setup a communication link with my propeller board and my basic stamp board to let me know when the board comes online.i seem to be geting blank data i have it looking for the sync bit in my basic stamp board
CODE
· SERIN Rx,Baud,[noparse][[/noparse]WAIT ("S!"), strLen, STR string\strLen,···
in my propeller code its sending out a sync bit
CODE
PUB Send_Sync(Num)
··· repeat Num
····· Term.str(string("!"))
··· Term.str(string("S"))
can anyone point me in the right direction as of why i cant send the data to the BS2 board
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
' =========================================================================
'
' File...... 433RadioRX.bs2.bs2
' Purpose... Demo code for the Parallax 433 MHz Receiver (#27981)
' Author.... Parallax Inc.
' E-mail.... support@parallax.com
' Started...
' Updated... 01-17-2008
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
' This code requires one Transmitter (#27980) and one Receiver (#27981).
' Each module should be connected to a separate BASIC Stamp Module.
'
' This BS2-IC source code is the receiver side of the Parallax RF
' Transceiver Packet Transmission example.
'
' This code receives the message transmitted by "433RadioTX" and displays
' it on the debug window.
' This code must be run on a BASIC Stamp 2 with an RF Receiver (27981).
' This code interfaces with a second BASIC Stamp 2 running 433RadioTX.BS2.
'
' This code requires one Transmitter (#27980) and one Receiver (#27981).
' Each module should be connected to a separate BASIC Stamp 2 Module.
'
' This program is the transmitter side of the Parallax RF Transceiver
' Packet Transmission example. This code transmits the message in the DATA
' statements to the receiver.
'
' This code demonstrates the transmission and reception of variable-length
' data (from 1 to 16 bytes) in the form of data packets. This data packet
' method is used to help overcome the error-prone nature of RF reception in
' various environments. The data packets consist of a preamble, a count of
' the number of data bytes, the actual data bytes and finally a checksum
' value. The format is as follows:
'
' Preamble = "U!". Any number of "U" characters may be sent before the
' single "!". The "U" character is chosen because it's bit pattern is
' "10101010" (alternating 1's and zero's). This gets the receiver "in sync"
' with the data bits that follow.
'
' Packet data format:
' |
||
| |
||
||
|
' |Data Count||Data Value 1|...|Data Value n||Checksum Low||Checksum High|
' |
||
| |
||
||
|
' BYTE 1 BYTE 2 BYTE n+1 BYTE n+2 BYTE n+3
'
' Byte 1 consists of the Data Count. The Data Count is a value from 1 to 16
' representing the number of Data Values in this packet. Packets can
' contain from 1 to 16 bytes of data values (at least 1 Data Value is
' required).
' Byte 2 through Byte n+1 are the actual Data Values where
' n = Data Count+1.
' Byte n+2 and Byte n+3 are the last bytes in the packet and consist of a
' 16-bit Cyclic Redundancy Check (CRC) Checksum value calculated using the
' bytes 1 through n+1 together The use of this CRC checksum increases
' error detection to approx. 99%.
'
' The protocol for sending and receiving is as follows (shown is a
' simplified form):
' 1) The sending device constructs the entire packet, as shown above and
' calculates a checksum.
' 2) The sending device transmits the preamble and the packet.
' 3) The receiving device receives the packet, calculates a checksum and
' compares the calcuated checksum with the checksum received inside the
' packet.
' 4) If checksums match: receiver displays the recveived data, otherwise
' it displays a "receive error"
'
' Wiring:
' P15
Parallax 433 Receiver DATA (27981)
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
Rx PIN 15 ' Receiver(27981)DATA pin
'
[noparse][[/noparse] Constants ]
EOM CON 255 ' Value to signal end-of-message
#SELECT $STAMP ' Select Baud constants
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
#ENDSELECT
Inverted CON $4000 'Value for inverted serial format
Baud CON 38400+Inverted '9600 baud, 8,N,1 inverted
'
[noparse][[/noparse] Variables ]
string VAR Byte(16) 'Array to hold received data
strLen VAR Byte 'Length of string received
temp VAR Byte 'Temporary variable
cValue VAR Byte 'Holder for CRC calculation
crc VAR Word 'Calculate CRC value
rcvdCrc VAR Word 'Received CRC value
'
[noparse][[/noparse] EEPROM Data ]
'
[noparse][[/noparse] Initialization ]
'
[noparse][[/noparse] Program Code ]
Main:
DO
' Wait for preamble, then receive data and crc value
SERIN Rx,Baud,[noparse][[/noparse]WAIT ("!S"), strLen, STR string\strLen,
rcvdCRC.LOWBYTE,rcvdCrc.HIGHBYTE]
' Calculate crc of received data
crc = 0
FOR temp = 0 TO strLen-1
cValue = string(temp)
GOSUB CalcCRC
NEXT
' See if received crc value matches calculated crc value
IF rcvdCrc = crc THEN
' Is last character the "end-of-message" marker ?
IF string(strLen-1) <> EOM THEN
DEBUG STR string\strLen ' Display string on debug screen
ELSE
strLen = strLen -1 ' Don't display EOM
DEBUG STR string\strLen, "--END OF MESSAGE--",CR,CR
ENDIF
ELSE
' Received crc did NOT match calculated crc
DEBUG " ** RECEIVE ERROR ** ", BELL
ENDIF
LOOP
'
[noparse][[/noparse] Subroutines ]
' CRC Checksum Calculation Routine
CalcCRC:
CValue= crc.HIGHBYTE ^ cValue >> 4 ^ (crc.HIGHBYTE ^ cValue)
crc = cValue ^ (cValue << 5) ^ (cValue << 12) ^ (crc << 8)
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
' =========================================================================
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
' P15
Parallax 433 Receiver DATA (27981)
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
Rx PIN 15 ' Receiver(27981)DATA pin
'
[noparse][[/noparse] Constants ]
EOM CON 255 ' Value to signal end-of-message
#SELECT $STAMP ' Select Baud constants
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
#ENDSELECT
Inverted CON $4000 'Value for inverted serial format
Baud CON T9600+Inverted '9600 baud, 8,N,1 inverted
'
[noparse][[/noparse] Variables ]
string VAR Byte(16) 'Array to hold received data
strLen VAR Byte 'Length of string received
'
[noparse][[/noparse] EEPROM Data ]
'
[noparse][[/noparse] Initialization ]
'
[noparse][[/noparse] Program Code ]
Main:
DO
' Wait for preamble,
SERIN Rx,Baud,[noparse][[/noparse]WAIT ("!S"), strLen, STR string\strLen]
' Is last character the "end-of-message" marker ?
IF string(strLen-1) <> EOM THEN
DEBUG STR string\strLen ' Display string on debug screen
ELSE
strLen = strLen -1 ' Don't display EOM
DEBUG STR string\strLen, "--END OF MESSAGE--",CR,CR
ENDIF
' Received crc did NOT match calculated crc
DEBUG " ** RECEIVE ERROR ** ", BELL
LOOP
please give me coding to connect parallax 27980 and 27981 from micro to micro (I2c communication)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen