Avoiding of 255 IF-THEN in the code, possible?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Avoiding of 255 IF-THEN in the code, possible?

    Thanks!
    Will try that "case" version and check, what amount of memory it will consume.
    regarding the MAX7219 example, there's some ASM code doing "unpack".
    Is it portable? I mean, can be used with other PIC hardware?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Avoiding of 255 IF-THEN in the code, possible?

    I did some quick tests yesterday and the arraywrite method consumes about double the space compared to loading the array "manually" - no where near 82 bytes though so I don't know what's going on there.

    SELECT CASE uses slightly more space than multiple IF/THEN but it's cleaner and the execution time is always the same.

    Since the memory width of PIC18 is 8 bits the method of packing two 7-bit wide "character lines" into one word isn't suitable for that series.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Avoiding of 255 IF-THEN in the code, possible?

    Of by the way, I "took apart" the code I've provided, and out of 82 bytes, ARRAYWRITE uses only 19, remaining is used by IF-THEN

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Avoiding of 255 IF-THEN in the code, possible?

    That sounds very very strange to me. I can't imagine that a single IF/THEN clause would "eat" 63 bytes.

  5. #5
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Avoiding of 255 IF-THEN in the code, possible?

    I'm using PIC16F886.

Similar Threads

  1. Read EEprom the 18f4620 after 255 ??
    By vicce67 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd June 2011, 09:22
  2. Line Following, Obstacle Avoiding , and Victim Finding
    By cryptex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th June 2011, 16:34
  3. Replies: 4
    Last Post: - 14th June 2011, 22:03
  4. Avoiding getting stuck in a loop
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2008, 11:41
  5. Need to count higher than 255
    By Steve Matson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd February 2008, 08:05

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