First Day and need Help!


Results 1 to 18 of 18

Threaded View

  1. #3
    timmoore47's Avatar
    timmoore47 Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    If the 16F877 is on the drop list it must work.

    remove your config fuse to see. If there's any other problem, tell us your PBP version, Microcode Studio version and also post your code here.
    Err... I don't know where the drop list is. THe version of Micro Code Studio is v 2.2.1.1

    The Read.me file says this:-
    PICBASIC(TM) Compiler Ver. 1.45 README.TXT
    Copyright 2005 microEngineering Labs, Inc.

    I don't know if it's integrated correctly Into PIC BASIC Standard.

    The code is one of the Samples:-


    ' Simulate BS2 Shiftin and Shiftout

    Symbol DDIR = Dir0 ' Shift data pin direction is Dir0
    Symbol DPIN = Pin0 ' Shift data pin is 0
    Symbol CPIN = 1 ' Shift clock pin is 1

    Symbol I = B2 ' Loop counter


    ' Shift in some data
    Low CPIN ' Start shift clock low

    Gosub shiftin ' Shift in some data

    ' Shift out some data
    Low CPIN ' Start shift clock low

    B0 = 100 ' Data to shift out
    Gosub shiftout ' Go do it

    End


    ' Subroutine to synchronously shift in one byte
    shiftin: DDIR = 0 ' Set data pin direction to input

    For I = 1 to 8 ' 8 bits to a byte
    B0 = B0 * 2 ' Shift result 1 bit to the left
    Toggle CPIN ' Toggle shift clock
    Bit0 = DPIN ' Move data into LSB
    Toggle CPIN ' Toggle shift clock once more
    Next I ' Loop

    Return ' Go back to caller


    ' Subroutine to synchronously shift out one byte
    shiftout: DDIR = 1 ' Set data pin direction to output

    For I = 1 to 8 ' 8 bits to a byte
    DPIN = Bit0 ' Data out is LSB
    Toggle CPIN ' Toggle shift clock
    B0 = B0 / 2 ' Shift byte 1 bit to the right
    Toggle CPIN ' Toggle shift clock once more
    Next I ' Loop

    Return
    Last edited by timmoore47; - 18th May 2006 at 14:48.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts