Long varible strings


Closed Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2006
    Posts
    2

    Default Long varible strings

    Hi Folks,
    edit: VariAble (sp)

    I have a situation that I need to SerOut a 300+ long string whenever the the command "UPD" is recieved. Not only is it very long string but it will vary depending on the A2D voltage and GPIO inputs. It will be using a 12F683, so ram, eeprom, and code space is at a premium. Using MASM is not a option.

    I have wriiten a sample code that is conceptually what I am thinking, but may not be perfect syntax wise. I am hoping to get positive input on whether this method will 1) do the job 2) at 9600 baud be fast enough as not to miss and "UPD" polls, and 3) is there a better way?

    Off hand, it looks like short eeprom stings combined with the long Lookup statement are going to be an issue. In the real program the eeprom string will be about this long but the Lookup command would be about 4 times longer. Also in the actual program, a method of suppliing a varible A2D reading will be needed when ever a 255 or 254 is seen. I would have liked to have used a variable to store eeprom 'lookup' data but the 12F683 just does not have the ram to spare.

    Thank you

    Code:
    -------------------------------------------------------------------- 
    DATA @1,  "Jack"
    DATA @5, "Tom"
    DATA @10,  "Jill"
    
    DATA @25, "jump"
    DATA @30, "ran"
    DATA @35, "walk"
    
    DATA @100, "hill"
    Data @104, "store"
    DATA @109, "well"
    
    DATA @150, "a"
    DATA @153, "the"
    DATA @156, "miles"
    DATA @161 "per hour"
    
    DATA @170, "to"
    DATA @172, "up"
    DATA @174, "under"
    DATA @179, "hyper-motovated"
    
    DATA @190, "ed"
    DATA @192, "ly"
    DATA @196, "ing"
    DATA @199, 13,10
    
    DATA @210, "."
    DATA @211, "?"
    DATA @212, "!"
    DATA @213, " "
    
    DATA @254, 254
    DATA @255, 255
    
    
    '12F683 has 128 Bytes of RAM, PBP uses 20 Bytes, Leaving 108 Bytes for varibles
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    main: SerIn2 RxPin,Mode,ParityFail, TO, TOFail,[WAIT("UP"), STR Request\1]
     
     if Request[0] = "D" then 
    	for UPDCounter = 0 to NumberOfStrings
    		Lookup UPDCounter,[1,213,35,190,213,255,213,156,213,172,213,150,213,100,213,179,212,199], Start
    		Lookup UPDCounter,[4,   1,  4,   2,  1,    1,    1,   5,   1,   2,  1,    1,    1,   4,   1,  15,  1,    2], Length	
    		'Jack walked  12.3 miles up a hill hyper-motovated! 
                    for Counter = Start to Length
    			read Counter,StringByte
    	                          if StringByte = 255
                                               Serout2,TxPin,Mode[dec MilesA2D]
                                           else
    			    SerOut2 TxPin,Mode,[StringByte]
                                           endif	
    		next Counter	
        next UPDCounter
    endif    	
    
    goto main
    endif
    --------------------------------------------------------------
    Last edited by flashg; - 14th October 2006 at 05:14.

Similar Threads

  1. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  2. LONG Data type
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th February 2009, 04:06
  3. Serial communication fails after long pause
    By brid0030 in forum General
    Replies: 4
    Last Post: - 13th February 2008, 18:56
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  5. I2CWRITE writing Strings to EEPROM
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th March 2005, 19:45

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