BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Mon Oct 22, 2018 1:57 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: SERIN\SEROUT STRINGS
PostPosted: Thu Mar 05, 2015 8:18 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO:I am stuck!! Can someone explain to me(and maybe some code ) how to receive a string of random characters,then serial out to display the exact characters??? I have a nano 8,using the basic micro terminal 1. Here is my code,I get a fast flash of junk on the scree...Thank you...



PAUSE 2000
MY_DAT VAR BYTE(5)
'MY_DAT = 0


MAIN:
SERIN S_IN,I9600,[STR MY_DAT\5\13]
PAUSE 1000
SEROUT S_OUT,I9600,[STR MY_DAT,13]
GOTO MAIN


Attachments:
CELL_TEST.bas [332 Bytes]
Downloaded 267 times
Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Fri Mar 06, 2015 4:08 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
You have to do the output = SEROUT S_OUT,IE9600,[ str MY_DAT\5,13] The baud rate should be IE9600.


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Fri Mar 06, 2015 7:54 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO: Thanks for the fast reply...The baud rate did not have any effect.I think I need to flush my variable (MY_DAT),I tried a few different ways...If I type four characters,it works great,If I type three or less,I get the new characters plus what ever was left from the last value.For example I type 1234, I get 1234,then I type 123,I get 123,the next line down I get 4...Any ideas what is going on???

PAUSE 5000
MY_DAT VAR BYTE(5)



MAIN:
SERIN S_IN,I9600,[STR MY_DAT\5\13]
PAUSE 1000
SEROUT S_OUT,I9600,[STR MY_DAT\5,13]
MY_DAT = MY_DAT & 0XFFFFF
'MY_DAT(5) = 0
'MY_DAT(4) = 0
'MY_DAT(3) = 0
'MY_DAT(2) = 0
'MY_DAT(1) = 0
GOTO MAIN


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Fri Mar 06, 2015 9:04 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
I tried it again and this it is what I get back.

1234512345 <----- I typed 5 numbers and after the fifth it send back the 5 numbers back
123 <-------------------- end the numbers by typing carry return before the 4th number
123 <-------------------- got the numbers back

Tried to clear the variable by doing MY_DAT =" " this will clear the variable MY_DAT.


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Fri Mar 06, 2015 10:53 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO: The MY_DAT = " ",that's new,empty space i guess...I type this...
1234512345---same as you got---

123--(hit carry return)
123---returned this---
4-----next line this---

12--(hit carry return)
12----returned this---
45----next line this---

PAUSE 5000
MY_DAT VAR BYTE(5)


MAIN:
SERIN S_IN,I9600,[STR MY_DAT\5\13]
PAUSE 1000
SEROUT S_OUT,I9600,[STR MY_DAT\5,13]
MY_DAT = " "
GOTO MAIN

I have my echo turned off on terminal,no parity,no flow control,baud 9600
I tried your clear idea,still seems like bits left from first entered value????something with my computer???


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Fri Mar 06, 2015 11:39 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
I hit the CR after the print out and had the same results. It printed 45. So what I did it is zero the variable with 5 blanks character like this MY_ DAT = " " <---------- 5 blanks character Try it to see if it worked for you.


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Tue Mar 10, 2015 4:47 pm 
Offline
Citizen

Joined: Thu Feb 06, 2014 7:37 pm
Posts: 19
HELLO:tauro0221 you are a genius,it is now working...So it looks like i need to force blanks on my variable to the array depth...Thank you very much...would you mind to look at my other post(NANO WITH GPS),WHEN YOU HAVE TIME??? Thank you again.


Top
 Profile  
 
 Post subject: Re: SERIN\SEROUT STRINGS
PostPosted: Tue Mar 10, 2015 7:10 pm 
Offline
Master

Joined: Wed Oct 19, 2011 2:28 am
Posts: 123
Hi,
Your welcome. I will look into to see how you read the GPS and let you know the best way to read it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO