And sure enough when I am displaying the array, I am getting "a1000000", so this confirms that its not the nRF24L01+ chip, its how I am using the array which is causing the problem.
Does anyone know why my array is not working? I previously posted my code snippets above.
You are declaring a long array in a local instance so that you have a total space for 16 bytes. Instead, declare payload as a byte var, payload[32]. Not sure if this the problem but you need to be thinking in terms of bytes, not longs for data.
You are declaring a long array in a local instance so that you have a total space for 16 bytes. Instead, declare payload as a byte var, payload[32]. Not sure if this the problem but you need to be thinking in terms of bytes, not longs for data.
I created a byte _readPayload[32] under the VAR section in the library that the function PUB ReadPayload now uses, and it returns the _readPayload at the end.
I also created a byte _readPayload[32] under the VAR section of the main program that does "_readPayload := nrf.ReadPayload" then I iterate through that now instead.
When you tell the Nordic there are 32 bytes coming, I think it may wait for only so long then it sends zeros. I don't remember, Duane may remember. You are using a method I am not using to send data. I think you need to point to the payload, then send all in one string, not as separate sends like you are doing, so the nordic may not be waiting as there is a delay in Spin between sends. See if your method allows a way to send a string that is 32 bytes long. I suspect this is your issue.
FIGURED IT OUT! Haha took me forever...
I had to pass a pointer into the ReadPayload function as a parameter. This pointer pointed to the address location of my array in the main program. I then assign the nRF24L01+ data to the pointer. Now when I iterate through the array in the main program all of the data is there. Like I thought before, it didn't have anything to do with the nRF24L01+ module, it was SPIN programming error.
I had to research it a bit, and apparently you cannot return anything other than a long from a function. This was a problem because I was trying to return an entire array.
So the original nRF24L01+ library that is in the parallax OBEX would have never worked, I don't even know why its there in the first place.
Comments
And sure enough when I am displaying the array, I am getting "a1000000", so this confirms that its not the nRF24L01+ chip, its how I am using the array which is causing the problem.
Does anyone know why my array is not working? I previously posted my code snippets above.
You are declaring a long array in a local instance so that you have a total space for 16 bytes. Instead, declare payload as a byte var, payload[32]. Not sure if this the problem but you need to be thinking in terms of bytes, not longs for data.
I created a byte _readPayload[32] under the VAR section in the library that the function PUB ReadPayload now uses, and it returns the _readPayload at the end.
I also created a byte _readPayload[32] under the VAR section of the main program that does "_readPayload := nrf.ReadPayload" then I iterate through that now instead.
I get the exact same result.
I had to pass a pointer into the ReadPayload function as a parameter. This pointer pointed to the address location of my array in the main program. I then assign the nRF24L01+ data to the pointer. Now when I iterate through the array in the main program all of the data is there. Like I thought before, it didn't have anything to do with the nRF24L01+ module, it was SPIN programming error.
I had to research it a bit, and apparently you cannot return anything other than a long from a function. This was a problem because I was trying to return an entire array.
So the original nRF24L01+ library that is in the parallax OBEX would have never worked, I don't even know why its there in the first place.
Thanks again T Chap for helping me out.