Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Serial Buffer

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2009, 11:13 AM
ceaser's Avatar
Basic4ppc Veteran
 
Join Date: May 2008
Location: Paarl, South Africa
Posts: 312
Default Serial Buffer

Hi

I have a problem

I have a routine to send a string to a Total Station to read the angles and distance to a prism. This then gets send back to the program where it is further processed. This works fine if there is no interruption of the beam between the Total Station and the prism. If I however turn the instrument to a different position and I instruct the program to send the Total Station a command again, but there is no prism, it gives me the results of my previous reading. I am using the command "Serial1.InputString"

I need to clear the contents in the Buffer

The program must keep on sending the command to the instrument, until I stop it or the instrument has picked up the prism.

I am attaching the routine that does the reading:

Sub ReadStation(R,R1)
ReadAgain:
HVD(1)=0 :HVD(2)=0 :HVD(3)=0 :f=0
If Main.DF(3)=1 Then
'Leica Total Station
suh(1)="21." :suh(2)="22." :suh(3)="31."
If Main.DF(4)>=3 Then ' tc500,tc1010,tc1610
If R="u" Then
stcm="GET/M/WI11/WI21/WI22/WI31"
Else If R="t" Then
stcm="GET//WI11/WI21/WI22"
If Main.DF(4)=3 OR Main.DF(4)=9 Then
Serial1.Output("SET/160/0" & EndLine)
End If
End If
Serial1.Output(stcm & EndLine)
Else
Serial1.Output(R & EndLine)
End If
A=Serial1.InputString
'If Main.DF(4)<>9 Then Serial1.Output("?" & EndLine)
End If
If StrLength(A)<10 Then Goto ReadAgain

'split the string up
Msgbox(A)
Do
f=f+1
A1=(StrIndexOf(A,suh(f),0))
If A1<>-1 Then
HVD(f)=SubString(A,A1+7,8)
If f=3 Then
'distance
HVD(f)=HVD(f)/1000
Else
'horizontal & vertical winkel
HVD(f)=HVD(f)/100000
End If
End If
Loop Until f=R1
End Sub

Thanks
Michael
Reply With Quote
  #2 (permalink)  
Old 01-09-2009, 01:36 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by ceaser View Post
I need to clear the contents in the Buffer
Which buffer? Isn't the instrument just resending its last good reading when you request it?
Reply With Quote
  #3 (permalink)  
Old 01-09-2009, 01:45 PM
ceaser's Avatar
Basic4ppc Veteran
 
Join Date: May 2008
Location: Paarl, South Africa
Posts: 312
Default

Hi Agraham

I think you are right. That is information still sitting at the instrument that is being resend. I will check what I did on the old program on the Workabout. Maybe send a code through to the instrument to clear the contents there once the good data has been recorded.

Thanks
Michael
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
TX buffer micro Questions (Windows Mobile) 4 09-15-2008 04:44 PM
Collect pieces of string in a buffer schimanski Questions (Windows Mobile) 1 08-17-2008 01:09 PM
serial Cor Questions (Windows Mobile) 1 01-18-2008 12:49 PM
serial i/o Softselect Questions (Windows Mobile) 1 07-24-2007 01:48 PM
Unbuffered Write / Buffer Flush davidmw Basic4ppc Wishlist 5 07-07-2007 10:26 PM


All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0