Shot meself in the foot again...


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

    Default Shot meself in the foot again...

    Some time ago, I experimented with SHIFTOUT and got it working ok. Of course I didn't save the file anywhere, 'cos it was so easy. Now I want to use SHIFTOUT again but can't find any reference to the required DEFINEs, especially the one that sets the port for the clock & data lines. I am sure I remember that the PORT has to be defined somewhere, somehow so that I can just use a constant as the CLOCKPIN number rather than a full PORTX.Y. Can someone please point me at the correct DEFINEs that are required?????
    Last edited by muddy0409; - 20th June 2007 at 10:18. Reason: Fat fingers, wrong keys, therefore bad spelling!!
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

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


    Did you find this post helpful? Yes | No

    Default

    Ok Peter, Now put the gun down.

    Cause you might shoot yourself in the head after this...
    Code:
    SHIFTOUT DataPin,ClockPin,Mode,[Var{\Bits}...]
                  |      |     ^
                  |      |     |
    Data "Line"---'      |     |
         Clock "Line"----'     |
      What to worry about------'
    The only DEFINE is ....<pre>DEFINE SHIFT_PAUSEUS 50 'Slow down the Shiftin and Shiftout clock</pre>But it's unlikely you'll need it. SHIFTIN/OUT is pretty slow to begin with ... ~50khz.

    Still here? Still got ammo in that gun?
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    The PBPbook says I can use a simple number for CLOCKPIN: SHIFTOUT,datapin,2,5,[var]...... DOESN'T GO. How is the beasty supposed to know that 2 means portc.2....The thing is I gotta use 0 - 7 as the clockpin and using a variable does not work! (I am feeding 8 shift registers sequentially)

    I spoke to the bloke that has the old thing I did, but that is useless to me without a DE COMPILER (is there such a thing) to get it back to a language I can understand.
    I have tried port indexing, using examples found in here also, but nothing seems to work. EG SHIFTOUT DAT,2,5,[S1] DAT is the DATAPIN which is common to all the S/Rs S1 is the data variable and 2 is the clockpin (goes to the second of 8 S/R's). This don't go.

    SHIFTOUT DAT,portc.2,5,[S1] DOES go
    SHIFTOUT DAT,sect,5,[S1] DON'T go (sect is the index var which is pointing at the relevant S/R.)
    SHIFTOUT DAT,portc.0[sect],5,[S1] Also DON't go.

    The overall program is running, as I can see the DATAPIN blinking away merrily on my logic probe, it's just the CLOCKPIN part that has me stymied.

    If I do SHIFTOUT DAT,portc.2,5,[S1] and watch the clock on the S/R and the outputs from the S/R all is fine.

    The thing I did a while ago works great (as a prototype) but I'm damned if I can remember what I did with this bit of code. IT BLOODY WORKS I TELL YA!!!!!
    This current model is simply a smaller device with EXACTLY same circuit, so???????????????????????????????????????????????? ??????

    Well, I s'pose something's gotta keep me up at night?



    I think I'll try a new chip, but seeing that it does work sometimes, I'm not too excited about that fixing it.
    Last edited by muddy0409; - 21st June 2007 at 13:23.
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Number or PORT real name or Alias to pin it has to work

    Have a look to section 4.11, or in MCS Help topics>>PICBASIC PRO Basics>>> Pins

    To me, real port name (PORTB.3) or aliases (DO) is more valuable than pin #.

    But... it's me
    Code:
        SS                   var PORTB.1 ' ISD4002 SS pin
        SCLK                 var PORTB.2 ' ISD4002 SCLK pin
        MOSI                 var PORTB.3 ' ISD4002 MOSI pin
        MISO                 var PORTB.4 ' ISD4002 MISO pin
        '
        '
        '
        '
        ss = 0
        shiftout MOSI,SCLK,LSBFIRST,[ISDword\16]
        ss = 1
        '
        '
        '
        '
        ss=0
        shiftin miso,sclk,lsbpre,[isdpointer\16]
        ss=1
    Last edited by mister_e; - 21st June 2007 at 14:39.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    Peter,

    How is the beasty supposed to know that 2 means portc.2....The thing is I gotta use 0 - 7 as the clockpin
    Not sure if you really mean "I gotta use 0 - 7".

    Usually PORTC.2 is number 10, but that depends on the chip you are using.
    If you really need it to be 0-7, see this thread for how to change it.

    http://www.picbasic.co.uk/forum/show...ht=PORTL+PORTH

    HTH,
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Right, I'll have a look at that in a jiffy.
    Meantime, I "delooped" the thing and addressed each CLOCKPIN as exactly what it was, eg PORTC.0 up to PORTC.7 and now works perfect. Still don't think that was what I did on the previous thing but....


    I'll go have a look at that link now and play around some more...
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

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


    Did you find this post helpful? Yes | No

    Default

    Yep, that done it.
    Has anyone ever done a edited version of the PBP manual with all this stuff included? Or asked MELABS to add to the original manual?????????

    Hope they are reading this!!!

    Thanks shiploads blokes, you are life savers as always. I've locked the ammo away again, but kept the rifle out to belt meself about the head.
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

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


    Did you find this post helpful? Yes | No

    Default

    Hi all.
    As a follow-up to my previous, Would it be feasable to start a thread or even a full forum containing all those undocumented little gems that some people discovered. I think it would be a real good help to some people, 'specially twits like me?
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

  9. #9
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Hey muddy0409, how does your foot feel in the meantime ?
    Be well - whoever you are.

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


    Did you find this post helpful? Yes | No

    Default

    Gettin' better slooooowwly!
    Attached Images Attached Images  
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

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


    Did you find this post helpful? Yes | No

    Default

    Peter,

    You owe me $20.

    For the dinner I just lost.
    Eeeewwww.
    <br>
    DT

  12. #12
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default That picture needs a disclaimer!!!

    As Darrel has alluded to, viewer discretion is advised. Content may be upsetting to small children, or those with weak stomachs.

    SteveB

Similar Threads

  1. One Shot Rising
    By MarcBergeron in forum General
    Replies: 1
    Last Post: - 27th September 2009, 21:55
  2. Re: Recommended PCB foot prints
    By Steve_88 in forum Off Topic
    Replies: 0
    Last Post: - 30th June 2007, 17:56

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