Stumped with word variable


Results 1 to 31 of 31

Threaded View

  1. #13
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Stumped with word variable

    Henrik,

    I still can't get this to compile. I've tried something different, here is my logic (illogical thinking !!)

    Created eight new variables, as bytes as the values will be 0-12 for hours and 0-59 for minutes
    Code:
    Blue_On_Time_H var byte
    Blue_on_Time_M var byte
    Blue_Off_Time_H var byte
    Blue_off_Time_M var byte
    
    White_On_Time_H var byte
    White_on_Time_M var byte
    White_Off_Time_H var byte
    White_off_Time_M var byte
    Then add eight lines of data to match

    Code:
        data    14      'Blue ON time hours
        Data    00      'Blue ON time minutes
        data    15      'Blue OFF time hours
        Data    00      'Blue OFF time minutes
        Data    14      'Whites ON time hours
        data    01      'Whites ON time minutes
        data    14      'Whites OFF time hours
        Data    20      'Whites OFF time minutes
    Then added the read and write sections

    Code:
    write 10,white_on_time_h              'Whites ON time hours
    write 11,white_on_time_m              'Whites ON time minutes
    write 12,white_off_time_h             'Whites OFF time hours
    write 13,white_off_time_m             'Whites OFF time minutes
    write 14,blue_on_time_h             'Whites ON time hours
    write 15,blue_on_time_m             'Whites ON time minutes
    write 16,blue_off_time_h            'Whites OFF time hours
    write 17,blue_off_time_m            'Whites OFF time minutes
    Code:
    Read 10,white_on_time_h              'Whites ON time hours
    Read 11,white_on_time_m              'Whites ON time minutes
    read 12,white_off_time_h             'Whites OFF time hours
    read 13,white_off_time_m             'Whites OFF time minutes
    read 14,blue_on_time_h             'blue ON time hours
    read 15,blue_on_time_m             'blue ON time minutes
    read 16,blue_off_time_h            'blue OFF time hours
    read 17,blue_off_time_m            'blue OFF time minutes
    I get the illegal character error when compiling. If I comment out the read / write lines for these variables it complies. I've even tried commenting all but just one line and it still fails !

    OK I see I've transposed the data values - but the fact that it's not putting anything into the memory shouldn't matter

    Now corrected:
    Code:
    data @0
        data    00      'Blue fade IN duration hours
        data    30      'Blue fade IN duration minutes
        data    00      'Blues fade OUT duration hours
        data    30      'Blue fade OUT duration minutes
        data    00      'Whites fade IN duration hours
        data    30      'Whites Fade IN duration MINS
        data    00      'Whites Fade OUT duration HOURS
        data    30      'Whites Fade OUT duration MINS
        data    255     'Blue MAX Intensity %
        data    255     'Whites MAX Intensity %
        data    14      'Whites ON time hours
        Data    00      'Whites ON time minutes
        data    15      'Whites OFF time hours
        Data    00      'blue OFF time minutes
        Data    14      'blue ON time hours
        data    01      'blue ON time minutes
        data    14      'blue OFF time hours
        Data    20      'blue OFF time minutes
    Last edited by Scampy; - 9th November 2013 at 22:49. Reason: corrected data

Similar Threads

  1. When variable may not fits into WORD limitations
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2013, 10:26
  2. How to isolate 10 bits from word variable?
    By rcbandwidth123 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 14th April 2008, 21:18
  3. adding new word variable ?
    By iugmoh in forum General
    Replies: 4
    Last Post: - 21st February 2008, 01:26
  4. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 22:16
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 20:59

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