Assembly Language inside PBP


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default BYTE/WORD in Assembler

    Thanks Jerson - I will give it a go.

    I presume that PBP allocates two BYTES of memory to the WORD sized variable 'RAIN' and the assembler routine only deals with one of them?

    I guess I could create two BYTES to hold the RAIN data and increment the 'higher' BYTE if there is a carry from the 'lower' - Seems a bit cumbersome and I was looking for a neater/easier way.

    Regards Bill Legge

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Bill Legge View Post

    Seems a bit cumbersome and I was looking for a neater/easier way.
    Hi, Bill

    As the 18F1220 is a 8 bits processor ... the neater/easier way is to use a 16 bits device !!!

    not obvious easier, eh ???

    NOW, The "DT Instant interrupts" might do the trick " neater " ( sic ) ... it's not raining as the "Niagara falls" , after all ...

    OR use one of the chip 16 Bits counters ... you have 3 aboard, after alll ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bill Legge View Post
    I guess I could create two BYTES to hold the RAIN data and increment the 'higher' BYTE if there is a carry from the 'lower' - Seems a bit cumbersome and I was looking for a neater/easier way.
    Simple addition or incrementing variables doesn't use the system registers.
    So it's ok to break out of ASM and do it with PBP.
    Code:
    Rain   VAR WORD
    
    ASM
    MyInt
        ;save context
        ;asm part here
        ENDASM
          Rain = Rain + 1
        ASM
        ;more asm here
        ;restore context
        retfie
    ENDASM
    DT

Similar Threads

  1. Replies: 2
    Last Post: - 8th February 2009, 05:10
  2. Assembly Language Conflict
    By NO2K in forum General
    Replies: 2
    Last Post: - 24th July 2007, 00:42
  3. Passing arrays PBP <-> Assembly
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th April 2006, 01:01
  4. Assembly Language + PBP
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th January 2006, 13:54
  5. Replies: 2
    Last Post: - 8th August 2004, 16:00

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