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
Odd debug.print behavior

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



Joined: 02 Jun 2009
Posts: 30
Location: Moholm Sweden

Posted: 15 October 2009, 21:20 PM    Post subject: Odd debug.print behavior Reply with quote

Hi!
Code below works fine but after a minut or so the in buffer stops recieving data ! After trial and terror I found out that if I remove the debug.print "Waiting.." everything works as expected. I think I've read somewhere that debug.print don't effect buffer but in this case it's seems that it does. Anyone have an idea why? It's quite a challenge to find errors in programs if debug.print give you errors.




Code:

'**********************************************
'****** Task called from Sub Main           ***
'****** to check if touch screen pressed ******
'**********************************************

Public Sub CheckLCDTouch_TouchResponse()
Dim tmpResponse As String
Dim tmpCommand As String
TouchRespons  = " "
Do

Call ClearQueue((CByteArray(InBuf(1, LCD_touch).DataAddress)))

tmpCommand="K"

Call PrintText_TouchLCD(tmpCommand)' sending a 'K' tells Display to response on touch

tmpResponse = GetQueueStr((CByteArray(InBuf(1, LCD_touch).DataAddress)))
TouchRespons = mid(tmpResponse,4,1) '# or number according to touched button

Select Case TouchRespons
Case "#"'do nothing

Case "1"
Debug.print "Row 1 hit"

Sub_LCDTouch_Menu(TouchRespons)
Case "2"
Debug.print "Row 2 hit"

Sub_LCDTouch_Menu(TouchRespons)
Case "3"
Debug.print "Row 3 hit"

Sub_LCDTouch_Menu(TouchRespons)
Case "4"
Debug.print "Row 4 hit"
'back to Main menu
SubMenu = False
Main_LCDTouch_Menu


Case Else 'error,do nothing
Exit Do
End Select

'debug.print  "Waiting..."
Call Sleep(0.1)
Loop
End Sub



Regards Hucke
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 16 October 2009, 1:59 AM    Post subject: Reply with quote

This kind of thing has happened infrequently in the past. They can be difficult to debug but it is good you have found a recreation scenario. Does it fail for a ZVM or native device (or both)?

This type of error usually occurs because of a translation problem in the ZBasic compiler. If I know Don, he is busy investigating the error and coming up with a fix.
Back to top
dkinzer
Site Admin


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

Posted: 16 October 2009, 2:37 AM    Post subject: Re: Odd debug.print behavior Reply with quote

hakha4 wrote:
Code below works fine but after a minut or so the in buffer stops recieving data !
The code that you posted doesn't compile, of course, since it's missing some data definitions at the least. It helps a lot if you can provide a complete test case that is as small as possible and still exhibits the symptom. Lacking that, you can send me the complete application (source code and .pjt file) along with some information about what external devices are connected.
Back to top
hakha4



Joined: 02 Jun 2009
Posts: 30
Location: Moholm Sweden

Posted: 18 October 2009, 12:12 PM    Post subject: Reply with quote

To answer Mike's question,I'm not using native . Tested several times and debug.print did have the effect I described abowe but after making some modifications to the project I can't reproduce the error anymore! and I can't remember exactly the code that caused the error (should have made a copy!) so it must have been a special combination of code causing this.
Regards Hucke
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