Hi Roland,
If you log serial data in hyperterm using the wrong baud you sometimes see the 
symbol you refer to...Try different baud?

When I was recently starting with nsbasic I had trouble with figuring out the 
.Read, but have had no trouble with the .OnRead function. Try this....

    objPort.BaudRate = 4800
    objPort.ComPort = 2
    objPort.Timeout = 2000 
    objPort.Enabled = True
    objPort.NoEvents = False
    objPort.EndTrigger = vbCR 'Note Some equipment only has CR not CRLF
    
Sub objPort_OnRead(Str)
On Error RESUME NEXT
If IsNull(str) Then
   Print "port timeout (no end trigger)"
Else
   str = Replace(str, Chr(10), "") 'clean string from the left over LF if using 
mixed CRLF terminators
   str = Replace(str, Chr(13), "") 'may as well clean string of any extra CR's 
just in case
   Print str
End If
If Err Then
    MsgBox "Runtime Error: " & Err.Number & "  " & Err.Description
    Err.Clear
End If
End Sub

If your data always ends in CRLF then use this as the endtrigger so you dont 
have to worry about doing a replace function on a null string and can cut the 
sub down to...

Sub objPort_OnRead(Str)
print str
end sub

If collecting loads of data fast always use 115200 baud if you can, when 
parsing use instr function to find the header then pass the string off to a 
function to perform more intensive parsing and calculations on the data while 
the next string comes in. (I think thats how it works, it gave me better 
results anyway)

Cheers,
Justin

--- In nsbasic...@yahoogroups.com, Rolando Mendoza <roland.mend...@...> wrote:
>
> Hi George,
> 
> I tried a different port number, and your suggestion worked. With the sample 
> serial port application in the samples\serialtools folder, I was able to open 
> a port, and write a string. I know the objPort.write statement worked because 
> it reflected the number of characters written.
> 
> However, the statement:
> str = objPort.Read(0, 5000) kept returning a square bullet character.
> 
> Any reason why the serial port is not reading the string thrown at it?
> 
> 
> Warmest Regards,
> 
> Roland
> 
> 
> 
> --- On Mon, 8/10/09, George Henne <g...@...> wrote:
> 
> From: George Henne <g...@...>
> Subject: Re: [nsbasic-ce] Cannot open the Comm Port
> To: "nsbasic...@yahoogroups.com" <nsbasic...@yahoogroups.com>
> Date: Monday, 10 August, 2009, 6:31 PM
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
>     
>                   Could the comPort be a different number?
> 
> 
> 
> >
> 
> >
> 
> >Hi,
> 
> >
> 
> >I downloaded the Franson Serial Tools to add printer support to my WinCE
> 
> >application, which runs on a Palm Treo 750. Using the serial number
> 
> >provided by NSBasic, I proceded to code as follows:
> 
> >
> 
> >AddObject "serialce.port. 1","objPort"
> 
> >AddObject "serialce.license" ,"objlicense"
> 
> >    
> 
> >objLicense. LicenseKey = "licence key provided by NSBasic"
> 
> >
> 
> >objPort.ComPort = 8
> 
> >objPort.Enabled = True
> 
> >
> 
> >PrintString = "Hello World"
> 
> >objPort.Write PrintString
> 
> >
> 
> >My problem is, whenever I execute the program on the PDA unit, the
> 
> >application gives a VBScript error which says that it cannot open the
> 
> >communication port despite installing the Franson runtime on the Treo.
> 
> >
> 
> >Please help! Any assistance provided to point me in the right direction
> 
> >will be greatly appreciated. Thank you.
> 
> >
> 
> >
> 
> >Roland
> 
> >
> 
> >How can I tell if my jewelry is real silver? 
> 
> >Find Out on Yahoo! Answers 
> 
> >
> 
> >
> 
> 
> 
> 
>  
> 
>       
> 
>     
>     
>       
>        
>       
>       
> 
> 
> 
> 
> 
> 
> 
> 
>       
> 
> 
>       
>       
> 
> 
>       New Email names for you! 
> Get the Email name you&#39;ve always wanted on the new @ymail and 
> @rocketmail. 
> Hurry before someone else does!
> http://mail.promotions.yahoo.com/newdomains/ph/
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to nsb-ce@googlegroups.com
To unsubscribe from this group, send email to 
nsb-ce+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to