'---------------------------------------------------------------------
'                     SHIFT.BAS
'       example for SHIFTIN and SHIFTOUT statement
'---------------------------------------------------------------------

Dim L As Long

Clock Alias Portb.0
Output Alias Portb.1
Sin Alias Pinb.2                                              'watch the PIN instead of PORT

'shiftout pinout,pinclock, var,parameter [,bits , delay]
' value for parameter :
'  0 - MSB first ,clock low
'  1 - MSB first,clock high
'  2 - LSB first,clock low
'  3 - LSB first,clock high
'The bits is a new option to indicate the number of bits to shift out
'For a byte you should specify 1-8 , for an integer 1-16 and for a long 1-32
'The delay is an optional delay is uS and when used, the bits parameter must
'be specified too!

'Now shift out 9 most significant bits of the LONG variable L
Shiftout Output , Clock , L , 0 , 9



'shiftin pinin,pinclock,var,parameter [,bits ,delay]
'  0 - MSB first ,clock low  (4)
'  1 - MSB first,clock high  (5)
'  2 - LSB first,clock low   (6)
'  3 - LSB first,clock high  (7)

'To use an external clock, add 4 to the parameter
'The shiftin also has a new optional parameter to specify the number of bits

'The bits is a new option to indicate the number of bits to shift out
'For a byte you should specify 1-8 , for an integer 1-16 and for a long 1-32
'The delay is an optional delay is uS and when used, the bits parameter must
'be specified too!


'Shift in 9 bits into a long
Shiftin Sin , Clock , L , 0 , 9
'use shift to shift the bits to the right place in the long
Shift L , Right , 23

End