Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20638

BASCOM-AVR : data problem : NEWTOPIC

$
0
0
Hello All, This code will run in your simulater. Please try it and help me understand why it does not work like I think it should. The sub RFM24_Configure should step through all the data statments sending config data to my RFM24W. The first read data is the length of the data set to be sent to the rfm24. Then data set is sent. Then the next read after that is the length of the next set... It is suppose to read through ALL the data until the length is zero. The problem is it stops before reaching the end of the data. You will have to run it to see what I'm trying to explain. I've commented out the hardware parts for the sim but the problem still shows up. [code:1:368d9e0533]$regfile = "m168def.dat" $crystal = 8000000 $baud = 38400 $hwstack = 100 $swstack = 100 $framesize = 100 CONFIG SUBMODE = NEW sub RFM24_Configure() local b_dat as byte local b_Length as byte local b_n as byte local b_temp as byte restore CONFIGURATION_COMMANDS read b_Length while b_Length > 0 'reset rfm24_Nsel print print "L1 ";b_Length for b_n = 1 to b_Length read b_dat 'spiout b_dat,1 print "D ";hex(b_dat) next 'set rfm24_Nsel 'b_temp=Api_WaitforCTS() read b_Length print "L2 ";b_Length wend print "end config ";b_Length end sub rfm24_configure do loop end CONFIGURATION_COMMANDS: ' Command: RF_POWER_UP ' Description: Command to power-up the device and select the operational mode and functionality. RF_POWER_UP: data 7 data &h02, &h01, &h00, &h01, &hC9, &hC3, &h80 ' Command: RF_GPIO_PIN_CFG ' Description: Configures the GPIO pins. RF_GPIO_PIN_CFG: data 8 data &h13, &h61, &h00, &h60, &h00, &h40, &h00, &h20 ' Set properties: RF_GLOBAL_XO_TUNE_1 ' Number of properties: 1 ' Group ID: &h00 ' Start ID: &h00 ' Default values: &h40, ' Descriptions: ' GLOBAL_XO_TUNE - Configure the internal capacitor frequency tuning bank for the crystal oscillator. RF_GLOBAL_XO_TUNE_1: data 5 data &h11, &h00, &h01, &h00, &h52 ' Set properties: RF_INT_CTL_ENABLE_2 ' Number of properties: 2 ' Group ID: &h01 ' Start ID: &h00 ' Default values: &h04, &h00, ' Descriptions: ' INT_CTL_ENABLE - This property provides for global enabling of the three interrupt groups (Chip, Modem and Packet Handler) ' in order to generate HW interrupts at the NIRQ pin. ' INT_CTL_PH_ENABLE - Enable individual interrupt sources within the Packet Handler Interrupt Group to generate a HW interrupt ' on the NIRQ output pin. RF_INT_CTL_ENABLE_2: data 6 data &h11, &h01, &h02, &h00, &h01, &h30 ' Set properties: RF_FRR_CTL_A_MODE_4 ' Number of properties: 4 ' Group ID: &h02 ' Start ID: &h00 ' Default values: &h01, &h02, &h09, &h00, ' Descriptions: ' FRR_CTL_A_MODE - Fast Response Register A Configuration. ' FRR_CTL_B_MODE - Fast Response Register B Configuration. ' FRR_CTL_C_MODE - Fast Response Register C Configuration. ' FRR_CTL_D_MODE - Fast Response Register D Configuration. RF_FRR_CTL_A_MODE_4: data 8 data &h11, &h02, &h04, &h00, &h00, &h00, &h00, &h00 ' Set properties: RF_PREAMBLE_TX_LENGTH_9 ' Number of properties: 9 ' Group ID: &h10 ' Start ID: &h00 ' Default values: &h08, &h14, &h00, &h0F, &h21, &h00, &h00, &h00, &h00, ' Descriptions: ' PREAMBLE_TX_LENGTH - Configure length of TX Preamble. ' PREAMBLE_CONFIG_STD_1 - Configuration of reception of a packet with a Standard Preamble pattern. ' PREAMBLE_CONFIG_NSTD - Configuration of transmission/reception of a packet with a Non-Standard Preamble pattern. ' PREAMBLE_CONFIG_STD_2 - Configuration of timeout periods during reception of a packet with Standard Preamble pattern. ' PREAMBLE_CONFIG - General configuration bits for the Preamble field. ' PREAMBLE_PATTERN_31_24 - Configuration of the bit values describing a Non-Standard Preamble pattern. ' PREAMBLE_PATTERN_23_16 - Configuration of the bit values describing a Non-Standard Preamble pattern. ' PREAMBLE_PATTERN_15_8 - Configuration of the bit values describing a Non-Standard Preamble pattern. ' PREAMBLE_PATTERN_7_0 - Configuration of the bit values describing a Non-Standard Preamble pattern. RF_PREAMBLE_TX_LENGTH_9: data 13 data &h11, &h10, &h09, &h00, &h08, &h14, &h00, &h0F, &h31, &h00, &h00, &h00, &h00 stop_config: data 0 'length of zero stops the configuation. [/code:1:368d9e0533] [b:368d9e0533][color=red:368d9e0533](BASCOM-AVR version : 2.0.7.7 )[/b:368d9e0533][/color:368d9e0533]

Viewing all articles
Browse latest Browse all 20638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>