|
|
| 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 |
|
|
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 |
|
|
| 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: |
|
|
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: |
|
|
| 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: |
|
|
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: |
|
|
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
Vic |
|
| Back to top |
|
 |
|