ShiftOutEx 8-bit sends

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

ShiftOutEx 8-bit sends

Post by GTBecker »

The System Library Reference suggests that the value in ShiftOutEx can be Int8/16. Int8 seems not to work, however. I can get the correct bits sent only with a shifted Int16, i.e.

Code: Select all

	Call ShiftOutEx(DataPin, ClkPin, 8, CUInt(255) * 256, &h04, 210)
Am I misinterpreting something?


Tom
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: ShiftOutEx 8-bit sends

Post by dkinzer »

GTBecker wrote:I can get the correct bits sent only with a shifted Int16
When shifting out data MSB first, the first bit to be output is always bit 15 irrespective of whether the supplied data value is 8-bit or 16-bit.

The documentation should be more clear, perhaps, that if you provide an 8-bit data value, it is merely promoted to a 16-bit value but not shifted in any way. To do this would require compile-time knowledge of the value of the "number of bits' parameter which is not always possible.
- Don Kinzer
Post Reply