Hi Alain,
By using that type of notation, you are actually changing the type of array that PBP uses.
So, even though you have a WORD array to begin with, when you use ....
WRITE 2, Voiesafe.Lowbyte[1]
You are now accessing the array as if it were made up of bytes.
The ORIGIN of the array becomes the Lowbyte of the word in location 0. Then the value in parenthesis indicates the number of bytes relative to that origin.
It's like when you use this type of statement.
PORTB.0[1] = 1
This turns PORTB into an array of BITs, starting at bit 0. The statement would set on PORTB.1 to 1
PORTB.5[1] = 1
This bit array starts at PORTB.5, so that statement would set PORTB.6 to 1
As for your program being OK with it. It's only because you are expecting to see the same valeues in each location. If you were trying to put different values in each location you would see the problem.
One way to fix the problem is to use a temporary variable that can then be used with the lowbyte/highbyte type notation.
Temp = Voiesafe[1]
WRITE 1, Temp.Highbyte
WRITE 2, Temp.Lowbyte
Using it in a for/next loop will make things even eaiser.
HTH,
Darrel
Bookmarks