Displaying temperature Setpoints


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Put yours subrouteenes at the end of your code, never at the beginning!

    Modify your If then in the following manner:

    if maindisp = 1 then
    write 0 , sethighp
    pause 10
    write 1 , sethighp
    mode = 1
    maindisp = 0 ' reset flag
    endif

    Otherwise it will write at every cycle and in this case you do not need the " IF Then " statement. Set your flag to 1 when writing is needed

    Yours code for reading key:

    getkey:
    pause 50
    keyin = portc
    return

    You read the status of the all 8 inputs, than you need to decode to find which key has been pressed.


    More:

    Are you pulling up your inputs using normally closed switches? otherwise with this code you have to pull down your inputs.
    Al.
    Last edited by aratti; - 20th October 2008 at 14:23.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Put yours subrouteenes at the end of your code, never at the beginning!
    Disagree 100%, ok maybe 99%
    If using a PIC16 (or 12,or 10) series PIC, if you are able to keep the 'subroutines' in the first bank of code space, you'll save code space due to the fact that the BANK Select registers don't need to be changed, and at the same time save instruction cycles. And if your subroutines are at the beginning, they're the first thing to get seen while skimming thru the code, makes them harder to forget them (I guess more of a brain thing there).

    At any rate, there's one more small bug in your If/Then correction above (post #13)...a small one...actually two small bugs...one matters, the other doesn't really matter...

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