Problem with LOOKUP command

thunderace7

New Member
Hi. I have encountered a problem with using the Lookup command. The manual states that: Each lookup is limited to 256 entries, but each entry may be a bit, byte or word constant or variable but if I try to use 256 entries I get an error message stating: Preprocessor has stopped responding - unknown error. By experimenting, I have discovered that I can avoid the error by reducing the Lookup to 96 entries but this is not what I want. I am using PICAXE Editor 6.1.0.0, Windows 10 and I find the same error for all Picaxe types that I have tried (08M2, 20M2, 28X2).
Is this a limitation of the Editor or can Picaxes only cope with 96 Lookup entries despite what the manual says?
Thanks.
 

thunderace7

New Member
I thought I would try it on an actual chip but I get the same error when I try to upload it. It is probably doing a syntax check before uploading.
 

Flenser

Senior Member
Looks like it could be some other line in your program that is too long for the precompiler.

When all I have is a single lookup command with 256 entries it verifies OK:
25661

But when I add a really long comment I can get the same "Preprocessor has stopped responding - unknown error" for even the simplest program:
25662


Do you have any really long comments in your program. If so try breaking them up into shorter lines, like this:
25663
 

Jack Burns

New Member
The best way to add your code is by pasting it inline, surrounded by CODE tags.

The following example shows how to do it, however the space needs to be removed on the first [code ] statement. This ensures the text which follows gets recognised as program code.

[code ]
; example code pasted here.
b1 = 0
[/code]
 

Flenser

Senior Member
The other thing is that this is a pre-processor error, not a compiler error.
The pre-processor reads the program, actions the pre-processor directives, which all start with the # character, like #define & #macro, and writes out a new copy of the program to a temporary directory that the compiler reads.
The pre-processor does not know anything about the PICAXE BASIC commands like LOOKUP and so your error is not because the LOOKUP command does not allow 256 entries. The compiler is never run to check your program so your LOOKUP command is never checked.
If you have not used any pre-proessor directives then you can test this by disabling the pre-processor in PE.
Goto File -> Options, click on the "Compiler" option, deselect "Use pre-processor", click OK and try Check Syntax again using a LOOKUP command with 256 entries.
Here is my "b2=b1+1" program where I got the pre-processor error above when I have disabled the pre-processor in PE:
25667
 

thunderace7

New Member
This is the code that fails:

Code:
;lightning cloud v1.0
;for picaxe-08m2
;chris landscheit feb 2023

initialise:                                    ; set up ports, variables and processor speed
    #picaxe 08m2                            ; define picaxe chip for compiler
    setfreq m4                                ; select internal resonator 4MHz  (for accurate timing)
    symbol stepsequence=b20                        ; define stepsequence variable
    symbol outputsequence=b21                    ; define outputsequence variable
    symbol setspeed=b22                        ; define setspeed variable
    let dirsc=%11111111                        ; set port c as outputs (only c.0, c.1, c.2, c.4 used)


main:
    let setspeed=1                            ; set speed variable (to be changed as required)
    
    
sequence1:

    for stepsequence=0 to 255
        lookup stepsequence,(%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111),outputsequence    ; select sequence
        let pinsc=outputsequence                    ; output to leds (pins c.0, c.1, c.2, c.4)
        pause setspeed                            ; pause to adjust speed
    next stepsequence                                ; next step
    
    pause 5000                                    ; delay until next sequence
    

    goto sequence1                                ; loop back and repeat
It is only a partial program, ideally I would have 4 or 5 of the Lookup commands (depending on how many I can fit in the memory).
 

Buzby

Senior Member
The problem is definately due to the physical length of the lookup, not the logical length. The Pre-Processor just can't handle it.

eg. "lookup b0,(%11111111,%00000000),b1" is physically longer than "lookup b0,(255,0),b1" even though both are logically the same.

Your code compiles OK if the Pre-Processor is turned off.

Obviously there is a problem with the Pre-Processor, but don't hold your breath waiting for a fix !

PE6_Preprocesssor.JPG
 

Technical

Technical Support
Staff member
for stepsequence=0 to 255
dummyvariable = stepsequence and 1
lookup dummyvariable ,(%00000000,%111111111),outputsequence ; select sequence

