I am using my ARMexpress with a Matrix Orbital LCD2041 display. In
loading a custom display character into the LCD2041, I need to send it 254, 78,
1, 0, 0, 0, 0, 0, 0, 31, 31, 0. When I assemble the OUTstring with these
values, the ARMexpress refuses to send them, even when I give it an explicit
OutCnt of 11.
DIM OUTstring$(20)
OUTstring$ = chr(254) + chr(78) + chr(1) + chr(0) + chr(0) + chr(0) +
chr(0) + chr(0) + chr(0) + chr(31) + chr(31) + chr(0)
OutCnt = 11
I2COUT (DataPinLCD, ClkPinLCD, wraddrLCD, OutCnt, OUTstring$)
The new I2COUT routine seems to refuse to go beyond the first chr(0), even
with OutCnt = 11. The old I2COUT command works with no problem.
I found a workaround: the LCD2041 will accept chr(32) instead of chr(0) and
still load zeros into the bitmap. But I'd like to know if I have
misunderstood something or done something wrong. Is there a way to send such a
string?
Sincerely,
Don W.
Strings and 0
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Strings and 0
> OUTstring$ = chr(254) + chr(78) + chr(1) + chr(0) + chr(0) + chr(0) +
> chr(0) + chr(0) + chr(0) + chr(31) + chr(31) + chr(0)
> OutCnt = 11
> I2COUT (DataPinLCD, ClkPinLCD, wraddrLCD, OutCnt, OUTstring$)
>
> The new I2COUT routine seems to refuse to go beyond the first chr(0), even
> with OutCnt = 11. The old I2COUT command works with no problem.
Not sure what you mean about old and new I2COUT routine, it hasn't changed in
over a year.
But the string operation you are trying to do won't do what you want as the
string is terminated early by the chr(0). You have to do it by assigning array
elements as outlined in the help files
http://www.coridium.us/ARMhelp/scr/DtStringtype.html
> chr(0) + chr(0) + chr(0) + chr(31) + chr(31) + chr(0)
> OutCnt = 11
> I2COUT (DataPinLCD, ClkPinLCD, wraddrLCD, OutCnt, OUTstring$)
>
> The new I2COUT routine seems to refuse to go beyond the first chr(0), even
> with OutCnt = 11. The old I2COUT command works with no problem.
Not sure what you mean about old and new I2COUT routine, it hasn't changed in
over a year.
But the string operation you are trying to do won't do what you want as the
string is terminated early by the chr(0). You have to do it by assigning array
elements as outlined in the help files
http://www.coridium.us/ARMhelp/scr/DtStringtype.html
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Strings and 0
Bruce,
Thank you very much. That works very well. I thought I had tried it that
way last night, but it's entirely possible that I mis-numbered the array
elements (start at one instead of zero).
My previous ARMexpress from December 2007 contains ARMbasic Version
6-something. The unit I just bought has Version 7, so now I am having to port
my
program to Version 7
Thank you very much. That works very well. I thought I had tried it that
way last night, but it's entirely possible that I mis-numbered the array
elements (start at one instead of zero).
My previous ARMexpress from December 2007 contains ARMbasic Version
6-something. The unit I just bought has Version 7, so now I am having to port
my
program to Version 7
Re: Strings and 0
If you are using a string variable for storage of byte data for whatever reason,
be advised that issuing a blah="" does NOT clear the entire string's contents,
but rather just sets blah(0)=$00.
This may have been covered herein already, or in the docs, but I got bit by it
tonight.
Again, just sharing so that someone can hopefully not make the same mistaken
assumption...

