Displaying temperature Setpoints - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 59 of 59
  1. #41
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    yeah it takes abit longer than before to do stuff. im really concerned as to why this is happening bcause it kinda defeats the purpose of intantaneous measurement. Is there anything you would recommend? Should i maybe try change the oscilator to fosc/32? would that help?

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


    Did you find this post helpful? Yes | No

    Default

    Still looking...And it is getting late

    What does this part do for you?
    Code:
    getkey:
    pause 50
    keyin = portc
    Dave
    Always wear safety glasses while programming.

  3. #43
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    provides debounce for buttons connected to portc

  4. #44
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Well, since those buttons seemed to work out so well (refer to post #20 and post #34), do you want to humour me a little bit more?
    Code:
    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
    keyin var byte : adval var word : tempc var word : trisa=1 : trisc=$1f
    highled var porta.1 : lowled var porta.2 : adcon1=$f2 : adcon0=$c1
    pause 1000 : lcdout $fe,1 : goto main
    main: adcon0.2=1 : pause 1
    checkadc: highled=1:if adcon0.2 = 1 then checkadc
    highled=0:adval.highbyte=adresh : adval.lowbyte=adresl : tempc=(50*adval)/100
    pause 50 : keyin = portc : temp = temp + 1 : lowled=temp.3
    lcdout $fe,1,"T=",DEC5 tempc,$DF,"C",$fe,$c0,BIN8 keyin : goto main
    end
    What happens?

  5. #45
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Question

    hey guys. i just realised that everything is fine until the actual temperature reaches the respective setpoints. thats when the design starts to really slow down during its operation. i cant seem to understand why this is so.

    Refering to post #44

    looks like temperature being measured...
    keyin = portc : temp = temp + 1 : lowled=temp.3
    not sure about that though..

    on the lcd will be displayed temperature on the first line and i assuming the binary value of keypressed on line 2

  6. #46
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    hey guys. i just realised that everything is fine until the actual temperature reaches the respective setpoints. thats when the design starts to really slow down during its operation. i cant seem to understand why this is so.
    Gee....Ya think? You wrote the code (or did you?), you should know why it happens...

    Code:
    ...................
    If tempc>=highpt then
    gosub high_flash
    ....................
    If tempc<=lowpt then
    gosub low_flash
    .....................
    high_flash:
    HIGH highled
    PAUSE 350
    LOW highled
    PAUSE 350
    RETURN
    
    low_flash:
    HIGH lowled
    PAUSE 350
    LOW lowled
    PAUSE 350
    RETURN
    How long do you suppose it takes each of those last 2 chunks of code to execute?
    Better yet...how long does it take for a PAUSE 350 to execute?

  7. #47
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    less than half a second.....what r u getting at ski?

  8. #48
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kalind View Post
    less than half a second.....what r u getting at ski?
    WHAT HAPPENS EVERY TIME YOUR CODE FALLS THRU TO ONE OF THOSE FLASHING LED SUBROUTINES?
    How long does it take for each one of those subroutines to execute once they're started (i.e. Gosub'd to and returned from)?
    It happens on each time around the loop after the temperature has exceeded the set point.
    How fast can your buttons/lcd/the-rest-of-the-program possibly run if it's tied up in a pause for 700ms on each run through the loop.
    JEEZE MAN!!! READ THRU YOUR OWN CODE FOR ONCE!!!! What did you do? Cut and paste this from somewhere else? How about getting your FRIEND to help you out more...if this friend actually exists...you know, the same one that HELPED you with those buttons earlier...
    Screw it...I'm done...really...this is about as annoying and frustrating as it can possibly get...the only thing that could be worse would be if your name/handle was TED's, but then again, that was more funny than annoying.
    Last edited by skimask; - 23rd October 2008 at 15:05.

  9. #49
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    It's for the same reason that I removed those two routines and decided to just make those pins high instead. the same thing happens...

  10. #50
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    It's for the same reason that I removed those two routines and decided to just make those pins high instead. the same thing happens...
    I tried, in one last vain attempt to draw your attention to something that might be slowing down your whole project.
    But, I can see that I've failed again, because you've failed AGAIN...or maybe just YOU have FAILED to READ your OWN code...AGAIN!

    You don't think those 2 SOUND statements, with their ~3 seconds of sound making might not have anything to do with anything?

    Ok, now I'm done... Some people you just can't prod into looking at their own stuff closer...because it's all good. Of course it's all good...they wrote it...how can they possibly be wrong or mistaken about anything? Their logic is great...it flows in the code just like it does in their minds...Or does it?!?!?!?!!!!????

    Why don't you go ask your instructor for advise... You've got 48 hours...
    Last edited by skimask; - 23rd October 2008 at 16:07.

  11. #51
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Question

    ski, i removed both of those flashing routines and the problem was still there. then i removed the SOUND statements aswel. seemed to have sorted out the lag issue. the problem is that now i have only a high led and low led when the setpoints are reached but thats not even working

    Code:
    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

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


    Did you find this post helpful? Yes | No

    Default

    I still see sound in that snippet and the leds are = 0 ???
    Dave
    Always wear safety glasses while programming.

  13. #53
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Red face

    what i meant was that i removed those lines of code. now im using the following which is without the other features i was planning to implement. below is the latest code.

    Code:
    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
    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=%10001110
    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
            high highled
            high relayhigh
        else
            low relaylow
            low lowled
            
    endif
    
        If tempc<=lowpt then
            high lowled
            low relaylow
        else
            low relayhigh
            low highled
           
    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
    pause 50
    if down = 0 then highpt = highpt - 1
    pause 50
    if highpt>100 then highpt=100
    pause 50
    
    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=100
    end select
    goto main
    im realy desperate to get this thing working guys....

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


    Did you find this post helpful? Yes | No

    Default

    Looks like you removed the command to goto

    checkdone:
    Dave
    Always wear safety glasses while programming.

  15. #55
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Question

    but there was no command prior to this that said goto checkdone. . .

  16. #56
    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
    but there was no command prior to this that said goto checkdone. . .
    OOPPS, gettemp runs into checkdone.

    Do the relays work?
    Dave
    Always wear safety glasses while programming.

  17. #57
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    well, i tested the relay port using a multimeter and there seems to be no voltage output when tempc>=highpt and the same goes for he highled port.

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


    Did you find this post helpful? Yes | No

    Default

    In post #37 the code worked but was slow.
    In post #43 the outputs on PORTA does not work.

    ADCON1 and ADCON0 has been changed between the two post??
    Dave
    Always wear safety glasses while programming.

  19. #59
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Exclamation

    well i thought by changing the oscillator settings it would sought out th delay but obviously no change. im trying to do some code concerning high led and low led outputs. will post it by the end of today. please take a look at it and let me know if im going the right path

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