HSER revisited


Closed Thread
Results 1 to 5 of 5

Thread: HSER revisited

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Using the HEX modifiers with HSERIN/HSEROUT works just like it's shown in the manual.

    Here's an example of receiving .HEX files from a PC serial connection;
    http://www.microengineeringlabs.com/...bp/progeex.bas

    Reversing the upper & lower nibbles is really simple with a single line of assembler.

    X VAR BYTE
    X = $AB

    @ SWAPF _X,F ; Swap upper & lower nibbles in X. Now X = $BA.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    OK, so lets say I'm being sent $ab and I need it to be placed in a variable a0.

    HSERIN [HEX4 a0]

    This will place the hex value of $ab into a0, correct?

    What if I'm recieving several bytes such as $aa $ab $ac $ad etc etc and I want them in a1 a2 a3 a4 etc?

    HSERIN [HEX4 ao, a1, a2, a3, a4]
    or do I need multiple lines?
    HSERIN [HEX4 a0]
    HSER [HEX4 a1] etc etc.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jmgelba View Post
    This will place the hex value of $ab into a0, correct?
    Should do it.

    What if I'm recieving several bytes such as $aa $ab $ac $ad etc etc and I want them in a1 a2 a3 a4 etc?
    HSERIN [HEX4 ao, a1, a2, a3, a4]
    or do I need multiple lines?
    HSERIN [HEX4 a0]
    HSER [HEX4 a1] etc etc.
    Your first example would almost work, except it should be like this:
    HSERIN [ HEX2 a0, HEX2 a1, HEX2 a2 ]
    HEX2 for bytes
    HEX4 for words
    And multiple lines/statements would work too.

Similar Threads

  1. HSER Problems
    By Kaldurenik in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 15th October 2007, 08:33
  2. Bargraph Revisited..Erm well not maybe
    By Sean_Goddard in forum Off Topic
    Replies: 2
    Last Post: - 22nd July 2007, 11:50
  3. Model Train controller - revisited
    By malc-c in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 8th May 2007, 09:40
  4. Interrupts Revisited
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th August 2005, 18:57
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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