-t
p.s. I just found http://www.iespell.com/. It's a pretty kewl little
spell-checker plug-in for IE. I am using IE8 and am having no issues with the
plug-in, thus far. L8R.
be advised that issuing a blah="" does NOT clear the entire string's contents,
but rather just sets blah(0)=$00.
This may have been covered herein already, or in the docs, but I got bit by it
tonight.
Again, just sharing so that someone can hopefully not make the same mistaken
assumption...
-t
p.s. I just found http://www.iespell.com/. It's a pretty kewl little
spell-checker plug-in for IE. I am using IE8 and am having no issues with the
plug-in, thus far. L8R.
Re: Strings and 0
Bruce,
Is there a way for user-code to know how long an arbitrary string has been
dimmed to? Due to my discovery of this 'feature' tonight, I want to add a small
lib sub to CLR_STR(BYREF STRING_VAR AS STRING).
My concern is that I don't know how to programmatically arrive at the dimmed
length of the string without passing it as a variable to the sub.
Is there any insight you can offer for this? Please advise.
Thanks!
-t
Is there a way for user-code to know how long an arbitrary string has been
dimmed to? Due to my discovery of this 'feature' tonight, I want to add a small
lib sub to CLR_STR(BYREF STRING_VAR AS STRING).
My concern is that I don't know how to programmatically arrive at the dimmed
length of the string without passing it as a variable to the sub.
Is there any insight you can offer for this? Please advise.
Thanks!
-t
Re: Strings and 0
> Is there a way for user-code to know how long an arbitrary string has been
dimmed to? Due to my discovery of this 'feature' tonight, I want to add a small
lib sub to CLR_STR(BYREF STRING_VAR AS STRING).
The feature is by design as STRING and BYTE ARRAY use the same definition.
String operations are always 0 terminated so
ASTR = "start" + chr(0) + "will be lost"
does not do what you want it to do, as the string operation terminates on the
chr(0).
So if you want to use string operations to fill byte arrays, then you have to
add the 0 characters later, the FREQOUT.bas library is an example of this.
ASTR = "start" + chr(1) + "will be added"
ASTR(5) = 0
> My concern is that I don't know how to programmatically arrive at the dimmed
length of the string without passing it as a variable to the sub.
You'll have to pass the length to the subroutine, or keep them all the same
length.
dimmed to? Due to my discovery of this 'feature' tonight, I want to add a small
lib sub to CLR_STR(BYREF STRING_VAR AS STRING).
The feature is by design as STRING and BYTE ARRAY use the same definition.
String operations are always 0 terminated so
ASTR = "start" + chr(0) + "will be lost"
does not do what you want it to do, as the string operation terminates on the
chr(0).
So if you want to use string operations to fill byte arrays, then you have to
add the 0 characters later, the FREQOUT.bas library is an example of this.
ASTR = "start" + chr(1) + "will be added"
ASTR(5) = 0
> My concern is that I don't know how to programmatically arrive at the dimmed
length of the string without passing it as a variable to the sub.
You'll have to pass the length to the subroutine, or keep them all the same
length.
Re: Strings and 0
> > My concern is that I don't know how to programmatically arrive
> > at the dimmed length of the string without passing it as a variable
> > to the sub.
>
> You'll have to pass the length to the subroutine, or keep them all
> the same length.
Understood. Last night as I was trying to fall asleep, I was noodling this
around in me noggin. I arrived at the same conclusion, and frankly, the use of
Preprocessor constants in keeping track of dim'd string lengths shouldn't be
difficult at all. It is probably a better programming practice, anyways.
Thank you for your time, kind sir. As always, you quick and informative
response is greatly appreciated.!.
Take care.
-t
> > at the dimmed length of the string without passing it as a variable
> > to the sub.
>
> You'll have to pass the length to the subroutine, or keep them all
> the same length.
Understood. Last night as I was trying to fall asleep, I was noodling this
around in me noggin. I arrived at the same conclusion, and frankly, the use of
Preprocessor constants in keeping track of dim'd string lengths shouldn't be
difficult at all. It is probably a better programming practice, anyways.
Thank you for your time, kind sir. As always, you quick and informative
response is greatly appreciated.!.
Take care.
-t
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Strings and 0
>from the help line
>It\'s no trouble using ASCII characters but I\'m trying to send a bit pattern
similar 0010 1010 0001 0000.
You can build up byte arrays with either string functions or array access.
dim spistuff(20) as string
spistuff(0) = 2
spistuff(1) = &Ha
spistuff(2) = 1
spistuff(3) = 0
...
Details at
http://www.coridium.us/ARMhelp/scr/DtStringtype.html
>It\'s no trouble using ASCII characters but I\'m trying to send a bit pattern
similar 0010 1010 0001 0000.
You can build up byte arrays with either string functions or array access.
dim spistuff(20) as string
spistuff(0) = 2
spistuff(1) = &Ha
spistuff(2) = 1
spistuff(3) = 0
...
Details at
http://www.coridium.us/ARMhelp/scr/DtStringtype.html