Addressing multiple PORTs using one Variable


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,698


    Did you find this post helpful? Yes | No

    Default Re: Addressing multiple PORTs using one Variable

    try this 16 led strip on RC7


    Code:
    ' PIC 16F690 @20MHz
    #CONFIG
        __config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_HS_OSC &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF
    #ENDCONFIG
    CLEAR
    TRISC = %00000000
    
    
    DEFINE OSC 20
    pinsel  var byte 
    RED  var byte 
    GREEN  var byte
    BLUE var byte
    px      var byte 
    bt      var byte 
    pc      var byte 
    pinsel   = 128
    
    
    
    
    
    
    
    
    MAIN:
    GREEN=128
    
    
    asm
            MOVLW 16
            MOVWF _pc
    _nxRby        
            MOVF  _GREEN,W
            movwf _px
            MOVLW 8
            movwf _bt
            RLF _px,F
    _nxRbt  movf _pinsel,W
            IORWF PORTC ,F
            BTFSS STATUS,C
            GOTO XXR
            NOP
            NOP
            NOP
            
    XXR     CLRF PORTC  
            NOP
            RLF _px,F
            DECFSZ _bt,F
            GOTO _nxRbt
            MOVF  _RED,W
            movwf _px
            MOVLW 8
            movwf _bt
            RLF _px,F
    _nxGbt  movf _pinsel,W
            IORWF PORTC,F
            BTFSS STATUS,C
            GOTO XXG
            NOP
            NOP
            NOP
            
    XXG     CLRF PORTC  
            NOP
            RLF _px,F
            DECFSZ _bt,F
            GOTO _nxGbt
            MOVF  _BLUE,W
            movwf _px
            MOVLW 8
            movwf _bt
            RLF _px,F
    _nxBbt  movf _pinsel,W
            IORWF PORTC  ,F
            BTFSS STATUS,C
            GOTO XXB
            NOP
            NOP
            NOP
            
    XXB     CLRF PORTC  
            NOP
            RLF _px,F
            DECFSZ _bt,F
            GOTO _nxBbt
            DECFSZ _pc,F
            GOTO _nxRby
            
       
    endasm  
     PAUSE 100
    
    
    
    
    GOTO MAIN
    Warning I'm not a teacher

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default Addressing multiple PORTs using one Variable

    Here's the link for the video again.



    Sorry, I'm not the YouTube expert so I hope it works now
    Roger

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default Addressing multiple PORTs using one Variable

    Quote Originally Posted by richard View Post
    try this 16 led strip on RC7
    Thank a lot Richard. I'll give it a try
    Roger

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,698


    Did you find this post helpful? Yes | No

    Default Re: Addressing multiple PORTs using one Variable

    I take it that's a fail. I'm not surprised, the simulator indicated that @20mHz a pic16f690 cannot to a conditional branch quickly enough for a "LOW" pulse for a ws2812
    Warning I'm not a teacher

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,171


    Did you find this post helpful? Yes | No

    Default Re: Addressing multiple PORTs using one Variable

    Now, that is a surprise to me. This is a simple task for a simulator to calculate. It knows clock rate, instruction cycle, why does it fail to make simple calculations?

    Ioannis

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,698


    Did you find this post helpful? Yes | No

    Default Re: Addressing multiple PORTs using one Variable

    Now, that is a surprise to me. This is a simple task for a simulator to calculate. It knows clock rate, instruction cycle, why does it fail to make simple calculations?
    the simulator correctly indicated that the code will not work right from the start, the TOH is just out of spec

    the code provided was to hopefully prove the outcome one way or the other in real life.
    i assume it failed since roger never replied and then went on to ask pic18 questions
    Warning I'm not a teacher

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default Addressing multiple PORTs using one Variable

    I finally made the proto with 5 µC: 1 master and 4 slaves....

    Anyway, thanks a lot to all for your help

    Name:  Clock_Cicruit_Small.jpg
Views: 50544
Size:  61.4 KB
    Roger

  8. #8
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default Addressing multiple PORTs using one Variable

    And this is how it looks like for now.

    Name:  Clock_Display-Small.jpg
Views: 51290
Size:  38.0 KB
    Roger

Similar Threads

  1. Addressing ports via offset using lookup command
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 1st November 2013, 04:50
  2. How to drive 7 segment using multiple ports?
    By guess79 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 20:43
  3. multiple ports ===> one symbol?
    By PICMAN in forum General
    Replies: 4
    Last Post: - 8th March 2005, 23:24
  4. Problem reading multiple ADC ports
    By jswayze in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th November 2004, 17:46
  5. Reading multiple ports
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th May 2004, 18:22

Members who have read this thread : 2

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