Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The 6K Series Language allows you to store binary numbers(32-bit or less) in the binary variable(VARB) command. The binary variables start at the left with least significant bit, and increase to the right. The 32-bit binary value must be in the form of ones,zeros,or Xs. The information is assigned to the binary variable with the equal sign.

Example: VARB1 = b1001
This will set VARB1 to the binary value 1001. Please note that a b is required.
If the variable is querried (by typing VARB1 at the prompt in the terminal) the response will be:
*VARB1=1001_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx.

You can change one bit within any binary variable by using the following covention:

VARB1.6-1
This will set bit 6 of varb1 to 1. Any bit can be assigned the values of 1, 0, or X.

NOTE:Compumotor doccumentation states that an X used on the right side of an assignment statement will leave that particular bit unaffected. THIS IN NOT CORRECT.

Example: VARB1=b1101XX1
This will set binary variable 1 to 1101XX1. THIS ASSIGNS THE VALUE XX TO BITS 5&6 AND DOES NOT LEAVE BIT 5&6 IN THEIR PREVIOUS STATE.

Binary variables are also used in conjunction with bitwise operators and(&), inclusive or(|), exclusive or(^), and Not(~)

Example:
VARB1=b10010110
VARB2=b01101010

VARB3=VARB1&VARB2
VARB3 Response *varb3=0000_00010_XXXX_XXXX_XXXX_XXXX_XXXX_XXXX
VARB3=VARB1|VARB2
VARB3 Response *VARB3=1111_1110_XXXX_XXXX_XXXX_XXXX_XXXX_XXXX

The following is a truth table for the Boolean Operators.

a	b  a&b a|b  a^b     	
		

		
1	1	1	1	 0			

		
		
1	0	0	1	 1
	
		

		
0	1	0	1	 1

		

		
0	0	0	0	 0

		

		
x	x	x	x	 x

		

		
1	x	x	1	 x

		
		

x	1	x	1	 x

		

		
0	x	0	x	 x

			

		
x	0	0	x	 x
  • No labels