Hi E,hi C.
Dim s2m(10) As Byte.
Can only hold '99' or 'FF' max.
E
Hi E,hi,
Basics,
A Byte is typically 8 Bits in Width.
So 0x11111111 is the maximum value it can be.
If I had a decimal number of say '123', it would have to be saved in the Array(0) as 0x7B
Is that what you mean.?
E
Hi E,hi,
This is the query you initially asked.
When (0) goes above 2x digits-99 the results get messed up.
Can someone tell me why please?
As I have said, you cannot store more than 2, 'BCD' digits in a Byte Array location.
You could consider.
Dim s2m(10) as Single 'as an option
E
Hi E,hi,
Look at this option.
Dim s2m(10) As Word
E
Hi E,Hi E,
There's a lot of stuff rattling round my mind regarding BYTES, SPI, WORDS etc
I'm sure your CODE example would work ok, but in my case, the 'problem' BYTES are set-up in the SLAVE PIC, then sent to the MASTER via SPI, which is the one with the HSEROUT.
Working on 2x programs at the same time is a stretch, but I'm getting used to it. It will take a while.
Thanks, C.
Hi E,hi C,
I can understand why you are having problems as you develop this software.
Checking through some of our earlier working programs, they no longer compile due to syntax errors.
The reason for this are due to the changes made in the Oshonsoft compiler version issues.
This, and the number of unsupported features in some of the later PIC types, has made me move away from using Oshonsoft.
E
Hi S,When over 99, is your sending unit sending 3 single digits, not 2?
That is, what is the format of the data of the sending unit? Is the length of data always 2 digits?
Array(0) can take any value from 0 to 255 binary (0xff Hex), so what format is the "99" in?
It may be that the sending unit is changing the digits, not that it is an error on the receiving end...
Hi S,You seem to be using QEIDEG.LB and a .HB, yet your printout says QEIDEG(0) and QEIDEG(1). That is confusing, QEIDEG is a word, not an array. You equate 2 bytes to the word then print out the word as such. Your printout should show QEIDEG with no array designation.
Depending on how the compiler has allocated variable space, you may be overwriting other storage space, causing corrupted values.
Hi S,QEIDEG, is it defined as an array as well? You are printing QEIDEG(0) and QEIDEG(1). If that is a WORD array, then you are printing out 4 bytes in total.
It may be just your text as written in the output (mistake?). But if moving bytes to a .LB and a .HB of a word, you just print the word, there is no subscript. That is, you print QEIDEG and it should be a value between 0 and 65535
Without seeing how you declared that variable, I'm only guessing....
hi C,Going back to the S2M ARRAYs. If I add a $ at the beginning and a W at the end of the send ARRAY, and in the receive, I wait for the $ and count till the W, will this be useful.