SX28AC with the LAIPAC TRW-24G
r_noble
Posts: 5
i was wondering if anyone can tell me what wrong with my code, i.e if they have had experience working with these transceivers.
'RX MODULE
==============DEVICE=SETTINGS==============================
·DEVICE·SX28, TURBO, OSCHS
·ID·RFv1a
·IRC_CAL·IRC_SLOW
·FREQ·20_000_000·'20MHz
'
'·Interface pin assignments
'
PORTA
DATA_··var·ra.2
CLK1··var·ra.3
'
PORTB
DR1··var·rb.0
CS··var·rb.1
CE··var·rb.2
'
PORTC
DAConv··var·rc
'
'·Variables
RcvDta··var·byte··························· 'byte to store recieved data
idx··var·byte································· 'table index
rfcon··var·byte·······························'byte used for configuration
txsend··var·byte···························· 'stores address bytes of destination module
TXdata··var·byte
'
'·Subroutine
Rx_Setup·sub·0
Rx_Mode··sub·0
'
program start
start:
·tris_a ·= %1100···························· ·'pin 3 input all others are outputs
·tris_b ·= %01110001
·tris_c ·= $00································· 'Port C pins all output
·rc ·= $0
·low·CE
·low·CS
·pause·3
'
Main:
·goto·Rx_Setup
·goto ·main
'===============RECEIVE=MODE=CONFIGURATION=================================
Rx_Setup:
·tris_b·= %01110001
·low·CE
·high·CS
·pauseus·5··································· ·'Tcs2data = 5 microsecond delay
·pauseus·0.5················ ··············· ·'Ts = 500 nanosecond delay
·idx = 0
·do
Lookup·idx,$8e,$08,$1c,$08,$08,$ff,$ff,$ff,$ff,$ff,$19,$28,$37,$46,$55,$a3,$53,$21,rfcon
·low·CLK1···································· ·'starts the the clock from the
·················································· 'idle position of 0
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11··'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 17
·low·CS
·low·DATA_
·goto·Rx_Mode
'===============RECEIVE=MODE=SUBROUTINE=================================
Rx_Mode:
·if DR1 = 0 then Rx_Mode·'tests for available data
·low·CLK1
·high ·CE
·shiftin·DATA_,CLK1,MSBPOST,RcvDta
·low ·CE
·DAConv·= RcvDta
·goto·Rx_Mode
'TX MODULE
'===============DEVICE=SETTINGS==============================
·DEVICE·SX28, TURBO, OSCHS
·ID·RFv1a
·IRC_CAL·IRC_SLOW
·FREQ·20_000_000·'20MHz
'
'·Interface pin assignments
'
PORTA
DATA_··var·ra.2
CLK1··var·ra.3
'
PORTB
DR1··var·rb.0
CS··var·rb.1
CE··var·rb.2
'
PORTC
DAConv··var·rc
'
'·Variables
idx··var·byte··············· ·'table index
rfcon··var·byte············· 'byte used for configuration
txsend··var·byte··········· 'stores address bytes of destination module
adcVal········· var·byte··· 'byte to be sent
TXdata··var·byte
'
'·Subroutine
Tx_Setup·sub·0
Tx_Mode··sub·0
'
program start
start:
·tris_a ·= %1100···················· 'pin 3 input all others are outputs
·tris_b ·= %01110001
·tris_c ·= $00························ 'Port C pins all output
·rc ·= $0
·low·CE
·low·CS
·pause·3
Main:
·goto·Tx_Setup
·goto ·main
'===============TRANSMIT=MODE=CONFIGURATION===============================
Tx_Setup:
·low·rc
·tris_b·= %01110001
·low·CE
·high·CS
·pauseus·5····························· ·'Tcs2data = 5 microsecond delay
·pauseus·0.5··························· 'Ts = 500 nanosecond delay
·idx = 0
·do········································ 'this sends out the 18 configuration bytes to
············································ 'RF transceiver
Lookup·idx,$8e,$08,$1c,$08,$08,$ff,$ff,$ff,$ff,$ff,$0a,$19,$28,$37,$46,$a3,$53,$20,rfcon
·low·CLK1
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11·'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 17
·low·CS
·goto·Tx_Mode
'===============TRANSMIT=MODE=SUBROUTINE================================
·adcVal = %10101010
Tx_Mode:
·do
·high·CE
·pauseus·5
·pauseus 0.5
·idx = 0
·do
·Lookup ·idx,$19,$28,$37,$46,$55,adcval,txsend
·low·CLK1
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11·'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 5
·low ·CE
·pauseus·5
·goto·Tx_Mode
Post Edited (r_noble) : 9/28/2006 1:36:32 PM GMT
'RX MODULE
==============DEVICE=SETTINGS==============================
·DEVICE·SX28, TURBO, OSCHS
·ID·RFv1a
·IRC_CAL·IRC_SLOW
·FREQ·20_000_000·'20MHz
'
'·Interface pin assignments
'
PORTA
DATA_··var·ra.2
CLK1··var·ra.3
'
PORTB
DR1··var·rb.0
CS··var·rb.1
CE··var·rb.2
'
PORTC
DAConv··var·rc
'
'·Variables
RcvDta··var·byte··························· 'byte to store recieved data
idx··var·byte································· 'table index
rfcon··var·byte·······························'byte used for configuration
txsend··var·byte···························· 'stores address bytes of destination module
TXdata··var·byte
'
'·Subroutine
Rx_Setup·sub·0
Rx_Mode··sub·0
'
program start
start:
·tris_a ·= %1100···························· ·'pin 3 input all others are outputs
·tris_b ·= %01110001
·tris_c ·= $00································· 'Port C pins all output
·rc ·= $0
·low·CE
·low·CS
·pause·3
'
Main:
·goto·Rx_Setup
·goto ·main
'===============RECEIVE=MODE=CONFIGURATION=================================
Rx_Setup:
·tris_b·= %01110001
·low·CE
·high·CS
·pauseus·5··································· ·'Tcs2data = 5 microsecond delay
·pauseus·0.5················ ··············· ·'Ts = 500 nanosecond delay
·idx = 0
·do
Lookup·idx,$8e,$08,$1c,$08,$08,$ff,$ff,$ff,$ff,$ff,$19,$28,$37,$46,$55,$a3,$53,$21,rfcon
·low·CLK1···································· ·'starts the the clock from the
·················································· 'idle position of 0
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11··'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 17
·low·CS
·low·DATA_
·goto·Rx_Mode
'===============RECEIVE=MODE=SUBROUTINE=================================
Rx_Mode:
·if DR1 = 0 then Rx_Mode·'tests for available data
·low·CLK1
·high ·CE
·shiftin·DATA_,CLK1,MSBPOST,RcvDta
·low ·CE
·DAConv·= RcvDta
·goto·Rx_Mode
'TX MODULE
'===============DEVICE=SETTINGS==============================
·DEVICE·SX28, TURBO, OSCHS
·ID·RFv1a
·IRC_CAL·IRC_SLOW
·FREQ·20_000_000·'20MHz
'
'·Interface pin assignments
'
PORTA
DATA_··var·ra.2
CLK1··var·ra.3
'
PORTB
DR1··var·rb.0
CS··var·rb.1
CE··var·rb.2
'
PORTC
DAConv··var·rc
'
'·Variables
idx··var·byte··············· ·'table index
rfcon··var·byte············· 'byte used for configuration
txsend··var·byte··········· 'stores address bytes of destination module
adcVal········· var·byte··· 'byte to be sent
TXdata··var·byte
'
'·Subroutine
Tx_Setup·sub·0
Tx_Mode··sub·0
'
program start
start:
·tris_a ·= %1100···················· 'pin 3 input all others are outputs
·tris_b ·= %01110001
·tris_c ·= $00························ 'Port C pins all output
·rc ·= $0
·low·CE
·low·CS
·pause·3
Main:
·goto·Tx_Setup
·goto ·main
'===============TRANSMIT=MODE=CONFIGURATION===============================
Tx_Setup:
·low·rc
·tris_b·= %01110001
·low·CE
·high·CS
·pauseus·5····························· ·'Tcs2data = 5 microsecond delay
·pauseus·0.5··························· 'Ts = 500 nanosecond delay
·idx = 0
·do········································ 'this sends out the 18 configuration bytes to
············································ 'RF transceiver
Lookup·idx,$8e,$08,$1c,$08,$08,$ff,$ff,$ff,$ff,$ff,$0a,$19,$28,$37,$46,$a3,$53,$20,rfcon
·low·CLK1
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11·'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 17
·low·CS
·goto·Tx_Mode
'===============TRANSMIT=MODE=SUBROUTINE================================
·adcVal = %10101010
Tx_Mode:
·do
·high·CE
·pauseus·5
·pauseus 0.5
·idx = 0
·do
·Lookup ·idx,$19,$28,$37,$46,$55,adcval,txsend
·low·CLK1
·shiftout DATA_,CLK1,MSBFIRST,rfcon\8,11·'Baudrate ~ 1Mbps
·inc·idx
·loop until idx = 5
·low ·CE
·pauseus·5
·goto·Tx_Mode
Post Edited (r_noble) : 9/28/2006 1:36:32 PM GMT
Comments
What is wrong with the code ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
VCC = 3.36 V
The code is supposed to send 10101010 to the other and output it to LEDs at port c.
It will lated be added to adc and dac modules for audio transmission
Post Edited (r_noble) : 9/28/2006 3:32:47 PM GMT