Multi-Button CSM with Pic16LF722A


Results 1 to 32 of 32

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Re: Multi-Button CSM with Pic16LF722A

    the get address macro is part of dt-ints . it places the address of a label in a pbp word var.
    this is the actual macro , its already there so why not use it.
    Code:
    ASM
    ;---[Returns the Address of a Label as a Word]------------------------------
    GetAddress macro Label, Wout
        CHK?RP Wout
        movlw low Label          ; get low byte
        movwf Wout
    ;    movlw High Label         ; get high byte  MPLAB 8.53 killed high
        movlw Label >> 8         ; get high byte
        movwf Wout + 1
      endm
    endasm

    so

    @ GetAddress _my_pwm,_paddress

    gets the address of my_pwm: and places it in var paddress


    the data
    my_pwm:
    @ DW 3,6,13,26,50,95,177,328,600,1023 [data stored as an array of 14 bit values]

    each flash memory address can hold a maximum 14 bit piece of data

    i'm using that address plus an offset to index the array

    readcode paddress+pl ,pw ; address + offset
    [note pw is a word var]
    so if pl= 3
    readcode paddress+3, and returns the value 26

    hope that's understandable

    ps I might add that in my setup that saves 44 words of code space compared to using lookup2
    Last edited by richard; - 23rd May 2016 at 12:55. Reason: ps
    Warning I'm not a teacher

Similar Threads

  1. Replies: 5
    Last Post: - 18th March 2012, 21:40
  2. multi functions button press
    By malwww in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th May 2009, 00:12
  3. Multi-Threading
    By Ted's in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 2nd September 2008, 05:55
  4. Multi-tasking
    By malc-c in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 13th July 2006, 18:50
  5. Multi Interrupt How To ?
    By capitano in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd February 2005, 14:48

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