data storage label


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2008
    Posts
    85

    Default data storage label

    hi,

    i would store information in different DATA files i.e. label1 DATA $01, , 10,...
    and label2 DATA $21, $45

    here is the program but it gave error message

    CMCON = 1
    TRISA = 0
    TRISB = 0

    I VAR BYTE
    TEMP VAR WORD ; temporary storage out put


    LOOP:
    .....
    .....

    for i = 0 to 5
    read display + i , temp ;increase the index to read data from

    "display". display is @ first data l location and store it in the "temp"

    portb = temp ; out put to hardware
    next i

    GOSUB LOOP

    ENd

    display DATA $00,$40,$40,$7F,$40,$40 ;data storage here

    thanks for your help

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    It's just a Warning, so you can turn it off.

        @ errorlevel -202
    <BR>
    DT

  3. #3
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    thanks Darrel,
    i try it but now bad token
    i try to check on the data sheet of 16 f628 have not seen it yet.

  4. #4
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel

    I could not find the "error level" in the data sheet of 16f628. where is it information from?


    thanks for yuor help

    Minh le

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Sorry, I assumed you were using an 18F, which can have problems with EEPROM Math.
    Since you are using a 16F628, please ignore my previous comment.

    Not sure why you would get that error with a 16F, so give this a try and let me know what happens.
    Set you're OSC and LCD defines first ...
    Code:
    <font color="#0000FF"><b><i>'----[EEPROM DATA]----------------------------------------------------------
    </i></b></font><b>EEstring1  </b><font color="#008000"><b>DATA </b></font><font color="#FF0000">&quot;Hello World!&quot;</font>,<font color="#800000"><b>0        </b></font><font color="#0000FF"><b><i>; null-terminated strings in EEPROM
    </i></b></font><b>EEstring2  </b><font color="#008000"><b>DATA </b></font><font color="#FF0000">&quot;Didn't expect That.&quot;</font>,<font color="#800000"><b>0
    
    </b></font><font color="#0000FF"><b><i>'----[Variables / Aliases]--------------------------------------------------
    </i></b></font><b>Idx     </b><font color="#008000"><b>VAR BYTE                 </b></font><font color="#0000FF"><b><i>' String Index pointer
    </i></b></font><b>Char    </b><font color="#008000"><b>VAR BYTE                 </b></font><font color="#0000FF"><b><i>' Character to display
    </i></b></font><b>String  </b><font color="#008000"><b>VAR BYTE                 </b></font><font color="#0000FF"><b><i>' Pointer to String in EEPROM memory
    
    '----[Initialization]-------------------------------------------------------
    </i></b></font><b>CMCON  </b>= <font color="#800000"><b>7
    </b></font><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>1</b></font>:<b>FLAGS</b>=<font color="#800000"><b>0</b></font>:<font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>250</b></font>:<font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>1</b></font>:<font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>250 </b></font><font color="#0000FF"><b><i>' Initialize LCD
    
    '----[Main program loop]----------------------------------------------------
    </i></b></font><b>Main</b>:
        <font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>, <font color="#800000"><b>1                             </b></font><font color="#0000FF"><b><i>' Clear LCD screen
        </i></b></font><b>String </b>= <b>EEstring1 </b>: <font color="#008000"><b>GOSUB </b></font><b>EEString2LCD   </b><font color="#0000FF"><b><i>' Display String1
        </i></b></font><font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>1000
        </b></font><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>$C0                            </b></font><font color="#0000FF"><b><i>' move cursor to Line2
        </i></b></font><b>String </b>= <b>EEstring2 </b>: <font color="#008000"><b>GOSUB </b></font><b>EEString2LCD   </b><font color="#0000FF"><b><i>' Display String2
        </i></b></font><font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>1000
    </b></font><font color="#008000"><b>GOTO </b></font><b>Main                                     </b><font color="#0000FF"><b><i>' Rinse &amp; Repeat
    
    '----[Display the specified EE string]--------------------------------------
    </i></b></font><b>EEString2LCD</b>:
        <b>Char </b>= <font color="#800000"><b>$FF                                </b></font><font color="#0000FF"><b><i>' Make sure Char &gt; 0 to start
        </i></b></font><b>Idx </b>= <font color="#800000"><b>0                                   </b></font><font color="#0000FF"><b><i>' start at beginning of string
        </i></b></font><font color="#008000"><b>WHILE </b></font><b>Char </b>&gt; <font color="#800000"><b>0                            </b></font><font color="#0000FF"><b><i>' do Null-terminated string
           </i></b></font><font color="#008000"><b>Read </b></font><b>String </b>+ <b>Idx</b>, <b>Char                </b><font color="#0000FF"><b><i>'    get the character 
           </i></b></font><font color="#008000"><b>IF </b></font><b>Char </b>&gt; <font color="#800000"><b>0 </b></font><font color="#008000"><b>THEN LCDOUT </b></font><b>Char           </b><font color="#0000FF"><b><i>'    display the character,If>0
           </i></b></font><b>Idx </b>= <b>Idx </b>+ <font color="#800000"><b>1                          </b></font><font color="#0000FF"><b><i>' point to next character
        </i></b></font><font color="#008000"><b>WEND
    RETURN
    
    </b></font>
    DT

  6. #6
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    sory Darrel,

    the one i do id for the LED matrix display. the data include happy face. letters....scrolling. for the alphabets i store in one data file , the happy face i do it in another data file.

    i.e. running_letter DATA $10,$10...$30..
    running_face DATA $30, $68....
    the label give out the error when compiled
    ------------------------

    for i = 0 to 3
    READ running_letter +i, temp ; tenp is temporary storage

    next i
    --------------------

    the pic is 16f628
    i could not find rhe ERRORLEVEL in the data sheet of that chip

    thank for your attention

    regards,

  7. #7
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    hello Darrel,

    i found where the problem comes from,
    that is bacause i left the DATA table at the end of the program. now i move to the beginning of the program , it works,

    thanks gain for your help
    MInh le

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 1

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