Same code in different Pins


Closed Thread
Results 1 to 32 of 32

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Josuetas View Post
    I have already wrote and read from each device with this method.

    Darrel, Why would i go back to the previous version of the Macro? this is a real question, do you think of any reason?
    Great! Glad you got it working.

    There's really no reason at all to go back.
    As mentioned before, since the "PIN Numbers" are limited to 0-15, there should never be a reason to have the OWPIN?W macro the way it was before.
    Even if you must use a word variable for some reason or another, you can just use the .LowByte modifier and PBP will use the OWPIN?B macro instead.

    Quote Originally Posted by Josuetas View Post
    And since life is a Learning HighWay... can you explain a bit of the asm code and can you lead me to do it on 18F devices?
    OK, well I should have done the 18F version at the same time I did the 16F. The differences in the chips, makes things different for these routines too. It would be too confusing the way it was, so I've changed the way my last example works so that they will work the same for both 16F and 18F's.

    Up in Post #26, I've modified the macro to use an Offset from PORTA, instead of just the Address of PORTx.
    This way, the actual usage of the WORD variables will be the same for both chips.

    And here's the macro for the 18F's. This one goes in the PBPPIC18.MAC file.
    Code:
    ;-- changed for addressing any pin with a word variable --
    ;-- highbyte = Offset from PORTA, lowbyte = PIN --
    OWPIN?W macro Win
            MOVE?CB  high(PORTA), RS1
            MOVE?CB  low(PORTA), RR1
            MOVE?BA  Win+1
            CHK?RP   RR1
            addwf    RR1, F
            MOVE?BB  Win, R4
            L?CALL   CONVBIT
            MOVE?AB  RM1
        endm
    CONVBIT_USED = 1
      endmod
    The usage will be the same as in Post #26 for the 16F's. (please go back and review it again)

    I'm still trying to figure out how I can explain the macro's.
    <br>
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Default It also works... of course..

    My head is telling me somehow: "You donīt really wanna know"
    Man it seems thought..

    I will hold my breath and just go with my happy new versions of the OWPIN? macro.

    Gracias otra vez

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Nokia COLOR LCD PicBasicPro 2.50a example code
    By skimask in forum Code Examples
    Replies: 49
    Last Post: - 28th September 2011, 01:43
  3. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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