Paul Lamar wrote:How do I get Option StriingSize to work
That option only affects certain types of string definitions. By default, all String variables are of the "allocated string" type. If you turn this off (
Option AllocStr Off) then Option StringSize tells how much data space should be set aside for each string defined. However, it would be unwise, even if it were possible, to set the default string size to 2000 characters.
Paul Lamar wrote:I want to send out a 1500 character string without CR or LF.
Note that String variables are limited to 255 characters maximum. See the
Fundamental Data Types table. However, that limitation doesn't prevent you from sending long sequences of characters out the serial port. How you might send a particular sequence depends on the source of the data for the character sequence. An example of what I think you wanted in your test case is shown below. Note that the semicolon at the end of the Debug.Print prevents a CR/LF from being sent.
Code: Select all
Sub Main()
Dim x as Integer
For x = 1 to 1000
Debug.Print "6, ";
Next x
End Sub
One of the challenges for people that are accustomed to writing applications for larger computers (mainframes, minicomputers, PCs) it to change the way they think about RAM use when writing a microcontroller application. On the larger computers, RAM can often be considered to be of (practically) infinite size. On a microcontroller, RAM should be considered a precious and severely limited commodity. This perspective will affect how you define your data elements and how you write the code for any particular use case.
Another possible solution is to add directly to the output queue the data that you want to send. If you were sending the data out a serial port other than Com1, you would be obliged to define and initialize the output queue and add the data directly to the queue (there is no Debug.Print equivalent for Com2). The input and output queues for Com1 are pre-defined and are not directly accessible but you can get access to the queues. The code below shows how to access the default output queue for Com1. This example code does exactly the same thing as the previous example; it just uses a different mechanism to accomplish the result.
Code: Select all
Dim defCom1Queue() as Byte Based Register.TxQueue
Sub Main()
Dim x as Integer
For x = 1 to 1000
Call PutQueueStr(defCom1Queue, "6, ")
Next x
End Sub
If the character sequence is more complex, you can expand on the idea of the previous example. In the example code below, the first one thousand integers are output with comma separation.
Code: Select all
Dim defCom1Queue() as Byte Based Register.TxQueue
Sub Main()
Dim x as Integer
For x = 1 to 1000
If (x > 1) Then
Call PutQueueByte(defCom1Queue, Asc(","))
End If
Call PutQueueStr(defCom1Queue, CStr(x))
Next x
End Sub