automatic macro selection?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    3

    Question automatic macro selection?

    I am trying to create an extension to HSERIN/HSEROUT that does STX/ETX string handling and I am wondering how I can get it to work. I have seen that you can call ASM macros from PBP using @, but how do I get it to automatically select which one to use like the built in PBP statements do?

    For example, by looking through the generated ASM code it seems that when you call hserout ["test"] it calls the HSEROUT?C macro 4 times, one for each letter in the word "test". What I want to do is something similar, so when I call my function/macro like so: @stxtx type, "Test" it will automatically 'do the right thing' and expand the macro I create to send a constant string...

    I'm kind of new to PBP (actually quite new) but I have an extensive C background with a bit of ASM, so I think my issue is just trying to figure out how to do things the 'PBP Way (TM)'

    So is what I want to do possible, or am I out of luck? If someone has done something like this already, can they point me to an example? I guess a detailed PBP + MPASM + macros guide would be a good pointer too, if something exists.

    Thanks,
    Mike

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    If this is what you're going for:

    [STX][status][type][length][user data...][checksum][ETX]

    then this may work for HSERIN without the macro's...

    Code:
    HSERIN [Wait [ $02 ] , status , type , length ]   'gets everything up to 'length'
    HSERIN [ array\length , chksum ]  'gets 'length' characters, grabs the checksum
    HSERIN [ Wait [ $03 ] ]   'waits for ETX, if this doesn't time out, then you got a valid array of data
    For the HSEROUT,

Similar Threads

  1. USBDemo, something to learn USB a little bit
    By mister_e in forum Code Examples
    Replies: 278
    Last Post: - 1st May 2014, 00:38
  2. PBPro error "Macro USBINIT? not found in macro file"
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th October 2011, 09:06
  3. Replies: 6
    Last Post: - 4th November 2009, 13:36
  4. ERROR: Macro MOD?TCB not found in macro file.
    By JohnP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2009, 19:10
  5. Passing an array as a macro argument?
    By forgie in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th September 2005, 17:09

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