Serin serout problem - Page 5


Results 161 to 200 of 337

Threaded View

  1. #30
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    simple I need to take the difference. I believe pic basic pro can only handle unsigned numbers. So but keeking the original forula we get negative number for zero temperature. So by putting the 3200 in front , we get a positive number and add a minus sign.

    for -15 degrees celcius
    we have 15*100 =1500 in the euqation
    =3200 - (1500/5*9) = 500
    = 500/100 ------divide by hundred caus ewe multiplied by a 100 initially
    =5
    = -5 ----- here we just add the minus

    but anyway , remember when i said my decimal values was going reverse. I was thinking and that is similar from doing 2,s compliment . so i decided to do 2,s compliment on everything..

    Zerotemp: '------------- cases when zero celcius and positive Fahrenheit
    temperature = ( ~ temperature ) + 1
    count_per_c = ( ~ count_per_c) + 1
    count_remain= ( ~count_remain) + 1
    temp1 = temperature

    temperature = ((( temperature >>1 ) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    if tempF <= 0 then goto ZeroF

    ': tempf = ( ~ tempF ) + 1 ' added this
    tempF = (((temperature /5) *9 ) + 3200)
    lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
    lcdout $FE,$C0, "TempF: ", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"
    goto loop

    ZeroF: '---------------- cases when zero celcius and 0 Fahrenheit
    tempF = 3200 - ((temperature /5) * 9)

    lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
    lcdout $FE,$C0, "TempF: ", "-", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"

    goto loop

    end
    Last edited by lerameur; - 30th December 2006 at 18:35.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

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