Displaying temperature Setpoints


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Wink

    just want to apologise for asking too much. i manage to get the thing working. just have to try tweak here and there...

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    just want to apologise for asking too much. i manage to get the thing working. just have to try tweak here and there...
    And what ended up fixing the problem?

  3. #3
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    well, the button where connected incorrectly. that being my partners fault. also a few things in the program which where so obvious.. now im gona add in buzzer for high/low and also relays to switch loads at certain temps.

  4. #4
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Exclamation

    BIG PROMLEM!!! After adding on all the extra's (relay code, leds...etc), the pic is operating at snails pace!!! What do i do about this now??

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    BIG PROMLEM!!! After adding on all the extra's (relay code, leds...etc), the pic is operating at snails pace!!! What do i do about this now??
    Did you DEFINE the OSC or mes with the configs?

    Post you code so we can take a look.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    im using a 4mhz crystal oscillator. I did define it in ADCON0. Bit 6-7 as 11. i would also like to know what difference would there be if i had to amplify the output signal from the LM35. and if i did, please explain to me whether i'd be getting more accurate results? N.B. 16F873

    Define LCD_DREG PORTB
    Define LCD_DBIT 0
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 5
    Define LCD_EREG PORTB
    Define LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2

    mode var byte
    keyin var byte
    adval var word
    tempc var word
    highpt var byte
    lowpt var byte
    highled var porta.1
    lowled var porta.2
    relayhigh var porta.3
    relaylow var porta.4
    buzzer var porta.5
    up var portc.0
    down var portc.1
    sethighp var portc.2
    setlowp var portc.3
    maindisp var portc.4
    highpt = 100
    lowpt = 0
    trisc= %00011111
    trisa=%00000001
    adcon1=%11110010
    adcon0=%11000001

    pause 100

    lcdout $fe , 1
    mode = 1
    goto main

    getkey:
    pause 50
    keyin = portc
    return

    gettemp:
    adcon0.2=1
    pause 1

    checkdone:
    if adcon0.2=1 then checkdone

    adval.highbyte=adresh
    adval.lowbyte=adresl

    tempc=50*adval
    tempc=tempc/100

    If tempc>=highpt then
    gosub high_flash
    SOUND buzzer, [60, 100, 23, 200]
    relayhigh = 1
    else
    relaylow = 0
    lowled = 0
    buzzer = 0
    endif

    If tempc<=lowpt then
    gosub low_flash
    SOUND buzzer, [20, 100, 23, 200]
    relaylow = 1
    else
    relayhigh = 0
    highled = 0
    buzzer = 0
    endif

    return

    main:
    gosub gettemp
    gosub getkey

    if maindisp = 0 then mode = 1
    pause 50
    if sethighp = 0 then mode = 2
    pause 50
    if setlowp = 0 then mode = 3
    pause 50

    select case mode

    case 1
    write 0 , sethighp
    pause 10
    write 1 , setlowp
    lcdout $fe , 1
    Lcdout "TEMP = ",DEC tempc,$DF,"C"

    case 2
    lcdout $fe , 1
    lcdout $fe , $80 , "High Setpoint:" , $fe , $c0 , dec highpt, $DF , "C"
    if up = 0 then highpt = highpt + 1
    if down = 0 then highpt = highpt - 1
    if highpt>100 then highpt=0

    case 3
    lcdout $fe , 1
    lcdout $fe , $80 , "Low Setpoint:" , $fe , $c0 , dec lowpt, $DF , "C"
    if up = 0 then lowpt = lowpt + 1
    if down = 0 then lowpt = lowpt - 1
    if lowpt>100 then lowpt=0
    end select
    goto main

    high_flash:
    HIGH highled
    PAUSE 350
    LOW highled
    PAUSE 350
    RETURN

    low_flash:
    HIGH lowled
    PAUSE 350
    LOW lowled
    PAUSE 350
    RETURN
    Last edited by Kalind; - 23rd October 2008 at 09:40.

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    im using a 4mhz crystal oscillator. I did define it in ADCON0. Bit 6-7 as 11. i would also like to know what difference would there be if i had to amplify the output signal from the LM35. and if i did, please explain to me whether i'd be getting more accurate results? N.B. 16F873
    You define the oscillator
    Code:
    DEFINE OSC 4
    but PB defauts to 4 so you should be good there.

    The LM35 does not need amplification. If it is giving a fluctuation on the reading a capacitor between the signal and 0 volts (ground) will fix that.

    Still looking through you code...
    When it gets to the LED blinking, do they blink at the correct speed? Or are you seeing slow running some place else?
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Write Onewire data toa I2C memory / read ASCI
    By Eugeniu in forum mel PIC BASIC Pro
    Replies: 67
    Last Post: - 16th November 2008, 19:19
  2. Displaying temperature using a -40 to 185F??
    By jblackann in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th January 2008, 18:45
  3. Conversion problem
    By eva in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th March 2007, 18:21
  4. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  5. Serout "onewire.bas"
    By puru in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th July 2005, 00:14

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