View previous topic :: View next topic |
Author |
Message |
suibaf
Joined: 03 Oct 2004 Posts: 32 Location: Lecce
|
Posted: Wed May 21, 2014 10:45 am Post subject: str |
|
|
Hi, I'm testing with success this code:
Code: |
Dim Testint as integer
Dim Num_str As String * 10
Testint = 123
Num_str = Str(testint)
Lcd Num_str
Print Num_str
|
It work fine. But if i set Testint = 1234 then on LCD I don't see 1234 but a strange character followed by 234. Same thing with print Num_str.
Where I wrong?
Best Regards
(BASCOM-AVR version : 2.0.7.7 ) _________________ Bascom AVR full |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed May 21, 2014 10:54 am Post subject: |
|
|
you do not need to use str() when using lcd or print. a conversion is done automatic when printing a numeric variable.
but of course you can use str() as well. it is the same function.
you should post a complete sample that demonstrates the problem. the snipped alone looks ago but it can not be tested. _________________ Mark |
|
Back to top |
|
|
suibaf
Joined: 03 Oct 2004 Posts: 32 Location: Lecce
|
Posted: Wed May 21, 2014 11:58 am Post subject: |
|
|
Yes, I use LCD or Print only for debug.
The sample is not complete, but it can to be tested.
I want to make other test with only this code, because I tested it togheter other code.
Code: |
Dim Testint as integer
Dim Num_str As String * 10
Testint = 123
Num_str = Str(testint)
Print Num_str
|
_________________ Bascom AVR full |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Wed May 21, 2014 2:22 pm Post subject: |
|
|
I think found the solution
Try to use Cls on simulator to |
|
Back to top |
|
|
suibaf
Joined: 03 Oct 2004 Posts: 32 Location: Lecce
|
Posted: Wed May 21, 2014 5:47 pm Post subject: |
|
|
Thank you EDC for your response, but the problem is another. I have minimized the code and I have leave some important piece. It is hard to expalin.
The problem is that i had not understood very well the Str2digits function. Mr. Alberts help me another time with similar problem in this topic:
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12318&highlight=
Excuse me if I was not clear.
Thank you very much.
Best Regards _________________ Bascom AVR full |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Wed May 21, 2014 6:28 pm Post subject: |
|
|
When I never hear about Str2digits I write little program for decode from that egsample string :
$GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,,*75
only 4 Digits for clock with multiplexed LED 7seg Display
Each one char iits a byte 1,8,3,7 = 49,56,51,55
I simply remove -48 to see "clear"digit
Maybe that give You a clue
Only logged in users can see attached pics |
|
Back to top |
|
|
|