Needs to be integer, Bruce.
There was no error, only a spurious value returned in a single used as the status variable.
One more for the WRITE docs, eh?
Lloyd
Writing to Flash in SuperPRO, PROplus
-
AMDlloydsp
- Posts: 99
- Joined: Mon Apr 15, 2013 3:51 pm
- Location: NE Central FL
Re: Writing to Flash in SuperPRO, PROplus
You really shouldn't be using singles for status bits, those are logically integers, as normally you would be doing AND and OR binary type functions on them and those operations are not defined for singles.
I doubt any language does that. Even if it did type conversions, you would lose precision, as the 32 bits would get truncated to 23 bits and an exponent added, so you could lose the lower 8 bits, if any of the upper bits were set.
I doubt any language does that. Even if it did type conversions, you would lose precision, as the 32 bits would get truncated to 23 bits and an exponent added, so you could lose the lower 8 bits, if any of the upper bits were set.
-
AMDlloydsp
- Posts: 99
- Joined: Mon Apr 15, 2013 3:51 pm
- Location: NE Central FL
Re: Writing to Flash in SuperPRO, PROplus
Heh... Yeah. I wasn't, intentionally <G> The variable was incorrectly dim'd in a series of functionally-grouped variables which ALL should have been integers.
Still, if type conversion isn't being done, then the docs should show the status word as being of type integer.
Lloyd
Still, if type conversion isn't being done, then the docs should show the status word as being of type integer.
Lloyd
Re: Writing to Flash in SuperPRO, PROplus
This version of the compiler would flag what you did as an illegal conversion to single.
It catches the inadvertent case you site. We tend to overlook flagging possible errors, as we spend more time thinking about making proper code work.
If for some reason you wanted to convert to a single, you can always
some_integer = WRITE(&H7000, buffer, 512)
some_single = some_integer
It catches the inadvertent case you site. We tend to overlook flagging possible errors, as we spend more time thinking about making proper code work.
If for some reason you wanted to convert to a single, you can always
some_integer = WRITE(&H7000, buffer, 512)
some_single = some_integer
-
AMDlloydsp
- Posts: 99
- Joined: Mon Apr 15, 2013 3:51 pm
- Location: NE Central FL
Re: Writing to Flash in SuperPRO, PROplus
Again, thanks, Bruce.
That'll help me defend against attacks of "stupid". <G>
Oddly, I have little difficulty writing code that will work if written as designed. My problem is those niggling errors like dim'ing a whole series of variables wrong!
Lloyd
That'll help me defend against attacks of "stupid". <G>
Oddly, I have little difficulty writing code that will work if written as designed. My problem is those niggling errors like dim'ing a whole series of variables wrong!
Lloyd