199 of 318
ZBasic System Library 189 ZX Microcontroller Family ParityCheck Type Function returning Boolean Invocation ParityCheck(data, oddParity) Parameter Method Type Description data ByVal Byte The data value for which to check the parity. oddParity ByVal Boolean The desired parity: True -> odd parity, False -> even parity Discussion This function computes the parity over the eight bits of the provided data value and compares that result to the desired result indicated by the oddParity parameter. The return value is a pass/fail indicator where True means that the parity matched the desired parity. The data value has even parity if the number of one bits in the value is even. Example Dim b as Byte If Not ParityCheck(b, False) Then Debug.Print "Even parity check failed" End If Compatibility This routine is not available in BasicX compatibility mode.