Jäger ADwin-Gold-USB Manual page 38

Hide thumbs Also See for ADwin-Gold-USB:
Table of Contents

Advertisement

CAN add-on
Example:
Conversion of
Gray code
Programming
34
A conversion from Gray code into binary code is made with the routine below,
which you have programmed in the ADbasic process.
REM PAR_1 = Gray value to be converted
REM PAR_2 = Flag indicating a new Gray value
REM PAR_9 = Result of the Gray-to-binary conversion
DIM
m,
n
AS LONG
EVENT:
IF(PAR_2=1)
THEN
m=0
PAR_9=0
FOR
n=1
TO
32
m=(SHIFT_RIGHT(PAR_1,(32-n))
PAR_9=(SHIFT_LEFT(m,(32-n)))
NEXT
n
PAR_2=0
ENDIF
Fig. 27 – Listing: Conversion of Gray code into binary code
The functionality of the decoders is easily programmed with ADbasic instruc-
tions:
Range
Initialization
Receiving of data
The instructions are in the include file <ADWGCAN.INC>. More information can
be found in the ADbasic manual and the online help.
'Start of conversion
'initialize value
' -"-
'Go through all possible 32 bits
AND
1)
XOR
OR
PAR_9
'Enable next conversion
Instructions
SSI_MODE
SSI_SET_BITS
SSI_SET_CLOCK
SSI_READ
SSI_START
SSI_STATUS
ADwin-Gold USB / ENET, manual version 3.8, October 2005
ADwin
m

Advertisement

Table of Contents
loading

This manual is also suitable for:

Adwin-gold-enet

Table of Contents