PDA

View Full Version : Is this legal?



BertMan
- 28th September 2005, 16:07
Can I use nested brackets like this:

ShiftIn FPU_DATAIN, FPU_SCLK, MSBPRE [FloatByte[0], FloatByte[1]_
FloatByte[2], FloatByte[3]]

Melanie
- 28th September 2005, 23:53
There's nothing that says you can't use array variables in the SHIFTIN/OUT command. As with everything, try it and see.

What you can do (a little secret you may not know about) is that you can use normal brackets () around your array variables rather than square ones to distinguish them from the square brackets in the SHIFTIN Command... like so...


ShiftIn FPU_DATAIN, FPU_SCLK, MSBPRE, [FloatByte(0), FloatByte(1), FloatByte(2), FloatByte(3)]

By the way, your example had a comma missing after MSBPRE and another after FloatByte[1] either of which whould have cause a compilation failure.

BertMan
- 29th September 2005, 00:19
Thanks Melaine. I couldnt find an example that used arrays with the shift commands. Btw, sweet tip on the (). That makes it a little easier to read.

The code was something I typed up real fast, and not the actual code. This explains the bad formatting :)