2 variable


Closed Thread
Results 1 to 3 of 3

Thread: 2 variable

  1. #1
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default 2 variable

    Hello All,
    Could someone be kind enough to help me in adding those 2 variables
    This is the story.

    I have got 2 variable Fint & Fdec, Fint contains the integer part of my result(16bits) while Fdec contains
    the decimal part of my result
    so to display a result of 2717.6Hz on an lcd i do the following assuming the variables already contain the following
    Fint = 2717
    Fdec = 6
    LCDout I, Line1,"Result = ",dec Fint ,".",dec Fdec,"Hz"

    Now i need to modify the result so that i can also display Frequency squared (2716.2)2 divided by 1000
    this means adding Fint & Fdec somehow to give 27176 then multply by itself before dividing using DIV32 to divide
    Its combining them that i find a bit stricky could anyone help

    Isaac

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    This is your tricky bit solved...

    BigWord=(Fint*10)+Fdec

    Naturally, you cant have Fint bigger than 6552 to start with.

    Now to do some easy stuff like turning Gold into Lead...

  3. #3
    Join Date
    May 2004
    Location
    brighton
    Posts
    149


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks Mel
    i really feel that i should have thought it through
    my max Fint would be 6000 so i should be ok

    Thanks for your help

    Isaac

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. AN Question for "word" variable read The serial port
    By redfoen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2007, 17:39
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Variable PWM on 2 Channels using software.
    By Tissy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd September 2006, 01:34

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