large program oddity


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    When I changed from that huge if...then tree, to the select case (with a little modification however) the code was small enough to fit in the 2k code size, and he problem went away.

    this is what I had to do to make the ports come on, and go off, otherwise all other things are the same:

    Code:
    if T_zone > 0 then
    select case current_zone
    case 1
    HIGH P_zone1
    case 2
    HIGH P_zone2
    case 3
    HIGH P_zone3
    case 4
    HIGH P_zone4
    case 5
    HIGH P_zone5
    case 6
    HIGH P_zone6
    case 7
    HIGH P_zone7
    case 8
    HIGH P_zone8
    case 9
    HIGH P_zone9
    case 10
    HIGH P_zone10
    case 11
    HIGH P_zone11
    case 12
    HIGH P_zone12
    case 13
    HIGH P_zone13
    case 14
    HIGH P_zone14
    case 15
    HIGH P_zone15
    case 16
    HIGH P_zone16
    case 17
    HIGH P_zone17
    case 18
    HIGH P_zone18
    end select
    endif
    
    if T_Zone = 0 then
    LOW P_zone1 : LOW P_zone2 : LOW P_zone3 : LOW P_zone4 : LOW P_zone5 : _
    LOW P_zone6 : LOW P_zone7 : LOW P_zone8 : LOW P_zone9 : LOW P_zone10 : _ 
    LOW P_zone11 : LOW P_zone12 : LOW P_zone13 : LOW P_zone14 : LOW P_zone15 : _
    LOW P_zone16 : LOW P_zone17 : LOW P_zone18
    endif

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Want to shorten your code a bunch more? Skip the "HIGH" and "LOW" commands and set the port pins directly (See last sentence and example in both the "HIGH" and "LOW" sections of manual).
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  3. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. PIC16F684 Program question
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2006, 14:30

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