Shiftout question.


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216

    Default Shiftout question.

    Hi all, once again a question for the brains trust.
    I am using shiftout to drive some shift registers. Everything seems to work OK so far, BUT there is a question:
    The manual says SHIFTOUT, Datapin,Clockpin,Mode,[data stuff] and then says the Datapin & Clockpin can be straight numbers, Port pin names, or variables.
    So far so good.
    I am using
    DAT var portd.3 which is common data pin for all shift regs
    sect VAR byte, (up the top with the other variable defs.)
    SHIFTOUT DAT,sect,5,[S1]
    S1 is the data byte,

    sect is a variable simply containing a number 0 - 7 which is the portb pin for the clock of the 8 shift registers.

    NOWHERE do I define that the number in sect variable is in fact portb.sect or anything like that, SO HOW DOES THE BLOODY THING KNOW THAT'S WHAT I MEAN????? 'COS IT WORKS????

    Intriguing, ain't it??

    Thanks, as always
    Last edited by muddy0409; - 2nd April 2007 at 13:02. Reason: Just tidying up a bit
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Sounds like a holdover from BS2, sorta like where you can use just the plain number (0-7, 8-15) to use as an alias for a pin on PortB or PortC (or PortD, not sure). Automatically defined, handled in the background, etc.etc. Heck, if it works...who cares

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Peter,

    Those are "PIN Numbers".
    Their location is specified by PORTL and PORTH.

    See posts #4, 12 and 14 here ...
    http://www.picbasic.co.uk/forum/showthread.php?t=6013
    <br>
    DT

  4. #4
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Post PicBasic Pro Compiler manual

    Check this out
    Quote Originally Posted by PicBasic Pro Compiler manual
    For compatibility with the BASIC Stamp, pins used in PicBasic Pro Compiler commands may also be referred to by a number, 0 - 15. This number references different physical pins on the PICmicro MCU hardware ports dependent on how many pins the microcontroller has.

    If a port does not have 8 pins, such as PORTA, only the pin numbers that exist may be used, i.e. 8 - 12. Using pin numbers 13 - 15 will have no discernable effect.

    This pin number, 0 - 15, has nothing to do with the physical pin number of a PICmicro MCU. Depending on the particular PICmicro MCU, pin number 0 could be physical pin 6, 21 or 33, but in each case it maps to PORTB.0 (or GPIO.0 for 8-pin devices, or PORTC.0 for a PIC14000).
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  5. #5
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Hmmmm..
    Yeah, I thought it was probably sumpthin' like that. Is there any documentation around for the pin numbering as mentioned and as to what port lines they refer to on different PICs??
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

  6. #6
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile

    PicBasic Pro Compiler manual

    -Adam-
    Attached Images Attached Images  
    Ohm it's not just a good idea... it's the LAW !

Similar Threads

  1. 7 Segment Displays and MAX7219
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st October 2010, 19:30
  2. Using MAX 7221 LED driver
    By Nick in forum mel PIC BASIC
    Replies: 15
    Last Post: - 21st October 2010, 20:31
  3. Smart Star (how to use shift registers)
    By mackrackit in forum Code Examples
    Replies: 3
    Last Post: - 30th November 2008, 21:06
  4. Shorter Subroutines for MAX7219
    By exelanoz in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2007, 12:35
  5. Another Shiftout question
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd September 2004, 00:07

Members who have read this thread : 1

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