The preprocessor error is that the line is simply far too many characters in a single line, it doesn't need to be that long (as you only have two output options).
 

Buzby

Senior Member
It seems like the lookup line is too long for the pre-processor, but not too long for the compiler.

This looks like a an incompatability between two halves of the same system. There should be no error caused by any logical construct that the complier can accept.

The OP posted a line that he wants to configure with any combination of bytes, upto a maximum of 256, not just a repeating two-byte pattern. There should be no penalty if he chooses to specify bytes in binary format.

It's a bug in the pre-processor !
 

Flenser

Senior Member
It's a bug in the pre-processor !
It's pretty common for programs to have a limit on the line lengths so I'd call this a feature, not a bug.
At worst it is an undocumented feature.

ideally I would have 4 or 5 of the Lookup commands (depending on how many I can fit in the memory).
If all your lookup commands will have repeating values like your first one then Technical's code will use the least space, leaving lots of free space for the rest of your program.
If your other lookup commands will have a more complicated set of values or you would like to include the full set of values to make it easier to understand your code then I suggest using decimal values.
The version below of your first lookup is under the pre-compiler line length maximum and takes 280 bytes of program memory:
Code:
lookup stepsequence,(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255),outputsequence       ; select sequence
However, depending on what the values are, listing all the repeated values could still cause you problems.
This lookup with 255 for every value is too long again:
Code:
lookup stepsequence,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),outputsequence       ; select sequence
 

Buzby

Senior Member
I agree about some programmes having line length limits, but I think it's not acceptable in this case to impose limits that are incompatible with the compiler. As to calling it an undocumented feature, thats putting a bit of spin on it !.

More concerning is that when the pre-processor can't handle a line it throws up an 'unknown error' response. Surely the modern code suite that PE6 is supposedly built on can inform the programmer exactly why a text function can't complete. The programmer may have to call another function to determine the relevant words to display, but that's what always should be done if the error is to be reported to a user.
 

thunderace7

New Member
The Lookup lines will eventually contain many different numbers reflecting the patterns I eventually decide on. I have used the repeating ones to flash the leds on and off so that I can determine the speed it runs at and set this by changing the delay value.
It was mentioned that the code compiles ok if the pre-processor is turned off. Can I run it without the pre-processor and if so how do I do it?
 

Technical

Technical Support
Staff member
Very long lines are not recommended, in any programming language, mainly because they are very awkward for the human programmer to use.

If you really want to use huge lookup tables simply use the line extension (space underscore newline) instead.
This splits the very long line into manageable chunks, both the preprocessor and compiler will still regard the code as a single line.

However table/readtable or eeprom/read or similar would still probably be a better solution to this type of problem.

Code:
        lookup stepsequence,(%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
       %00000000,%11111111),outputsequence    ; select sequence
 

Buzby

Senior Member
I agree that a 'data / eeprom' type of solution is better in this case, but in some cases a long line is essential.

A programme I wrote a few years ago used a lookup with lots of variables that changed values before each time the lookup was called. This code was a nightmare to debug, but I couldn't have done it at all with a 'data / eeprom' structure as these are effectively constants. ( Unless you put a lot more code in to change the values. )

The line extension character '_' is very useful in some cases, but it still does not let you make lines any longer than the system can handle.
( An example of usefulness was a matrix display 16x16. The ability to split a long line into chunks of 16 made coding easier. )
Maybe the '_' character would be better called a line split !.

This still does not get round the problem with the pre-processor. PE5, and PE6 without the PP, both accept the long line. If the compilers can handle long lines, why does the PP give up and say 'unknown error' ?

As I said before, the modern programming environment that is used to build PE6 should give the end user a better description, not just 'unkown error'.
 

papaof2

Senior Member
The line in question is over 2600 characters long. I'm not aware of many programming tools that can handle a single line that long. Some can handle that many characters in a command but they use a line continuation character so the component lines lines are much shorter.

Replacing %00000000 with 0 and %11111111 with 255 trims that line to fewer than 900 characters and it compiles just fine (PICAXE 6.1.0.0).

Code:
;lightning cloud v1.0
;for picaxe-08m2
;chris landscheit feb 2023

