Shop OBEX P1 Docs P2 Docs Learn Events
little project ... - Page 5 — Parallax Forums

little project ...

1235789

Comments

  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 15:31
    but i have 1 problem ...
    if you see in the code . .the led that stands for the button .. will ight on when you push it
    with some buttons it does this .. wit h others you need to hold the button for some time .. and after that it will start burning . the only problem is that
    the prop.chip takes this as 2 or more pushes ..
    what can be the reason ?
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 15:36
    I also said you have 3 to 4 grave logical problems in your program code.
    It is difficult to see them, when the code is badly structured or
    not running at all (as the last version you posted)

    So please make all the suggested changes and post it again!
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 15:37
    pub memory
    
    dira[noparse][[/noparse]0..7] := 0
    dira[noparse][[/noparse]8..15] := 1
    
    
     
        w := 1
         
      repeat 17
          x := 0
          z := 0
          j := 0 
          repeat 17
            outputreg [noparse][[/noparse]x] := 0
            inputreg [noparse][[/noparse]x] := 0
            x := x + 1
          repeat w    
           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
            waitcnt(delay + cnt )
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
           'if outa[noparse][[/noparse]x]                    ' put pin X on 1 ( light op a led)
           '  outputreg [noparse][[/noparse]z] := x              ' to save what outpin has gone to 1
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
             
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                 'if ina[noparse][[/noparse]0] 
                 '  inputreg [noparse][[/noparse]j] := 8
                 '  j := j + 1
                   
                 'elseif ina 
                 '  inputreg[noparse][[/noparse]j]:= 9
                 '  j := j + 1
                 
                 'elseif ina   
                 '  inputreg[noparse][[/noparse]j] := 10
                 '  j := j + 1
                 
                 'elseif ina  
                 '  inputreg[noparse][[/noparse]j] := 11
                 '  j := j + 1
                 
                 'elseif ina   
                 '  inputreg[noparse][[/noparse]j] := 12
                 '  j := j + 1
                 
                 'elseif ina   
                 '   inputreg[noparse][[/noparse]j] := 13
                 '   j := j + 1
                 
                 'elseif ina[noparse][[/noparse]6]   
                 '  inputreg[noparse][[/noparse]j] := 14
                 '  j := j + 1
                 
                 'elseif ina[noparse][[/noparse]7]   
                 '  inputreg[noparse][[/noparse]j] :=15
                 '  j := j + 1
                  
                 
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    
    
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 15:50
    I think , we are making progress smile.gif
    pub memory
    
    dira[noparse][[/noparse]0..7] := 0
    dira[noparse][[/noparse]8..15] := 1
    



    This is tricky, a "1" is a "1"; the compiler cannot know that you want to set ALL bits to "1"; you have two options:
    dira[noparse][[/noparse]8..15] := %11111111
    or
    dira[noparse][[/noparse]8..15]~~
    Look up in the Manual what ~~ does!

        w := 1
         
      repeat 17
          x := 0
          z := 0
          j := 0 
          repeat 17
            outputreg [noparse][[/noparse]x] := 0
            inputreg [noparse][[/noparse]x] := 0
            x := x + 1
    
    


    Exactly! This is the way to preset a loop! You also could say
    repeat X from 0 to 17
    ....
          repeat w
    
    


    he following loop is repeated w times: Is that really what you want?]
           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~
                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
       
            waitcnt(delay + cnt )
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
    
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
             
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                
                 
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    
    
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 16:00
    deSilva said...

    he following loop is repeated w times: Is that really what you want?]
    ]

    yes i want that i repeats w times .. because it's the number of the lvl .. so it repeats as mutch the lvl is ..
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 16:09
    i think there is a little fault at you r post because

    he following loop is repeated w times: Is that really what you want?]
           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~
                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
       
            waitcnt(delay + cnt )
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
    
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
             
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                
                 
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    
    



    must be

           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~
                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
       
            waitcnt(delay + cnt )
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
    
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
    
    



    and the rest is an other loop ..
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 16:14
    dira[noparse][[/noparse]0..7] := %00000000
    dira[noparse][[/noparse]8..15] := %11111111
    
    


    this is what changed after your post ..
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 16:14
    May be,may be - I just take your posting and write things into it - no code of my own, it's all yout code (I removed the commented code...)

    How are things going? After fixing DIRA it should look better, shouldn't it?
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 16:20
    not really ..
    the problem is that some of the leds won't light up or light only up if you push long
    ( but then the prop.chip sees it as 2 pushes and that is not what i want )..
    it's not a specified 1 pin .. it changes
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 16:36
    All wrigth! Have a look at the last part (where I deleted the comments from):
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
    
                  
                 
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    


    This check will be repeated for 1,2...17 times depending on w and will immediately display the LED
    which corresponds to ste swicth.

    Does that work?
    If notm then the program is in the first part ofthe program, hindered by some waitcnt, maybe.

    BTW: What is the value for delay2 you are using?
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 17:14
    delay has the value 5_000_000
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 17:21
    and it's still the same ... some of the leds light up and other don't
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 17:49
    Try this part of your program:

          repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
    
                  
                 
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    



    Does it work? Then add other parts! Does it still work? If not, ask yourself what the impakt of this last add-on had been..

    Post Edited (deSilva) : 8/24/2007 5:54:07 PM GMT
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 19:30
    ok i've been doing that .. and something verystrange happend ..
    i was able to do them all in 1 loop of eight .. and the next loop of 9 pushes .. it didn't work ..
    how strange is that ?
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 20:35
    I presume - when you talk of "pushes" - you refer to "w" ??
    Very difficult to work out how you think...
    You gave us only apart of your program; all declarations are missing.
    Are the vectors for outputreg and inputreg, which are addressed by "z" - sufficiently dimensioned?
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 20:38
    ok i will give you everything i have ..
    var
     long i
     long X                      'random number
     long Z                      'number for the outputarray
     long v
     long w
     long j                      'number for the inputarray
     long h 
     byte outputreg[noparse][[/noparse]16]
     byte inputreg[noparse][[/noparse]16]  
      
    con
      _clkmode = xtal1 + pll2x                'external low-speed crystal
      _Xinfreq = 5_000_000                    '2*5Mhz = 10Mhz crystal is set on 10MHZ
      startpin = 8
      delay = 10_000_000                       ' how long the light stays on
      delay2 = 2_000_000
                         
      pin =  18
      
    
    
    "   
    pub main
       memory 
        
    pub memory
    
    dira[noparse][[/noparse]0..7] := %00000000
    dira[noparse][[/noparse]8..15] := %11111111
         w := 1
         
      repeat 17
          x := 0
          z := 0      
          j := 0 
          repeat X from 0 to 17
            outputreg [noparse][[/noparse]x] := 0
            inputreg [noparse][[/noparse]x] := 0
           
          dira[noparse][[/noparse]8..15] ~~                                      
          !outa[noparse][[/noparse]8..15]                          ' put the led on
          waitcnt(delay + cnt )
          outa[noparse][[/noparse]8..15] := 0
          waitcnt(delay2 + cnt )
          repeat w    
           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
           waitcnt(delay + cnt )
            
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
           'if outa[noparse][[/noparse]x]                    ' put pin X on 1 ( light op a led)
           '  outputreg [noparse][[/noparse]z] := x              ' to save what outpin has gone to 1
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
             
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                
                 waitcnt(delay2 + cnt )
                 outa[noparse][[/noparse]8..15] := 0
                 quit       
         
        w := w + 1
    
    



    tyhis all the code i have so far .. i've deleted the part with the '
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 21:02
    As you have never "debugged" a prgram, it is difficult to tell how to start.
    The idea is, to know what is going on in your program.

    Some people use dedicated LEDs they set or clear, when the program reaches a certain line or situation...

    With the Prop we have a better solution. I should recommend to use Ariba's PropTerminal.
    This can be downloaded from somewhere I don't know at the moment, and needs no further installation,
    there are examples how to use it.

    It will allow you to show things in a terminal window on your PC or laptop, so you get a better understanding of what is going on
    in your program. I shall include a small example at the end...

    Another approch is using ViewPort, but it may be too complex for you at the moment...

    But you also should increase your vectors... 15 is a little bit to short when you want to put 17 values into them


    Example:
    CON
    
      _clkmode = xtal1 + pll8x
      _xinfreq = 10_000_000
         
    OBJ
      pc   :       "PC_Interface"  ' Ariba's PropTerminal
      
    PUB Main | mPos
     'start the PC interface
      pc.start(31,30)
    
      repeat
        setpos(0,0) 
        pc.str(string("Addresses for a,b, and c"))
        setpos(2,1) 
        pc.str(string("@a"))
        pc.hex(@a,4)
        setpos(2,2) 
        pc.str(string("@b"))
        pc.hex(@b,4)
        setpos(2,3)
        pc.str(string("@c"))
        pc.hex(@c,4)   
        waitcnt(clkfreq+cnt)
        
    DAT
      a  long 0
      b  byte "A"
      c  long 0
    
    PRI setpos(px, py)
    
      pc.out(10)
      pc.out(px)
      pc.out(11)
      pc.out(py)
    
    
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 21:40
    ok i will try the Ariba's PropTerminal but i can't find it on the internet via google [noparse]:s:[/noparse]s
    and about the vector thing .. it's set on 16 and it starts counting from 0 so ... i have 17 places ..
    so i do'nt need to increes ... or i'm i wrong ?
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 22:04
    i've found the arib's prop terminal .. but it just says that it runs .. and more it doesn't give [noparse]:s:[/noparse]s
    is that normal ?
  • elecnoobelecnoob Posts: 123
    edited 2007-08-24 22:13
    i also have an other problem
    the program doesn't want to go into the if statments in the program ( that follows ) what can be the problem .. because i don't see it
    i have tried to add a tab or remove 1 but he doesn't want to do it
     repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                 if ina[noparse][[/noparse]0] ==1 
                   o:=0
                   outa[noparse][[/noparse]8] := ina[noparse][[/noparse]0] 
                 '  inputreg [noparse][[/noparse]j] := 8
                 '  j := j + 1
                 '  
                 if ina==1
                   o:=1
                   outa[noparse][[/noparse]9] := ina
                 '  inputreg[noparse][[/noparse]j]:= 9
                 '  j := j + 1
                 '
                 if ina ==1 
                   o:=2
                   outa[noparse][[/noparse]10] := ina  
                 ' inputreg[noparse][[/noparse]j] := 10
                 '  j := j + 1
                 '
                 if ina ==1 
                   outa[noparse][[/noparse]11] := ina 
                   o:=3  
                 '  inputreg[noparse][[/noparse]j] := 11
                 '  j := j + 1
                 '
                 if ina ==1 
                   o:=4
                   outa[noparse][[/noparse]12] := ina   
                 '  inputreg[noparse][[/noparse]j] := 12
                 '  j := j + 1
                 '
                 if ina ==1 
                   o:=5
                   outa[noparse][[/noparse]13] := ina    
                 '   inputreg[noparse][[/noparse]j] := 13
                 '   j := j + 1
                 '
                 if ina[noparse][[/noparse]6] ==1 
                   o:=6
                   outa[noparse][[/noparse]14] := ina[noparse][[/noparse]6]    
                 '  inputreg[noparse][[/noparse]j] := 14
                 '  j := j + 1
                 '
                 if ina[noparse][[/noparse]7] ==1 
                    o:=7
                    outa[noparse][[/noparse]15] := ina[noparse][[/noparse]7]  
                 '  inputreg[noparse][[/noparse]j] :=15
                 '  j := j + 1
                 '
                 '
                 waitcnt(delay2 + cnt )
                 'repeat
                ' until ina [noparse][[/noparse]o] := 0
                  
                     
                 outa[noparse][[/noparse]8..15] := 0
                 quit
    
    
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-24 22:27
    (1) LONG something[noparse][[/noparse] 1 ]
    will just make ONE cell for you to be addressed as something[noparse][[/noparse] 0 ]. I know this is a little bit confusing.
    Just do me a favour and write "[noparse][[/noparse] 16 ]" rather than "[noparse][[/noparse] 15 ]" smile.gif However this is not your problem NOW but would have been only later smile.gifsmile.gif

    (2) What do you think will INA == 1 do??

    (3) You have to add all the kind of code I have in the example to display things to the PropTerminal;
    if you try to run my example, change _xinput to 5_000_000 as you most likely have a 5 MHz crystal..
  • rjo_rjo_ Posts: 1,825
    edited 2007-08-24 23:15
    Hi guys,

    I had a small interruption in my electrical service and by the time I get back you guys are talking rocket science[noparse]:)[/noparse]

    Looks like real progress.

    deSilva said "This is not good. It means that you stil have no "feeling" for SPIN "

    deSilva,

    Let me assure you I have only the fondest feelings for SPIN... sometimes I love SPIN but SPIN doesn't love me[noparse]:)[/noparse]

    I was just stupid enough to try to learn Propeller Assembly only... and learn it first. Spin is such a natural and intuitive language
    that I end up using it anyway. Absolutely not more than a few hours of actual study.

    So I am completely prepared to see Elecnoob start from absolute zero and go flying by me in about a week[noparse]:)[/noparse]

    I haven't read the entire thread yet... get back to you guys when I have some input.

    Good work everybody.


    Rich
  • elecnoobelecnoob Posts: 123
    edited 2007-08-25 09:21
    INA == 1 is a bad coppy
    it must be
    INA[noparse][[/noparse]pinnumber] == 1
    it's to see if the button is pushed
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 09:43
    Right! If there are only two possibilities (0 and 1 in this situation), you can also simply write
    
    IF INA[noparse][[/noparse] pinnumber ]
    



    IF, WHILE,... also AND, OR ,... consider only, whether the value is ZERO or whether it differs from ZERO

    Some progress with PropTerminal?
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 09:50
    Just BTW: It is considered bad style to use the following variable names
    I  (capital I)
    l  (small L)
    o  (small O)
    O  (capital O)
    


    as they can be mistaken for one or zero, depending on the font.
  • elecnoobelecnoob Posts: 123
    edited 2007-08-25 09:51
    what do you mean ?
    because i don't get that ..
  • elecnoobelecnoob Posts: 123
    edited 2007-08-25 09:54
    so what i have now is this ..
    var
     long i
     long X                      'random number
     long Z                      'number for the outputarray
     long v
     long w
     long j                      'number for the inputarray
     long frequency
     long h
     long o
     byte outputreg[noparse][[/noparse]16]
     byte inputreg[noparse][[/noparse]16]  
      
    con
      _clkmode = xtal1 + pll8x                'external low-speed crystal
      _Xinfreq = 5_000_000                    '2*5Mhz = 10Mhz crystal is set on 10MHZ
      startpin = 8
      delay = 10_000_000                       ' how long the light stays on
      delay2 = 5_000_000
                         
      pin =  18
      
    
    
    obj
       Freq : "Synth"
       pc   : "PC_Interface"   
    
      
    PUB Main | mPos
     'start the PC interface
      pc.start(31,30)
    
      repeat
        setpos(0,0) 
        pc.str(string("Addresses for a,b, and c"))
        setpos(2,1) 
        pc.str(string("@a"))
        pc.hex(@a,4)
        setpos(2,2) 
        pc.str(string("@b"))
        pc.hex(@b,4)
        setpos(2,3)
        pc.str(string("@c"))
        pc.hex(@c,4)   
        waitcnt(clkfreq+cnt)
        
    DAT
      a  long 0
      b  byte "A"
      c  long 0
    
    PRI setpos(px, py)
    
      pc.out(10)
      pc.out(px)
      pc.out(11)
      pc.out(py)
    pub start
       memory 
        
    pub memory
    
    
    
    dira[noparse][[/noparse]0..7] := %00000000
    dira[noparse][[/noparse]8..15] := %11111111
         w := 1
         
      repeat 17
          x := 0
          z := 0      
          j := 0 
          repeat X from 0 to 17
            outputreg [noparse][[/noparse]x] := 0
            inputreg [noparse][[/noparse]x] := 0
           
          dira[noparse][[/noparse]8..15] ~~                                      
          !outa[noparse][[/noparse]8..15]                          ' put the led on
          waitcnt(delay + cnt )
          outa[noparse][[/noparse]8..15] := 0
          waitcnt(delay2 + cnt )
          repeat w    
           X := startpin + ||i?//8          ' set X to a random number from 0 to 8 , starpin for the output. if the random number =0 it will start at a defined pinnumber
           dira[noparse][[/noparse]X] ~~                                      
           !outa[noparse][[/noparse]X]                          ' put the led on
           waitcnt(delay + cnt )
            
                                              ' waiting time to hold the led lighted
           outputreg [noparse][[/noparse]z] := x
           'if outa[noparse][[/noparse]x]                    ' put pin X on 1 ( light op a led)
           '  outputreg [noparse][[/noparse]z] := x              ' to save what outpin has gone to 1
           z := z + 1                      ' z must add by 1 so the next won't overwrite the array
           outa[noparse][[/noparse]x] := 0
           waitcnt(delay2 + cnt ) 
             
          repeat w                          ' to see what switch is pressed
            repeat 
               if ina [noparse][[/noparse]0..7]
                 outa[noparse][[/noparse]8..15] := ina[noparse][[/noparse]0..7] 
                 if ina[noparse][[/noparse]0]  
                   o:=0
                   outa[noparse][[/noparse]8] := ina[noparse][[/noparse]0] 
                 '  inputreg [noparse][[/noparse]j] := 8
                 '  j := j + 1
                 '  
                 if ina
                   o:=1
                   outa[noparse][[/noparse]9] := ina
                 '  inputreg[noparse][[/noparse]j]:= 9
                 '  j := j + 1
                 '
                 if ina  
                   o:=2
                   outa[noparse][[/noparse]10] := ina  
                 ' inputreg[noparse][[/noparse]j] := 10
                 '  j := j + 1
                 '
                 if ina  
                   outa[noparse][[/noparse]11] := ina 
                   o:=3  
                 '  inputreg[noparse][[/noparse]j] := 11
                 '  j := j + 1
                 '
                 if ina 
                   o:=4
                   outa[noparse][[/noparse]12] := ina   
                 '  inputreg[noparse][[/noparse]j] := 12
                 '  j := j + 1
                 '
                 if ina  
                   o:=5
                   outa[noparse][[/noparse]13] := ina    
                 '   inputreg[noparse][[/noparse]j] := 13
                 '   j := j + 1
                 '
                 if ina[noparse][[/noparse]6]  
                   o:=6
                   outa[noparse][[/noparse]14] := ina[noparse][[/noparse]6]    
                 '  inputreg[noparse][[/noparse]j] := 14
                 '  j := j + 1
                 '
                 if ina[noparse][[/noparse]7]  
                    o:=7
                    outa[noparse][[/noparse]15] := ina[noparse][[/noparse]7]  
                 '  inputreg[noparse][[/noparse]j] :=15
                 '  j := j + 1
                 '
                 '
                 waitcnt(delay2 + cnt )
                 'repeat
                ' until ina [noparse][[/noparse]o] := 0
                  
                     
                 outa[noparse][[/noparse]8..15] := 0
                 quit      
    
          v := 0
          repeat w
            if outputreg[noparse][[/noparse]v] == inputreg[noparse][[/noparse]v]     ' compare the values in the 2 arrays
             v := v + 1                      ' next array   
                                   ' w stands for the lvl( times the lights turn on/off) if these 2 arayas are correct w+1
            else
               dira[noparse][[/noparse]8..15] ~~                                      
               !outa[noparse][[/noparse]8..15]                          ' put the led on
               waitcnt(delay + cnt )
               quit 
              
             
        w := w + 1
    
    



    the top is for the propterminal?
    or i'm i wrong ?
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 10:19
    Ah, that looks quite promissing!

    (1) What do you need "Freq" for? Best to remove it until you need that..
    (2) You now have changed your clock to 40 MHz. I do not know why you used 10MHz in the first place,
    but it is generally a goof idea to use 80 MHZ as EVERYBODY does it.
    (2b) But as your delay constants (1 second, 0.2 second) are tuned to 10 MHz you have to change them then (i.e. multiply their value by 8!)
    (3) Which routine is the start routine? START? Main? How shall the compiler know?
    O.K. I answer this question, as it is a difficult one: The compiler always starts with the first public routine, independent of any names given.

    So you have to re-arrange things a little bit...

    (4) I gave you the PropTerminal test program so that you can check, whether ProTerminal is running correctly on your machine.
    So please, use my unmodified code (though with a different clock setting wrt your crystal) first to see that PropTerminal works!

    Post Edited (deSilva) : 8/25/2007 10:26:15 AM GMT
  • elecnoobelecnoob Posts: 123
    edited 2007-08-25 10:25
    but what do i need to do first ? first the pc interface ? because it has a neverending repeat .
    so it will stay in that .. so i need to put my pub memory in that ? or before that ? or after that ?
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-25 10:30
    Distinguish the sequence the routines are arranged in your program from what is happening when they run.
    The rule is - as I said - the first public routine is the "root".

    My test programm cannot be used unmodified - you must use parts of it in your own code:
    - the initialization : pc.start(....)

    - and whenever you want to output something to the "pc console"
    - pc.hex(...,8)
    or
    - pc.dec(...)
    or
    -pc.str(string("......"))

    But first you have to check whether it runs at all!
    Just use my original code with the changed crystal setting and report back smile.gif

    Post Edited (deSilva) : 8/25/2007 10:45:48 AM GMT
Sign In or Register to comment.