newToMicroPAnd Loving it but filled with problems


Closed Thread
Results 1 to 2 of 2
  1. #1
    micropgirl's Avatar
    micropgirl Guest

    Default newToMicroPAnd Loving it but filled with problems

    I would like to know how to carry out the modulus operations on the pic, i would like to devide a number by 4 and use the remainer look up the value in a look up table and return the result at the value.

    lookupQuad addwf PCL, F
    retlw 1st
    retlw 2nd
    retlw 3rd
    retlw 4th

    but note the the remainders are going to be fractions, between 0 and 1, so i want if the number i.e. the remainder of the calculation is between 0-0.25 inclusive, i want the lookupQuad to return 1st, if the remainder is between 0.25-0.50 inclusive i want the return value to be 2nd,if the remainder is between 0.50-0.75 inclusive i want the return value to be 3rd and if the remainder is between 0.75-1.00 inclusive i want the return value to be 4th.


    Can you help, or suggest any other way of acheiving this.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    micropgirl,
    Code:
    MyNumber    VAR WORD
    Remainder   VAR BYTE
    Remainder = MyNumber//4
    See PBP Manual Section 4.17
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  2. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 09:03
  3. bootloader Freqout problems
    By handgio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2007, 13:38
  4. Input problems
    By ALFRED in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd July 2006, 21:02
  5. Problems with 16F876 on interrupts an WRITE / READ
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2005, 14:38

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