initialise:                                    ; set up ports, variables and processor speed
    #picaxe 08m2                            ; define picaxe chip for compiler
    setfreq m4                                ; select internal resonator 4MHz  (for accurate timing)
    symbol stepsequence=b20                        ; define stepsequence variable
    symbol outputsequence=b21                    ; define outputsequence variable
    symbol setspeed=b22                        ; define setspeed variable
    let dirsc=255                        ; set port c as outputs (only c.0, c.1, c.2, c.4 used)


main:
    let setspeed=1                            ; set speed variable (to be changed as required)
    
    
sequence1:

    for stepsequence=0 to 255
        lookup stepsequence,(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255),outputsequence    ; select sequence
        let pinsc=outputsequence                    ; output to leds (pins c.0, c.1, c.2, c.4)
        pause setspeed                            ; pause to adjust speed
    next stepsequence                                ; next step
    
    pause 5000                                    ; delay until next sequence
    

    goto sequence1                                ; loop back and repeat
 

papaof2

Senior Member
PE6 is happy with that line if you use the continuation character "_" to split it into reasonable line lengths. For this old guy who learned to program on character-based terminals, "reasonable line length" is one line across the screen. With PE6's default configuration, it looks like this: Both versions compile to 304 bytes.

Code:
;lightning cloud v1.0
;for picaxe-08m2
;chris landscheit feb 2023

initialise:                                    ; set up ports, variables and processor speed
    #picaxe 08m2                            ; define picaxe chip for compiler
    setfreq m4                                ; select internal resonator 4MHz  (for accurate timing)
    symbol stepsequence=b20                        ; define stepsequence variable
    symbol outputsequence=b21                    ; define outputsequence variable
    symbol setspeed=b22                        ; define setspeed variable
    let dirsc=255                        ; set port c as outputs (only c.0, c.1, c.2, c.4 used)


main:
    let setspeed=1                            ; set speed variable (to be changed as required)
   
   
sequence1:

    for stepsequence=0 to 255
        lookup stepsequence,(%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,_
      %11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,_
      %00000000,%11111111,%00000000,%11111111,%00000000,%11111111),outputsequence    ; select sequence
        let pinsc=outputsequence                    ; output to leds (pins c.0, c.1, c.2, c.4)
        pause setspeed                            ; pause to adjust speed
    next stepsequence                                ; next step
   
    pause 5000                                    ; delay until next sequence
   

    goto sequence1                                ; loop back and repeat
 

Flenser

Senior Member
Can I run it without the pre-processor and if so how do I do it?
You don't use any pre-processor commands in your code so you can run your program without it.

In PE go to File -> Options, click on the "Compiler" option, deselect "Use pre-processor", click OK and try Check Syntax again. Buzby has posted a screen shot in Post #9 showing you the pre-compiler deselected.
 
Last edited:

Flenser

Senior Member
However table/readtable or eeprom/read or similar would still probably be a better solution
Technical,

Storing the lookups as table or eeprom data won't provide enough storage as thunderace7 would like "4 or 5 of the Lookup commands (depending on how many I can fit in the memory)"
From the manual:
All current PICAXE chips have 256 bytes (address 0-255) of EEPROM memory
and for TABLE:
M2 parts have 512 locations (0-511).
X1 and X2 parts have 256 locations (0-255).

You suggestion of using the line continuation character in post #15 looks like the only approach that will allow thunderace7 to include multiple lookup commands in his program that are each 256 values long and "contain many different numbers reflecting the patterns I eventually decide on" as he describes in post #14
 

Aries

New Member
Otherwise, you could split the lookup into several pieces - as I had to do with this code (reduced in size to show the point, the .... are where there are more items). In my case, the problem was that originally there were more than 256 items in the list.
Code:
if w11 < w14 then
lookup w11,(84,105,164,207,10,$8610,0,ConsoleRange1,10,$8610,20,ConsoleRange2, .... ),w20
else
w17 = w11 - w14
lookup w17,(Address_Template,0,0,%00001111,0,%00000001,Address_Template,20,0,%00001111,0,%01000000,Address_SP,CurrentButtonDefNumber,ConsoleRange1,%00100100,1,%01001000, ...),w20
endif
 

