Can the PRINT command halt program execution??


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member Klr650's Avatar
    Join Date
    Jun 2013
    Posts
    20
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    457.47 MB

    0 Not allowed!

    Default Can the PRINT command halt program execution??

    This line in my program does what it says on the tin - it clears the screen then prints the value of a float variable ftemp
    to one decimal place.

    Cls:Print At 1,1, dec1 ftemp, " C"

    if I change the line to:

    Cls:Print At 1,1, sign,dec1 ftemp, " C" Where 'sign' is a one character string variable containing + or - .

    then the screen clears but nothing is printed and the program halts (the next line flashes an LED but it doesn't flash).

    Am I going bonkers??

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,309
    Thumbs Up
    Received: 28
    Given: 7
    Total Downloaded
    801.38 MB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    Hi,
    I doubt it makes any difference but I would have the CLS on a separate row.

    I think the issue is with the sign, how are you making it a + or -?
    Personally I would do something like
    Cls
    if sign = 1 then Print At 1,1, "+",dec1 ftemp, " C"
    else Print At 1,1, "-",dec1 ftemp, " C"

    Regards,
    Bob

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member Klr650's Avatar
    Join Date
    Jun 2013
    Posts
    20
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    457.47 MB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    Thanks for that Bob (2-stroke man!), your suggestion does work.

    This is worrying though - I find this programming lark hard enough as it is without coming across things like this. No warning from the compiler and the program just stops when you would think there is nothing wrong!

    Cheers.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,309
    Thumbs Up
    Received: 28
    Given: 7
    Total Downloaded
    801.38 MB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    Hi,
    If it is not too long post your code (or a small example) that shows the issue and I will take a look if I get the time.

    Regards,
    Bob

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,160
    Thumbs Up
    Received: 74
    Given: 173
    Total Downloaded
    5.06 GB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    FWIW there realy is little point in creating multiple statements on a single line. The compiler breaks them down to their component parts anyway so you're not saving any code space, just potentially confusing the compiler.

    C programmers do it show how clever they and to confuse everyone.
    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,443
    Thumbs Up
    Received: 71
    Given: 26
    Total Downloaded
    6.01 GB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    If `sign' is a variable then you can do the following: -

    sign = $2D ' This is for a `-' sign

    or

    sign = $2B ' This is for a `+' sign

    Then: -

    Cls
    Print At 1,1, sign , dec1 ftemp, " C"
    Regards

    Joseph

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Junior Member Klr650's Avatar
    Join Date
    Jun 2013
    Posts
    20
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    457.47 MB

    0 Not allowed!

    Default Re: Can the PRINT command halt program execution??

    Bob, this is the routine that I call when I want to take a reading from the DS1820 probe. This code was actually posted on here a couple of years ago and I have used it before without an issue but not in Proton 24 I think.

    Edit: I see that printing a string variable is the cause of the problem in my previous thread on an SD card too?!

    '-------------------------------------------------------------------
    DStemp:
    OWrite PORTB.5, 1, [$CC, $44] ' Start temperature conversion
    DelayMS 10
    While ORead PORTB.5, 4 = 0 :Wend 'Check for still busy convertin, wait here.


    OWrite PORTB.5, 1, [$CC, $BE] ' Read the Temperature


    ORead PORTB.5, 0, [DSTemperature.LowByte,DSTemperature.HighByte,temp, temp ,temp,temp,temp,temp]


    If DSTemperature.11 = 1 Then 'bit 11 to 15 if 1 it a negative number
    sign2 = "-" 'sign for two compliment number
    Else
    sign2 = "+" 'sign for
    EndIf


    ftemp = DSTemperature ' sign word var....
    ftemp = ftemp/16 'convert to float then divide by 16 to place decimal

    Return
    '-------------------------------------------------------------------
    Last edited by Klr650; 4th December 2018 at 18:25.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. [SOLVED !] serial input halting program execution
      By richardy in forum Proton Plus Compiler v3
      Replies: 1
      Last Post: 8th February 2010, 08:51
    2. Custom Print Command
      By wastrix in forum Proton Plus Compiler v3
      Replies: 4
      Last Post: 29th January 2010, 05:57
    3. how to program 18f4550 to print receipt
      By suzun in forum USB License key
      Replies: 1
      Last Post: 8th October 2009, 19:33
    4. [SOLVED !] Problems with the Print At y,x, command
      By kodiak in forum Proton Plus Compiler v3
      Replies: 27
      Last Post: 6th August 2007, 23:05

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts