Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
'Super Com Z" Com Support Routines "Port parameter

 
Post new topic   Reply to topic    Forum Index -> Files
Author Message
zbasicandy



Joined: 26 Jan 2006
Posts: 193

Posted: 04 April 2006, 1:56 AM    Post subject: 'Super Com Z" Com Support Routines "Port parameter Reply with quote

These "beta" routines should work for general serial communications using 1 to 4 serial I/O ports. Due to the complex nature of these routines they are subject to change on the minute!


ComSupport_R4.bas
 Description:
Com Support routines for the "Super Comm Z" with 4 serial ports.

Download
 Filename:  ComSupport_R4.bas
 Filesize:  28.49 KB
 Downloaded:  3356 Time(s)

Back to top
stevech



Joined: 23 Feb 2006
Posts: 656

Posted: 04 April 2006, 19:56 PM    Post subject: Reply with quote

(I've never used BasicX)

Are the unusal codings for PutL and Put floats etc. as they are because of BasicX compatibility?

ZBasic would not need all this arcane code.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2493
Location: Portland, OR

Posted: 04 April 2006, 20:58 PM    Post subject: Reply with quote

I would suggest the alternate implementations below. Something similar could be used for outputting Single values unless the required format can't be produced by CStr() or Fmt().

Code:
Public Sub PutStr(ByVal port as Byte, ByRef Tx as STRING)
   ' Outputs a STRING type to serial port n.

   Dim Length as Integer
   Dim I as Integer

   Length = Len(Tx)
   For I = 1 To Length
      Call PutByte(port, Asc(Tx, I))
   Next I
End Sub

Public Sub PutL(ByVal port as Byte, ByVal Operand as Long)
   Dim s as BoundedString(11)
   s = CStr(Operand)
   Call PutStr(port, s)
End Sub

Public Sub PutUL(ByVal port as Byte, ByVal Operand as UnsignedLong)
   Dim s as BoundedString(10)
   s = CStr(Operand)
   Call PutStr(port, s)
End Sub

Except for the use of the second parameter on the Asc() function and the syntax for defining the bounded string, the same coding would work for BasicX. An alternate method for fetching string characters in BasicX is:
Code:
      Call PutByte(port, RamPeek(MemAddress(Tx) + I + 1))
Back to top
stevech



Joined: 23 Feb 2006
Posts: 656

Posted: 05 April 2006, 2:27 AM    Post subject: Reply with quote

Code:
Public Sub PutL(ByVal port as Byte, ByVal Operand as Long)
   Dim s as BoundedString(11)
   s = CStr(Operand)
   Call PutStr(port, s)
End Sub


would be useful as a sub if it saved code space, rather than just coding in-line in the application:

call PutStr(port, CStr(number)) // dynamic string allocation in ZBasic

which with the VM, is probably not significantly different, esp. considering that it uses less call/return/parameter passing stack.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2493
Location: Portland, OR

Posted: 05 April 2006, 2:48 AM    Post subject: Reply with quote

Code:
Call PutStr(port, CStr(number))


You are correct that this consumes less stack space than allocating the bounded string. I should have made that reduction, too.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> Files Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group