microEngineering Labs, Inc.
    719-520-5323
 
Home:
  Developer Resources:

Programming Clues
    Sample Programs
   
    PICBASIC PRO™
Compiler Manual
    PICBASIC™ Compiler
Manual
    Serin2/Serout2 Modes
    ASCII Character Set
    Number Conversion
    Floating Point
Routines
    PBP Debug Monitor
    Articles and Tutorials

Hardware Clues
    Parts / Vendor List
    PICPROTO™ Boards
    LAB-X1 Docs
    LAB-X2 Docs
    LAB-X20 Docs
    LAB-X3 Docs
    LAB-X4 Docs
    LAB-XUSB Docs
    LAB-XT Docs
     
 

microEngineering Labs, Inc. | 1-719-520-5323 | Example Program - SHIFT.pbp

PICBASIC PRO Code to demonstrate the use of SHIFTIN / SHIFTOUT commands.
' Name        : SHIFT.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : 12F, 16F, 18F
' Hardware    : Non specific
' Oscillator  : 4MHz internal or external
' Keywords    : SHIFTIN, SHIFTOUT
' Description : PICBASIC PRO Code to demonstrate the use of
' SHIFTIN / SHIFTOUT commands.
'

Include "modedefs.bas"  ' Include shift modes

D1PIN Var PORTA.0       ' Shift data pin 1
C1PIN Var PORTA.1       ' Shift clock pin 1
D2PIN Var PORTB.0       ' Shift data pin 2
C2PIN Var PORTB.1       ' Shift clock pin 2

bvar  Var byte
wvar  Var word

mainloop:
   ' Shift in 10 bits of data
   Shiftin D1PIN, C1PIN, MSBPRE, [wvar\10]
   bvar = wvar

   ' Shift out 8 bits of data onto other pins
   Shiftout D2PIN, C2PIN, MSBFIRST,[bvar]

   Pause 500
   Goto mainloop

   End

           

Download the program file.