thunderace7

New Member
I hadn't realised it was such a long line until I pasted it into the forum message. The editor line wraps it to look like a normal line.
Using decimal numbers would be difficult as the binary 1s represent lit leds and decimal numbers are difficult to visualise.
The manual states that 256 entries are possible with no restriction of number base.
I've never seen anything in the manuals that suggest a maximum line length.
I am currently compiling it successfully with 96 entries. I could use many multiples of this but i shall try switching off the pre-processor and see how I get on.
Thank you for all your replies.
 

Buzby

Senior Member
I must apologise for my mistake.

Using the '_' character to split long lines actually does allow the code to compile when using the pre-processor !.
This is not what I expected, as I thought the '_' was just a means of display formatting, but it does seem to have more of an effect than that.

Still, this is not what should be needed, and the error message should explain the issue better.
 

Flenser

Senior Member
I am currently compiling it successfully with 96 entries.
You have not understood Technical's code in post #15. You can create create LOOKUP commands with 256 binary constants.

With Technical's version of the 256 entry LOOKUP command from post #15 pasted in to replace your orginal LOOKUP command, your code from post #8 becomes this below which has 256 entries and does not generate any errors.
Code:
;lightning cloud v1.0
;for picaxe-08m2
;chris landscheit feb 2023

initialise:                                    ; set up ports, variables and processor speed
    #picaxe 08m2                            ; define picaxe chip for compiler
    setfreq m4                                ; select internal resonator 4MHz  (for accurate timing)
    symbol stepsequence=b20                        ; define stepsequence variable
    symbol outputsequence=b21                    ; define outputsequence variable
    symbol setspeed=b22                        ; define setspeed variable
    let dirsc=%11111111                        ; set port c as outputs (only c.0, c.1, c.2, c.4 used)

main:
    let setspeed=1                            ; set speed variable (to be changed as required)
    
sequence1:
    for stepsequence=0 to 255
        lookup stepsequence,(%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
 %00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111,%00000000,%11111111, _
%00000000,%11111111),outputsequence    ; select sequence
        let pinsc=outputsequence                    ; output to leds (pins c.0, c.1, c.2, c.4)
        pause setspeed                            ; pause to adjust speed
    next stepsequence                                ; next step
    
    pause 5000                                    ; delay until next sequence
    
    goto sequence1                                ; loop back and repeat
 

Buzby

Senior Member
The line continuation is actually 'space,underscore' ie, ' _', with nothing after that.

Make sure you have the 'space' there. ( Most times it follows the ',' which separates list items. See post #24)
 

Flenser

Senior Member
I did try Technical's method but I get an Unknown Symbol error on Syntax Check.
OK. That means you have successfully solved the original problem with the "Preprocessor has stopped responding" error and your code is now being checked by the compiler. This is a different error that has nothing to do with the original "Preprocessor has stopped responding" problem so it needs to be investigated separately.

When I copy Technical's code from post #15 into PE it compiles without error. When I copy your program from post #8 into PE and replace your LOOKUP command with Technical's code from post #15 it compiles without error. So I'm guessing that this could be a typo that has crept in with your cut-and-paste.

To get you going try copying my code from post #24 into PE.
If this compiles without error for you then when you want to add a new LOOKUP command you can just copy and paste the lines for the existing LOOKUP that compiles OK and then edit the values.

I recommend that in future when you need help with any error, like this new "Unknown Symbol" one, you always post the code and the error message. The forum members can then paste the code with the problem into PE to reproduce the error and any suggested fixes you get back will be ones that worked for the person recommending it.

If you only post the error message then we can only offer guesses as to what might be causing the problem. Sometimes this works but sometimes it doesn't.
 

thunderace7

New Member
Project now finished successfully. Thank you all for your assistance.
When I entered the actual numbers into the lookup line, I saw there were large groups of %00000000s so I deleted them, split the lookup into 2 lines with a pause command between them. This brought the line length down to something PE could cope with.
I have learnt that the pre-processor can be turned off (but will probably not ever need to again). I couldn't get the underscore line continuation to work but I expect I was doing something wrong. I might try again now that the time pressure is off.
 
Top