Variable in array


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Post No solution yet...

    Hi Al,

    Your code worked a bit better but no as Code #2.

    Even code below won't run as Code #2. I wounder why? Only difference is that there is a variable in array. And why i = 0-7 is OK, but next are not??
    Code:
        i=7 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=6 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=5 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=4 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=3 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=2 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=1 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
        i=0 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0 
        
        i=15 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0 '<- Stop working
        ...
        ...
        i=40 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
    It seems that 1st character (1st 8 bits) are OK, but next charaxters 1-5 are not working (shows only blanck screen at those places).

    -Gusse-

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


    Did you find this post helpful? Yes | No

    Default

    Even code below won't run as Code #2. I wounder why?
    you have an extra operation to do in this code (i=7:..), while in code 2 you don't do.

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Post

    To my understanding these two codes should be as equal as possible. One is using a constant, the other variable (i).
    Code:
        Lcd_SDA = FC.0(7) : Lcd_CLK = 1 : Lcd_CLK = 0
    Code:
        i=7 : Lcd_SDA = FC.0(i) : Lcd_CLK = 1 : Lcd_CLK = 0
    This extra operation i=7 shouldn't be a problem if arrays support variable(s).

    -Gusse-
    Last edited by Gusse; - 18th February 2009 at 19:31.

  4. #4
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Red face Me Stupid!

    Now when I re-opened this problematic project, it was very clear to me what was wrong. It was too obvious and I can only say "Me Stupid!".
    If I have defined a new variable for loop, something else than i, j or k (which were used in other part of the code) then I would never faced the problem.

    All codes posted under this topic are working well.

    Thanks Al for your help, I appreciate it a lot!

    -Gusse-
    Last edited by Gusse; - 22nd February 2009 at 19:50.

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. How to saparate variable to array and GLCD Question
    By pramarn in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 4th October 2006, 03:42
  5. display lcd variable array Ascii
    By volcane in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd November 2005, 21:36

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