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
Question concerning Com3

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 27 February 2006, 12:16 PM    Post subject: Question concerning Com3 Reply with quote

Consider this code:
Code:

Public Sub OpenCom3(ByVal Baud as Long)

   Call DefineCom(3, RXD, TXD, &H08)         'define com3
   CALL OpenQueue(rxq3, SizeOf(rxq3))      'receive queue
   CALL OpenQueue(txq3, SizeOf(txq3))      'transmit queue
   CALL OpenCom(3, Baud, rxq3, txq3)         'open it
   Call Delay(1.0)                     'wait a sec
End Sub


I added the Delay call after experiencing a problem when trying to use Com3. Immediately after calling OpenCom3, My initialization routine places a hello message to a LCD on Com3. When the program is compiled and downloaded to the ZX-24 the hello message always displayed properly. However, when I power the processor off and then back on, the message never displayed properly again. Since the message does get displayed properly at first, I began to consider that the problem was most likely in some Com3 routine. I took a look at OpenCom3. While it seemed to comply with what is in the SysLib about using Comx stuff I thought the perhaps the routine needed a bit of time to get organized so I added the delay call. This has cured the problem and the hello message appears every time the processor is powered up.

Could someone explain what is going on? Why did the delay routine seem to cure the problem?

Any enlightenment will be appreciated.

Vic
Back to top
pdubinsky



Joined: 25 Nov 2005
Posts: 66
Location: South Carolina

Posted: 27 February 2006, 12:44 PM    Post subject: Re: Question concerning Com3 Reply with quote

victorf wrote:
...>
I added the Delay call after experiencing a problem when trying to use Com3. <...>
Could someone explain what is going on? Why did the delay routine seem to cure the problem?


I've had this problem (though I haven't needed that long a delay) and I think that the problem is caused by the initialization of the PIC in the LCD subsystem serial backpack. I would guess that the ZX-24 gets up and running way before the serial backpack's processoer.

Paul
Back to top
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 27 February 2006, 14:06 PM    Post subject: Reply with quote

Paul,

You are probably correct here. I never thought about that. I am using an LCD from Seetron - BPP-420 I think - that I had in the "junk" box.

How long of a delay did you need to get a reliable startup?

Vic
Back to top
pdubinsky



Joined: 25 Nov 2005
Posts: 66
Location: South Carolina

Posted: 27 February 2006, 15:09 PM    Post subject: Reply with quote

victorf wrote:
<...>
How long of a delay did you need to get a reliable startup?

Vic


I think .5 secs but the ole memory seems to find new and original pathways as I get older.

Since you're only talking about power up you probably shouldn't fine tune this too much. Really, what's the difference in "user experience" if you reduce from 1 sec which works and .5 sec which may be marginal? You can always put a warning in the user docs, ie, "Start up will be delayed approximately .5 seconds. You may want to get lunch while you wait". Or something like that. <gg>.

Paul
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 665

Posted: 27 February 2006, 17:49 PM    Post subject: Reply with quote

I always place a 1 second delay. More than that gets annoying, less than that might work, but I use the a delay that is just beginning to be noticeable to the user.

Also, I do the initializations of stuff going to external devices before internal initializations in case it makes a difference.

These LCD serial controllers seem to take quite a while to boot up. 1 second seems like a good waiting time.

-Tony
Back to top
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 27 February 2006, 19:12 PM    Post subject: Reply with quote

I was just testing this and found reliabiliy seemed to reach down to 0.25 sec. However, I must agree with everyone that 1 sec is not too egregious so I'll leave it at that.

I appreciate your responses. Thanks Exclamation

Vic
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language 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