Where can i ask re asm programming problem with bcd subtraction


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190

    Default Where can i ask re asm programming problem with bcd subtraction

    As per title. I know this is pbp forum but I can't seem to find a suitable forum to ask a question ref assembly language.

    I have a 10 digit number stored in 5 byte variables as packed BCD representing a frequency. Say the number is 10000000 in freq4, freq3,freq2,freq1,freq0 whre freq4 is MSB

    I want to subtract 9000000 from this 10 digit number. The number would never be less than 9000000. This would be an if offset for a ham radio.

    I have tried but the result always screws up the result with unfortunately no way of debugging my efforts.

    Thanks for your time.

  2. #2
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Where can i ask re asm programming problem with bcd subtraction

    hi tasmod,

    start with this routine from Scott Datallo where 'x' is the minuend and 'y' is the subtrahend. if C = 0 after the packed bcd subtraction you'll have to borrow from the next most significant packed bcd minuend byte.

    unfortunately no way of debugging my efforts
    Why can't you use the MPLAB Simulator?

  3. #3
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Where can i ask re asm programming problem with bcd subtraction

    Thanks Mike,

    Unfortunately I've already tried that routine but nothing changes. I've tried looking for my error but I'm now dizzy with it.

    As it's a direct step before sending the byte to the LCD i assumed it should at least mess up the display tens digits.

    The 'tens' value are in just one BCD packed byte.

    I have the code working as a direct rf signal generator using one of the cheap ebay dds boards. Total cost of parts about 10 pounds sterling.

    I would like to utilise it as a vfo for a homebrew rig but displaying 0 on the display when the dds is giving out 9mhz. The dds and display would then track up in tandem. This would match the 'i f' then.

    It seems a shame to start again with PBP when I have full working asm code. I may just try to get the 'freq word' out to the dds using PBP in a test situation.

    Rob G4NQX

  4. #4
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Where can i ask re asm programming problem with bcd subtraction

    Hi Rob,

    I wouldn't mind taking a closer look. Can you post a sample five byte packed BCD frequency value? Also, are you using a fixed or absolute address for the five byte frequency variable? And, are you subtracting a "constant" 9000000 value or will that be a variable value?

    Regards, Mike, K8LH
    Last edited by Mike, K8LH; - 29th October 2012 at 12:59.

  5. #5
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Where can i ask re asm programming problem with bcd subtraction

    Hi Mike,

    Apologies, I've been away a few days.

    I've sent you a PM including my email address, so as not to clutter up the forum.

    Rob G4NQX

Similar Threads

  1. Help - programming problem!
    By George in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd September 2010, 12:52
  2. Programming Problem PIC12F683
    By StoneColdFuzzy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 2nd June 2009, 21:39
  3. Re-Programming Problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th April 2009, 01:25
  4. Addition and subtraction
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 25th January 2008, 14:24
  5. Problem programming the PIC16F648A
    By Edgardo_2 in forum General
    Replies: 2
    Last Post: - 29th December 2006, 00:02

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