Here is my code (in Mikrobasic) for the transmitter:
program Mikromedia_Transmit
'===============================================================================
dim TFT_DataPort as byte at LATE
TFT_RST as sbit at LATC1_bit
TFT_BLED as sbit at LATD2_bit
TFT_RS as sbit at LATB15_bit
TFT_CS as sbit at LATF12_bit
TFT_RD as sbit at LATD5_bit
TFT_WR as sbit at LATD4_bit
TFT_DataPort_Direction as byte at TRISE
TFT_RST_Direction as sbit at TRISC1_bit
TFT_BLED_Direction as sbit at TRISD2_bit
TFT_RS_Direction as sbit at TRISB15_bit
TFT_CS_Direction as sbit at TRISF12_bit
TFT_RD_Direction as sbit at TRISD5_bit
TFT_WR_Direction as sbit at TRISD4_bit
'SPI
dim nRF_CS as sbit at LATA6_bit
nRF_CS_Direction as sbit at TRISA6_bit
nRF_CE as sbit at LATA5_bit
nRF_CE_Direction as sbit at TRISA5_bit
nrf_irq as sbit at late9_bit
nRF_IRQ_Direction as sbit at TRISE9_bit
nrf_SCK_Direction as sbit at TRISG6_bit
nrf_MOSI as sbit at LATG8_bit
nrf_MOSI_Direction as sbit at TRISG8_bit
nrf_MISO as sbit at LATG7_bit
nrf_MISO_Direction as sbit at TRISG7_bit
read_value , byte1 , status ,status1 , result ,
config , setup_retr , rf_ch , rf_setup ,
fifo_status, setup_aw , detected , en_aa as byte
dim txt as string[3]
'===============================================================================
sub procedure PMPWaitBusy()
while(PMMODE.BUSY = 1)wend
end sub
sub procedure Set_Index(dim index as byte)
TFT_RS = 0
PMDIN = index
PMPWaitBusy()
end sub
sub procedure Write_Command(dim cmd as byte)
TFT_RS = 1
PMDIN = cmd
PMPWaitBusy()
end sub
sub procedure Write_Data(dim _data as word)
TFT_RS = 1
PMDIN = _data
PMPWaitBusy()
end sub
'===============================================================================
sub procedure Init_TFT()
PMMODE = 0x0604 ’ 16 bit mode
PMCON = 0x8300
TFT_Set_Default_Mode()
TFT_Set_Active(@Set_Index, @Write_Command, @Write_Data)
TFT_Init(320, 240)
Delay_ms(1000)
end sub
'====================================================================
sub procedure Init_RF()
spi2_init()
’ Initialize I/O ports
nRF_CS_Direction = 0
nRF_CE_Direction = 0
nRF_IRQ_Direction = 1
nRF_SCK_Direction = 0
nrf_MOSI_Direction = 0
nrf_MISO_Direction = 1
’ Set inital state for mRF connections
nRF_CE = 0
nRF_CS = 1
end sub
'===============================================================================
sub procedure Welcome()
TFT_Fill_Screen(CL_black)
TFT_Set_Pen(CL_white, 1)
TFT_Set_Font(@HandelGothic_BT21x22_Regular, CL_yellow, FO_HORIZONTAL)
TFT_Write_Text(“Welcome”, 35, 75)
delay_ms(1000)
end sub
'===============================================================================
sub procedure mikromedia_Transmit_Payload(dim value as byte)
nRF_CS = 0
SPI2_write(0xA0) 'command byte for transmitting Payload
SPI2_Write(value) '1 byte payload
nRF_CS = 1
nRF_CE = 1
delay_us(15) 'Toggle CE (high for atleast 10us) to send packet
nRF_CE =0
end sub
'===============================================================================
sub procedure Transmit(dim value as byte) 'if 1byte payload
nRF_SPI_Write_Reg(0x00, 0x5a) 'CONFIG:mask rx_dr and max_rt, enableCRC, 1byte crc, Power up,Transmitter
nRF_SPI_Write_Reg(0x01, 0x00) 'En_aa: Disable auto-ack
'nRF_SPI_Write_Reg(0x02, 0x01) 'En_RxAddr: Enable P0
nRF_SPI_Write_Reg(0x03, 0x02) 'Setup_AW: 4 bytes address width
'nRF_SPI_Write_Reg(0x04, 0x03) 'Setup_Retr: 3(default)not required if auto ack disabled
nRF_SPI_Write_Reg(0x05,5 ) 'Rf_Ch: Leave at default
nRF_SPI_Write_Reg(0x06, 0x07) 'Rf_Setup: DataRate 1Mbps, TxmodePower= 0dBm
nRF_SPI_Write_Reg(0x10,0XE7E7E7E7) 'Tx_Addr for P0
nRF_SPI_Write_Reg(0x11,1) 'Payload length for P0 (0 to 32)
end sub
'==============================================================================
main:
Init_TFT()
Init_RF()
Welcome()
Transmit(0x01)
nop
end.