Retrieving 32bit Multiply Result


Closed Thread
Results 1 to 40 of 43

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hello everyone,

    I was wandering if it is possible to implement the extended 32 bit idea to something as simple as for / next loop.
    How will this simple loop look like if I need to deal with more than word size index:

    For index =0 to big_number
    Hserout [record(index),13,10]
    Pause 100
    Next

    Is it possible to have a big_number = 1,000,000 – 2,000,000?

    Thank you for your input.

    Nick

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Nicmus View Post
    Is it possible to have a big_number = 1,000,000 – 2,000,000?
    Nick
    It's directly possible if you have the PBP 2.50a upgrade, which supports signed/32 bit LONG variables...

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    for PIC18 only !
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Thumbs up

    Quote Originally Posted by mister_e View Post
    for PIC18 only !
    Got my back everywhere, dontcha?

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank you gents for your replies.
    Unfortunately for me I’m dealing with a old application which employs a PIC16F876A and needs an upgrade to be able to handle a larger number of records.
    The code space is not a problem so I guess I will have to figure a way to get around this problem.
    Basically I receive a 8 bytes decimal number which is the total number of records. What I’m planning to do is create two loops.
    First I will separate the incoming Big_number in Big_number_low (last four bytes (max 9999)) and Big_number_high (first four MS bytes (max 9999)).
    The code in my last post should change to:

    For index_1=0 to Big_number_low
    HSEOUT [sentence(index_1)]
    Next
    For index_2=0 to Big_number_high
    For index_3=0 to 9999
    HSEROUT [sentence(index_3)]
    Next
    Next

    I’m wandering if this will do or I need to look deeper into the problem.
    Any comments will be appreciated.

    Regards,

    Nick

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


    Did you find this post helpful? Yes | No

    Default

    Not sure how you're going to get a 1,000,000 element array with a PIC ...
    Even with PBP 2.50

    Code:
    For index =0 to big_number
        Hserout [record(index),13,10]
        Pause 100
    Next
    Not enough RAM.
    <br>
    DT

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Thank you gents for your replies.
    I’m sorry for not making it clear. I’m receiving each sentence one at the time and send them out. My problem is that I know how many I will receive (Big_number) and I need to keep track on how many I send out to match the Big_number. So it gets down to only handling a 6digi number.
    Unfortunately for me I’m dealing with a old application which employs a PIC16F876A and needs an upgrade to be able to handle a larger number of records.
    The code space is not a problem so I guess I will have to figure a way to get around this problem.
    Basically I receive a 8 bytes decimal number which is the total number of records. What I’m planning to do is create two loops.
    First I will separate the incoming Big_number in Big_number_low (last four bytes (max 9999)) and Big_number_high (first four MS bytes (max 9999)).
    The code in my last post should change to:

    For index_1=0 to Big_number_low
    HSEOUT [sentence(index_1)]
    Next
    For index_2=0 to Big_number_high
    For index_3=0 to 9999
    HSEROUT [sentence(index_3)]
    Next
    Next

    I’m wandering if this will do or I need to look deeper into the problem.
    Any comments will be appreciated.

    Regards,


    Nick
    Last edited by Nicmus; - 25th January 2008 at 01:36. Reason: To clarify the problem

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


    Did you find this post helpful? Yes | No

    Default

    How are you going to get a 1,000,000 element array with a PIC?

    Code:
    For index_1=0 to Big_number_low
        HSEROUT [sentence(index_1)]
    Next
    Not enough RAM.
    <br>
    DT

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    I’m sorry for not presenting the complete picture.
    I’m reading a .txt file from a USB media. The first line of this file gives me the total number of records in the file.
    I’m reading the records one by one in a big loop:

    Read Big_number
    For index = 0 to Big_number
    Read record
    HSEROUT [record}
    If index => Big_number then quit
    Next

    It all works fine if Big_number is limited to word size.
    Now the requirement changed for larger number of records so I thought that your trick might apply here.
    At the time I did that because I did not know, and I still don’t, to detect EOF.
    Trying to read the device over the EOF will freeze the system.

    Thank you for your interest.

    Nick

Similar Threads

  1. Strugling without floating point
    By pjsmith in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th March 2011, 06:29
  2. Math help please!!!
    By jbirnsch in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th August 2007, 14:45
  3. 32-bit Variables and DIV32, Hourmeter 99999.9
    By Darrel Taylor in forum Code Examples
    Replies: 9
    Last Post: - 23rd November 2006, 07:23
  4. PBP 16-bit ADC result math
    By sonic in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2005, 14:21
  5. Retrieving Div32 Remainder
    By Darrel Taylor in forum Code Examples
    Replies: 4
    Last Post: - 20th August 2003, 03:53

Members who have read this thread : 4

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