EncodedData var word [4] should be EncodedData var word [5]
2 bytes are needed for each byte conversion to manchester.
What's happening is you're corrupting RAM by going out-of-bounds
in your EncodedData array.
EncodedData var word [4] should be EncodedData var word [5]
2 bytes are needed for each byte conversion to manchester.
What's happening is you're corrupting RAM by going out-of-bounds
in your EncodedData array.
Thank you for the reply Bruce...
You mean you can't use a zero for an array pointer?Code:EncodedData var word [4] should be EncodedData var word [5]
Right... and I thought the conversion routine did just that. Am I missing anything besides the improper definition of the EncodedData array?Code:2 bytes are needed for each byte conversion to manchester.
With EncodedData var word [4] you have 4 words total in the array.
EncodedData[0]
EncodedData[1]
EncodedData[2]
EncodedData[3]
Now with;
mydata [0]= "T"
mydata [1]= "E"
mydata [2]= "S"
mydata [3]= "T"
mydata [4]= "."
If each byte in mydata gets encoded as 2 bytes, you're going to need more
than 4 words or 8 bytes to store your encoded data in.
So, when mydatactr is 4, and you jump to your encode routine;
encodeddata.lowbyte[mydatactr]=manchesterword.lowbyte
encodeddata.highbyte[mydatactr]=manchesterword.highbyte
It's placing the encoded value outside your EncodedData word array. I.E. you
now have two bytes of data in RAM out-of-bounds of your array.
You can, but you need to make sure you don't exceed the array boundary.You mean you can't use a zero for an array pointer?
A 4 word array only goes from 0 to 3. Not 0 to 4.
Last edited by Bruce; - 15th March 2009 at 17:13.
I see... I had incorrectly assumed it goes from 0 to 4. Duly noted.Code:You can, but you need to make sure you don't exceed the array boundary. A 4 word array only goes from 0 to 3. Not 0 to 4.
I will give it a try and report back...
thank you for the pointers...
Alex
Bruce...
that did it! The transmitter now spits out good data.
In addition to the increase in the array size, I also had to make the following change from:
Code:EncodedData var word [5]
To:
For some reason the splitting the manchester word into EcodedData.LowByte and EncodedData.Highbyte didn't quite work, and so I ended up creating sepatate bytes for the high and low ends of the manchester word.Code:EncodedDataLow var Byte [5] EncodedDataHigh var byte [5]
Not sure why it didn't work in the first place but it doesn't matter now. I might revisit this issue at a later date.
Thank you for steering me in the right direction. This would have never crossed my mind - must be a habit from my old QBasic programming days.
Alex
Bookmarks