shiftout data


Closed Thread
Results 1 to 4 of 4

Thread: shiftout data

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default shiftout data

    I have code for to shiftout data (works)

    Code:
        enable_pin  var portb.7            ' set for the enable pin
        data_pin    var porta.1            ' set for the data pin
        clock_pin   var porta.0            ' set for the clock pin
        
       	PLL	 var  Word
        
        high enable_pin
        shiftout data_pin , clock_pin , 0 , [PLL\16]
        low enable_pin
    I use the variable PLL which is 16 bit (1 word).

    Now I want to send first the 16 bit (PLL1) and after to send 11 bit (PLL)
    But don't work.

    PLL var Word
    PLL1 var Word

    high enable_pin
    shiftout data_pin , clock_pin , 0 , [PLL1\16]
    shiftout data_pin , clock_pin , 0 , [PLL\11]
    low enable_pin

    How to send the first 5 bit(msb) and after to send the others 11 bit(lsb) with shiftout
    Last edited by savnik; - 3rd September 2007 at 12:21.

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    > How to send the first 5 bit(msb) and after to send the others 11 bit(lsb) with shiftout

    I'm not totally clear on what you are trying to do, but from that i'm assuming you want to send the word in the following order: bit11 bit12 bit13 bit14 bit15 bit0 bit1 ... bit9 bit10

    if so, you can do it like this:

    Code:
    variable1  var word
    temp       var word
    
    temp=variable1>>11
    shiftout data_pin, clock_pin, 0, [temp\5]
    shiftout data_pin, clock_pin, 0, [variable1\11]
    If this is not the order you want the bits sent, what order do you want?
    Last edited by Kamikaze47; - 3rd September 2007 at 18:14.

  3. #3
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    > How to send the first 5 bit(msb) and after to send the others 11 bit(lsb) with shiftout

    I'm not totally clear on what you are trying to do, but from that i'm assuming you want to send the word in the following order: bit11 bit12 bit13 bit14 bit15 bit0 bit1 ... bit9 bit10

    if so, you can do it like this:

    Code:
    variable1  var word
    temp       var word
    
    temp=variable1>>11
    shiftout data_pin, clock_pin, 0, [temp\5]
    shiftout data_pin, clock_pin, 0, [variable1\11]
    If this is not the order you want the bits sent, what order do you want?
    I have the word PLL
    bit15-bit14-bit13-bit12-bit11-bit10-bit9-bit8-bit7-bit6-bit5-bit4-bit3-bit2-bit1-bit0
    I want to send the bit15-bit14-bit13-bit12-bit11 first
    and after send the bit10-bit9-bit8-bit7-bit6-bit5-bit4-bit3-bit2-bit1-bit0

  4. #4
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Code:
    temp       var word
    
    ' code to send bit11-bit15
    temp=PLL>>11
    shiftout data_pin, clock_pin, 0, [temp\5]
    
    ' code to send bit0-bit10
    shiftout data_pin, clock_pin, 0, [PLL\11]
    '                             
    '                             ^
    '                             ^
    ' The 0's here means it will send the least significant
    ' bits first. i.e for the second section: bit0 first,
    ' then bit1, then bit2, etc. If you want it to send the
    ' most significant bits first you should set this to 1.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23: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