Can't multiply by 2!


Results 1 to 3 of 3

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    4.1056 Vdc is actually 41,056.

    41,056 * 2 = 82,112 which is larger than a word sized variable can hold.

    82,112 - 65536 = 16,576 which is why you're seeing 1.6576 returned in AdVal1.

    Try something like ADval1 = (ADval/10) * 2, and you should be back in the ball game.

    This will return 8,211 so --

    SEROUT2 PORTB.1,Baud,[dec ADval1 dig 3,".",dec3 ADval1," Vdc ADVal1",$0D,$0A]
    Last edited by Bruce; - 29th October 2004 at 09:09.
    Regards,

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

Similar Threads

  1. How to drive the Vinculum VDIP1 in UART mode
    By BrianT in forum Code Examples
    Replies: 41
    Last Post: - 23rd May 2013, 13:34
  2. Replies: 4
    Last Post: - 15th April 2009, 02:54
  3. USB-FTDI[UM232R] with PIC16f877a
    By bjox in forum USB
    Replies: 1
    Last Post: - 23rd February 2008, 23:40
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 21:36
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27

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