I知 having a problem with getting the correct remainder using // remainder.


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default Re: I知 having a problem with getting the correct remainder using // remainder.

    Using integer math

    1023 / 213 = 4 remainder 171
    remainder 171*100 / 213 = 80

    So, adcVal1 = adcVal / 213
    adcVal2 = ((adcVal // 213)*100)/213

    Then print the value
    This is the quick and easy way. Others might suggest more optimal techniques using PBP

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: I知 having a problem with getting the correct remainder using // remainder.

    maybe like this

    100/213 *256 = 120

    using the */ operator
    1023 */ 120 = 479

    so
    adcVal1 = adcVal */120

    lcdout $fe, $C0, dec adcval1/100 ".",dec1 adcVal1//100

Similar Threads

  1. Remainder (Modulus, Modulo)
    By PICn-It in forum General
    Replies: 3
    Last Post: - 12th January 2010, 02:16
  2. Is this the correct PIC?
    By The Master in forum Off Topic
    Replies: 8
    Last Post: - 6th May 2008, 16:44
  3. Correct syntax please ?
    By malc-c in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2006, 09:09
  4. Mathematics and remainder for PLL MC145158
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th August 2005, 04:32
  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 : 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