Menu

Endless compile

2011-06-06
2013-05-30
  • Nobody/Anonymous

    Trying to compile the program below but the compiler never seems to end.
    According to Task Manager it's using half the available processor time - presumably the whole of one core.

    If I prune a few of the phrases, then it compiles OK - but as it stands it never finishes. Is it ever going to, or is there some page-boundary issue I've not dealt with or some other mistake? I was rather hoping to add quite a few more phrases - is this likely to be possible with this chip, or would I have to migrate to the 18F series?

    Thanks - Skipweasel.

    ;Chip Settings
    #chip 16F876A,4
    #config OSC=HS
    ;Defines (Constants)
    #define LCD_IO 4
    #define LCD_RS PORTA.2
    #define LCD_Enable PORTA.3
    #define LCD_DB4 PORTC.4
    #define LCD_DB5 PORTC.5
    #define LCD_DB6 PORTC.6
    #define LCD_DB7 PORTC.7
    #define LCD_NO_RW 
    Dir PORTA.0 In
    Do Forever
        port b = random
        wait random ms
        if porta.0 = 1 then
            lcd_int
        end if
    Loop
    Sub lcd_int
        regenerate:
        Select case random
        case 1
        CLS
        Print "Aliens- run away"
        case 2
        CLS
        Print "Tidy away socks"
        case 3
        CLS
        Print "The pants attack"
        Case 4
        CLS
        Print "Smells of fish"
        case 5
        CLS
        Print "Eat fruit"
        case 6
        CLS
        Print "Destroy enemies"
        case 7
        CLS
        Print "Engine not start"
        case 8
        CLS
        Print "Too many sloths"
        case 9
        CLS
        Print "Out of cheese"
        case 10
        CLS
        Print "Error - unknown"
        case 11
        CLS
        Print "Energy low"
        case 12
        CLS
        Print "Purple is green"
        case 13
        CLS
        Print "Elephant storm"
        case 14
        CLS
        Print "Fuel low"
        case 15
        CLS
        Print "Six ways to hell"
        case 16
        CLS
        Print "On a mission"
        case 17
        CLS
        Print "Short circuit"
        case 18
        CLS
        Print "Beware - ducks"
        case 19
        CLS
        Print "FISH is not a"
        locate 1,0
        Print "valid integer"
        case 20
        CLS
        Print "Beer overflow"
        case 21
        CLS
        Print "Sixpennny bust"
        case 22
        CLS
        Print "Regenerator"
        locate 1,0
        Print "clogged"
        case 23
        CLS
        Print "Three gone"
        case 24
        CLS
        Print "Duff clone error"
        case 25
        CLS
        Print "Sock check fault"
        case 26
        CLS
        Print "Dire warning"
        case 27
        CLS
        Print "Footling coming"
        case 28
        CLS
        Print "End of world"
        case 29
        CLS
        Print "Start of world"
        case 30
        CLS
        Print "No clean pants"
        case 31
        CLS
        Print "Reuse teeshirt"
        case 32
        CLS
        Print "Wake up now"
        case 33
        CLS
        Print "Detect mammals"
        case 34
        CLS
        Print "Unused beer in"
        locate 1,0
        Print "cellar"
        case 35
        CLS
        Print "Cellar flooded"
        case 36
        CLS
        Print "Toes fighting"
        locate 1,0
        Print "on lower deck"
        case 37
        CLS
        Print "GOODBYE WORLD"
        case 38
        CLS
        Print "Nanobots corrupt"
        case 39
        CLS
        Print "Error nonlinear"
        locate 1,0
        Print "linearity"
        case 40
        CLS
        Print "Case not found"
        case 41
        CLS
        Print "Non-specific"
        locate 1,0
        Print "error"
        case 42
        CLS
        Print "Warning, towel"
        locate 1,0
        Print "velocity known"
        case 43
        CLS
        Print "Universe out"
        locate 1,0
        Print "of synch error"
        case 44
        CLS
        Print "Lawyers detected"
        case 45
        CLS
        Print "Unmatched socks"
        case 46
        CLS
        Print "Error: Unkown"
        locate 1,0
        Print "universe"
        case 47
        CLS
        Print "General reality"
        locate 1,0
        Print "dislocation"
        case 48
        CLS
        Print "Fart attack"
        case 49
        CLS
        Print "Meep - Meep - "
        locate 1,1 Meep - Meep -"
        case 50
        Print "Brain-fart in"
        locate 1,0
        Print "in progress"
        case else
        goto regenerate
        end select
    End Sub
    
     
  • Mauried

    Mauried - 2011-06-06

    At a guess the program is too big to fit in 1 code page , and in the 16F type chips
    program code cant cross a page boundary, so the compiler is getting lost trying to do something it cant.
    You need to break the program into smaller pieces, ie instead one 1 large subroutine
    make several small sub routines that do the same thing.
    The 16F876 has 4 pages of 2048 words each, so no sub can be bigger than 2048 words.

    Or use a chip with linear memory like the 18F type.

     
  • Nobody/Anonymous

    Ah - that makes sense, thanks.

    Would a data-table cross the boundary OK? Not that I'm against breaking it up into chunks, but it might be a more elegant solution.

     
  • kent_twt4

    kent_twt4 - 2011-06-07

    Print "Does not parse"

    Take a look at this line for a typo:

    locate 1,1 Meep - Meep -"
    

    Also look to the compile.lst file for indications on page boundary.  Main and subs well within first page, and string tables starting off at ORG 2048, so plenty of room (approx. half full), before splitting up?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.