Shop Learn
TACHYON O/S V3.0 JUNO - Furiously Fast Forth, FAT32+LAN+VGA+RS485+OBEX ROMS+FP+LMM+++ - Page 39 — Parallax Forums

TACHYON O/S V3.0 JUNO - Furiously Fast Forth, FAT32+LAN+VGA+RS485+OBEX ROMS+FP+LMM+++

13637394142109

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2014-02-07 13:13
    Hi Peter,

    I have a Spinneret sitting idle and I thought I'd load Tachyon on it. My question is about the Wiznet 5100 module, it appears to have been written for kernel 2.1, has it been brought forward to work with 2.3 or would I be better off using 2.1 and a 2.1 compatible EXTEND.fth to go with it? My budget doesn't include a Wiznet 5200 for the QuickStart just now.

    Thanks!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-07 16:59
    D.P wrote: »
    Okay I see what happened above.

    Can you give an example of REV and SPIWR LSB please.

    Thanks,

    REV works exactly like the PASM REV, have a look at the kernel source here:
    [B][B][COLOR=#000000][FONT=Ubuntu Mono]' REV ( n1 bits -- n2 ) Reverse LSBs of n1 and zero-extend[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]            rev    tos+1,tos[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]            jmp    #DROP[/FONT][/COLOR]
    [/B][/B]
    

    Here's a quick test loop:
    [FONT=courier new][B]$16 0 #32 ADO CR I .DEC SPACE DUP .BYTE SPACE DUP I REV .LONG LOOP[/B]                                                    
    0000 16 6800.0000                                                                                               
    0001 16 3400.0000                                                                                               
    0002 16 1A00.0000                                                                                               
    0003 16 0D00.0000                                                                                               
    0004 16 0680.0000                                                                                               
    0005 16 0340.0000                                                                                               
    0006 16 01A0.0000                                                                                               
    0007 16 00D0.0000                                                                                               
    0008 16 0068.0000                                                                                               
    0009 16 0034.0000                                                                                               
    0010 16 001A.0000                                                                                               
    0011 16 000D.0000                                                                                               
    0012 16 0006.8000                                                                                               
    0013 16 0003.4000                                                                                               
    0014 16 0001.A000                                                                                               
    0015 16 0000.D000                                                                                               
    0016 16 0000.6800                                                                                               
    0017 16 0000.3400                                                                                               
    0018 16 0000.1A00                                                                                               
    0019 16 0000.0D00                                                                                               
    0020 16 0000.0680                                                                                               
    0021 16 0000.0340                                                                                               
    0022 16 0000.01A0                                                                                               
    0023 16 0000.00D0                                                                                               
    0024 16 0000.0068                                                                                               
    0025 16 0000.0034                                                                                               
    0026 16 0000.001A                                                                                               
    0027 16 0000.000D                                                                                               
    0028 16 0000.0006                                                                                               
    0029 16 0000.0003                                                                                               
    0030 16 0000.0001                                                                                               
    0031 16 0000.0000 ok
    [/FONT]
    

    So normally to reverse the lower 8-bits of a number we need to do a #24 REV

    SPIWR is a simple word to clock out SPI data quickly but only at a fixed 8-bits at a time. SPI is normally sent MSB first so the data needs to be left justified to work so if you are sending 32-bits then it is already "left justified" in that the MSB is aligned with bit 31. To send all 32-bits just repeat the instruction like this SPIWR SPIWR SPIWR SPIWR after which there will be the shifted remains of the number left on the stack (always zero in this case). Execution time is 12us.

    If you needed to shift 16-bits you would left justify first with a 16 SHL then SPIWR SPIWR which takes 8us
    For 24 bits it's 8 SHL SPIWR SPIWR SPIWR which takes 11us
    If you only need 8-bits there is the SPIWRB which left justifies the byte for you as this only takes one precious extra PASM instruction and is more efficient for an otherwise common operation which takes 3us

    BTW, the SPIWR instruction has it's own pin mask registers, you can set them directly or else use SPIPINS ( ce-miso-mosi-clk -- ) where a long specifies the 4 pins to use.
    i.e. Say we have chip enable on P27, clock on P24, MOSI on P25 and MISO on P26 (not used by SPIWR), the long is encoded as &27.26.25.24 SPIPINS which uses the Tachyon specific & byte encoded decimal notation as used in IP addresses to make it easier for us.
  • D.PD.P Posts: 790
    edited 2014-02-08 10:10
    Thanks for the REV SPIWR explanation Peter and:
    \ fibonacci - iterative method - but skip test for n = 0
    : fibo ( n -- f )
      0 1                           \ Setup initial calculations "0 1"  
      ROT                           \ rotate n to top of stack - for n times
      FOR 
        OVER + SWAP                 \ next iteration -> result prev
      NEXT
      DROP                          \ discard the prev result, leave the current result
      ;
       
    \ fibonacci test - just a Q&D one liner
    DECIMAL
    1 26 ADO CR ." fibo(" I . ." ) = " NEWCNT I fibo  .LAP ."  result =" . LOOP
    

    VS this Compile, Link, Download
    /**
     * This is the main fiboiterative program file.
     *
     * Fibonnaci numbers skipping fibo(0).
     * Uses iterative (default) or recursive method.
     * Saves results and times in an array, then prints them.
     */
    #include <stdio.h>
    #include <unistd.h>
    #include <propeller.h>
    
    #define LAST 26
    
    inline int fiboi(int num)
    {
      int fibo  = 1;
      int fibo1 = 1;
      int fibo2 = 1;
      int j;
      
      if(num < 3) {
        return fibo;
      }
      else {
        fibo1 = 1;
        fibo2 = 1;
        for(j = 3; j <= num; j++) {
          fibo  = fibo1 + fibo2;
          fibo2 = fibo1;
          fibo1 = fibo;
        }
      }
      return fibo;
    }
    
    int fibor(int num)
    {
      if (num < 3) {
        return 1;
      }
      return fibor(num-1) + fibor(num-2);
    }
    
    int main(void)
    {
        int n;
        int times[LAST+1];
        int result[LAST+1];
    
        sleep(1); // startup time for SimpleIDE
        
        for(n = 1; n <= LAST; n++) {
            times[n]    = CNT;
            result[n]   = fiboi(n); // replace with fibor(n) for recursive function
            times[n]    = CNT-times[n];
        }
        if(times[LAST]*125/10000 < 100) {
            for(n = 1; n <= LAST; n++) {
                printf("fibo(%2d) = %6d (%4d ticks) (%dus)\n", n, result[n], times[n], times[n]*125/10000);
            }
        }
        else {
            for(n = 1; n <= LAST; n++) {
                printf("fibo(%2d) = %6d (%8d ticks) (%dms)\n", n, result[n], times[n], times[n]*125/10000000);
            }
        }
        return 0;
    }
    

    If I need a sub 10us Fibo routine it's time for an assembler RUNMOD, until then I have a life to live, THANK YOU Peter!!
    Also the comment "can you do a proper recursive version" as if the correct results are not correct because your syntax didn't curtsy correctly before emitting the results.
    HA!
  • David BetzDavid Betz Posts: 14,374
    edited 2014-02-08 10:16
    D.P wrote: »
    Also the comment "can you do a proper recursive version" as if the correct results are not correct because your syntax didn't curtsy correctly before emitting the results.
    HA!
    This is a stupid comment. The point of the benchmark was to be able to compare various languages. That isn't possible if they don't all use the same algorithm. It isn't a statement about which algorithm is best. Of course the iterative one is the one you'd actually use if you wanted to compute Fibonacci numbers.
  • D.PD.P Posts: 790
    edited 2014-02-08 10:53
    David Betz wrote: »
    This is a stupid comment. The point of the benchmark was to be able to compare various languages. That isn't possible if they don't all use the same algorithm. It isn't a statement about which algorithm is best. Of course the iterative one is the one you'd actually use if you wanted to compute Fibonacci numbers.
    Don't go hostile, the thread was all over the place, you need to chill. Learn Forth, increase idea density, prevent alzheimer's. Go play somewhere else if you can take a joke or be nice.
  • David BetzDavid Betz Posts: 14,374
    edited 2014-02-08 10:56
    D.P wrote: »
    Don't go hostile, the thread was all over the place, you need to chill. Learn Forth, increase idea density, prevent alzheimer's. Go play somewhere else if you can take a joke or be nice.
    You don't think your comment sounded hostile or at least insulting? I'm sick of this "Forth is wonderful and better than anything else" mentality. I believe Forth has value but so do lots of other things including Spin and C/C++. This Forth cheerleading is getting tiresome.
  • D.PD.P Posts: 790
    edited 2015-07-01 22:51
    It's been bashed merciouly here David, over and over again. Without anyone giving it a chance, all the "gibberish" comments as if ANY computer syntax is straight forward to those not skilled in the art! I work with people just trying to make the lights blink and a Tachyon terminal lets me get them started thinking about how a computer works. For me it's about productivity and maintenance of a entire system, not about the language part that was used to develop a part of a system. I'm sick and tired of all the language wars and mine is bigger than yours BS. I've really struggled to learn Tachyon and FORTH since I was never exposed to any TIL lanaguges. I like the way I can have all my tools on the micro controller and frob chips from the terminal to get them to talk SPI, I2C and all the various vendor's hybrids of these "standards" as opposed to compile->link-download test, didn't work, do it all again!!! Look at the simplicity of some of the drivers Peter has wrote, it really shines here I think.
    If you took serious offense to my comment, appologies. People are dying all over the world every second, it's only the spoiled who get to argue about what language is better than the other, just like religion. I want to build simple devices to try to help people who are much less advantaged than us. I find Tachyon / Forth is easier for me to try and accomplish my goals. I will refrain from all the noise on these forums, people are really ticked off here it seems.
  • David BetzDavid Betz Posts: 14,374
    edited 2015-07-01 22:46
    D.P wrote: »
    It's been bashed merciouly here David, over and over again. Without anyone giving it a chance, all the "gibberish" comments as if ANY computer syntax is straight forward to those not skilled in the art! I work with people just trying to make the lights blink and a Tachyon terminal lets me get them started thinking about how a computer works. For me it's about productivity and maintenance of a entire system, not about the language part that was used to develop a part of a system. I'm sick and tired of all the language wars and mine is bigger than yours BS. I've really struggled to learn Tachyon and FORTH since I was never exposed to any TIL lanaguges. I like the way I can have all my tools on the micro controller and frob chips from the terminal to get them to talk SPI, I2C and all the various vendor's hybrids of these "standards" as opposed to compile->link-download test, didn't work, do it all again!!! Look at the simplicity of some of the drivers Peter has wrote, it really shines here I think.
    If you took serious offense to my comment, appologies. People are dying all over the world every second, it's only the spoiled who get to argue about what language is better than the other, just like religion. I want to build simple devices to try to help people who are much less advantaged than us. I find Tachyon / Forth is easier for me to try and accomplish my goals. I will refrain from all the noise on these forums, people are really ****** off here it seems.
    I agree that Tachyon seems to be a very nice system. I never said otherwise as far as I can recall. I'd love to read about what cool things people are doing with it and with any other Propeller language or programming system. No need to try to push it on everyone else, just tell everyone about the great things you're doing with it and some will surely want to jump on board like you have.
  • Dave HeinDave Hein Posts: 6,322
    edited 2014-02-08 15:27
    Tachyon maintains it stacks in cog registers, and doesn't allow for deep recursion. This is by design to provide the highest execution speed. It would be possible to implement the recursive fibo algorithm in Tachyon by implementing a secondary data stack. Prior to calling itself, fibo could move the contents of the data stack and the return address to the secondary stack. It would restore the values upon return from the recursively called fibo. This would prevent the data and return stacks from growing. It would require a few extra cycles to do this, but it would be an interesting exercise that might be useful for other applications.
  • David BetzDavid Betz Posts: 14,374
    edited 2014-02-08 15:38
    Dave Hein wrote: »
    Tachyon maintains it stacks in cog registers, and doesn't allow for deep recursion. This is by design to provide the highest execution speed. It would be possible to implement the recursive fibo algorithm in Tachyon by implementing a secondary data stack. Prior to calling itself, fibo could move the contents of the data stack and the return address to the secondary stack. It would restore the values upon return from the recursively called fibo. This would prevent the data and return stacks from growing. It would require a few extra cycles to do this, but it would be an interesting exercise that might be useful for other applications.
    No need to go to all that trouble. It's clear that Tachyon will be fast even with the recursive version of Fibo as is pfth. Both seem to be very capable languages for interactive programming of the Propeller! Congratulations to both of you!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-08 19:24
    Well as I said before, benchmarks are useful tools but they don't tell you everything. It is possible to compile down to PASM and dedicate a cog to nothing else but the benchmark. How about that same benchmark running in a TELNET session perhaps? Out of the same cog too? That would be a treat!
    Here it is, the raw output including pasting and compiling through telnet...
    [FONT=courier new]peter@peter-XPS-L702X-LM16 ~ $ telnet 192.168.16.151
    Trying 192.168.16.151...
    Connected to 192.168.16.151.
    Escape character is '^]'.
    WELCOME TO THE TACHYON WIZNET TELNET SESSION!
    
      ok
    
    \ fibonacci - iterative method - but skip test for n = 0
    : fibo ( n -- f )
      0 1                           \ Setup initial calculations "0 1"  
      ROT                           \ for n times
      FOR 
        OVER + SWAP                 \ next iteration -> result prev
      NEXT
      DROP                          \ discard the prev result, leave the current result
      ;
       
    \ fibonacci test - just a Q&D one liner
    DECIMAL
    1 26 ADO CR ." fibo(" I . ." ) = " NEWCNT I fibo  .LAP ."  result =" . LOOP
      ok
    
    n -- f ) 
    
    
     
    
     
    
      ok
      ok
    
      ok
    fibo(") = " result =" 
    fibo(1) = 13us result =1
    fibo(2) = 16us result =1
    fibo(3) = 19us result =2
    fibo(4) = 22us result =3
    fibo(5) = 25us result =5
    fibo(6) = 28us result =8
    fibo(7) = 31us result =13
    fibo(8) = 34us result =21
    fibo(9) = 37us result =34
    fibo(10) = 40us result =55
    fibo(11) = 43us result =89
    fibo(12) = 46us result =144
    fibo(13) = 49us result =233
    fibo(14) = 52us result =377
    fibo(15) = 55us result =610
    fibo(16) = 58us result =987
    fibo(17) = 61us result =1597
    fibo(18) = 64us result =2584
    fibo(19) = 67us result =4181
    fibo(20) = 70us result =6765
    fibo(21) = 73us result =10946
    fibo(22) = 76us result =17711
    fibo(23) = 79us result =28657
    fibo(24) = 82us result =46368
    fibo(25) = 85us result =75025
    fibo(26) = 88us result =121393 ok
    
    [/FONT]
    

    Note: looks like I've got some echoed stuff from the compile spitting out later than sooner in telnet, something for me to look into.

    EDIT: I've done an extra test of opening and logging the results to a file then listing that. All interactively via telnet of course.
    [FONT=courier new]peter@peter-XPS-L702X-LM16 ~ $ telnet 192.168.16.151
    Trying 192.168.16.151...
    Connected to 192.168.16.151.
    Escape character is '^]'.
    WELCOME TO THE TACHYON WIZNET TELNET SESSION!
    \ fibonacci - iterative method - but skip test for n = 0
    : fibo ( n -- f )
      0 1                           \ Setup initial calculations "0 1"  
      ROT                           \ for n times
      FOR 
        OVER + SWAP                 \ next iteration -> result prev
      NEXT
      DROP                          \ discard the prev result, leave the current result
      ;
    
    n -- f ) 
    
    
     
    
     
    
      ok
    \ fibonacci test - just a Q&D one liner
    DECIMAL
    1 26 ADO CR ." fibo(" I . ." ) = " NEWCNT I fibo  .LAP ."  result =" . LOOP
    
      ok
    fibo(") = " result =" 
    fibo(1) = 13us result =1
    fibo(2) = 16us result =1
    fibo(3) = 19us result =2
    fibo(4) = 22us result =3
    fibo(5) = 25us result =5
    fibo(6) = 28us result =8
    fibo(7) = 31us result =13
    fibo(8) = 34us result =21
    fibo(9) = 37us result =34
    fibo(10) = 40us result =55
    fibo(11) = 43us result =89
    fibo(12) = 46us result =144
    fibo(13) = 49us result =233
    fibo(14) = 52us result =377
    fibo(15) = 55us result =610
    fibo(16) = 58us result =987
    fibo(17) = 61us result =1597
    fibo(18) = 64us result =2584
    fibo(19) = 67us result =4181
    fibo(20) = 70us result =6765
    fibo(21) = 73us result =10946
    fibo(22) = 76us result =17711
    fibo(23) = 79us result =28657
    fibo(24) = 82us result =46368
    fibo(25) = 85us result =75025
    fibo(26) = 88us result =121393 ok
    FOPEN LOG0008.TXT
    ...opened at 0000.3B67   ok
    FOUTPUT 1 26 ADO CR ." fibo(" I . ." ) = " NEWCNT I fibo  .LAP ."  result =" . LOOP CON 
    cat LOG0008.TXT
    
    
    fibo(") = " result ="  ok
    ...opened at 0000.3B67 
    
    fibo(1) = 13us result =1
    fibo(2) = 16us result =1
    fibo(3) = 19us result =2
    fibo(4) = 22us result =3
    fibo(5) = 25us result =5
    fibo(6) = 28us result =8
    fibo(7) = 31us result =13
    fibo(8) = 34us result =21
    fibo(9) = 37us result =34
    fibo(10) = 40us result =55
    fibo(11) = 43us result =89
    fibo(12) = 46us result =144
    fibo(13) = 49us result =233
    fibo(14) = 52us result =377
    fibo(15) = 55us result =610
    fibo(16) = 58us result =987
    fibo(17) = 61us result =1597
    fibo(18) = 64us result =2584
    fibo(19) = 67us result =4181
    fibo(20) = 70us result =6765
    fibo(21) = 73us result =10946
    fibo(22) = 76us result =17711
    fibo(23) = 79us result =28657
    fibo(24) = 82us result =46368
    fibo(25) = 85us result =75025
    fibo(26) = 88us result =121393  ok
      ok
     [/FONT]
    
  • David BetzDavid Betz Posts: 14,374
    edited 2014-02-09 04:57
    Telnet, a web server, fast execution, and on and on. I find it amazing that you've been able to squeeze so much into an unexpanded Propeller using Tachyon. It is certainly a work of art.
  • potatoheadpotatohead Posts: 10,191
    edited 2014-02-09 08:26
    I think so too. :)
  • D.PD.P Posts: 790
    edited 2014-02-09 23:38
    Given this linked timer code which works for me:
    \ demo LED flasher which takes 5 and 3 seconds before it starts flashing every 100ms and 150ms
    
    DOUBLE blinktimer1
    DOUBLE blinktimer2
    
    WORD blinky1
    WORD blinky2
    
    : BLINKY1
             #15 PIN@ 0= #15 PIN!                        \ toggle pin 15
             blinky1 W@ blinktimer1 TIMEOUT              \ reload timer
             ;
    : BLINKY2
             #14 PIN@ 0= #14 PIN!                        \ toggle pin 14
             blinky2 W@ blinktimer2 TIMEOUT               \ reload timer
             ;
    
    \ Setup the timeout vector for TIMER blinktimer1, 2
    
    ' BLINKY1 blinktimer1 ALARM
    ' BLINKY2 blinktimer2 ALARM
    
    \ Write a reload value to timer's memory which we can change anytime
    
    #100 blinky1 W!
    #150 blinky2 W!
    
    \ Setup timer 0 to timeout in 5 seconds
    
    #5,000 blinktimer1 TIMEOUT
    #3,000 blinktimer2 TIMEOUT
    

    I've tried to modify the BLINKERS code to use the new linked timers but no joy so far
    TABLE mytimers 8 8 * ALLOT       \ allot for 8 doubles
    : mytimers@ ( index -- addr )  8 * mytimers + ;
    #16        == ledpins
    
    TABLE blinkrates
            #50 || #500 ||
            #50 || #300 ||
            #50 || #150 ||
            #50 || #285 ||
            #50 || #175 ||
            #50 || #335 ||
            #50 || #100 ||
            #50 || #195 ||
    
    pub BLINKER ( accesses index of calling loop )
           I 2* 2* blinkrates + I ledpins + DUP PIN@ IF PINCLR 2+ ELSE PINSET THEN W@ I mytimers@ TIMEOUT
        ;
    
    pub clrpin           I ledpins + PINCLR ;
    
    pub BLINKERS ( flg -- ) IF ' BLINKER ELSE ' clrpin THEN 8 0 DO DUP I mytimers@ ALARM 1 I mytimers@ TIMEOUT LOOP DROP ;
    
    { Usage:
    
    ON BLINKERS   \ will activate the timers and blink functions
    
    OFF BLINKERS  \ will cause the timers to timeout in the next millisecond and turnoff the LEDs  
    
    }
    

    ." missing something here"
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-10 07:12
    D.P wrote: »

    I've tried to modify the BLINKERS code to use the new linked timers but no joy so far
    TABLE mytimers 8 8 * ALLOT       \ allot for 8 doubles
    : mytimers@ ( index -- addr )  8 * mytimers + ;
    #16        == ledpins
    
    TABLE blinkrates
            #50 || #500 ||
            #50 || #300 ||
            #50 || #150 ||
            #50 || #285 ||
            #50 || #175 ||
            #50 || #335 ||
            #50 || #100 ||
            #50 || #195 ||
    
    pub BLINKER ( accesses index of calling loop )
           I 2* 2* blinkrates + I ledpins + DUP PIN@ IF PINCLR 2+ ELSE PINSET THEN W@ I mytimers@ TIMEOUT
        ;
    
    pub clrpin           I ledpins + PINCLR ;
    
    pub BLINKERS ( flg -- ) IF ' BLINKER ELSE ' clrpin THEN 8 0 DO DUP I mytimers@ ALARM 1 I mytimers@ TIMEOUT LOOP DROP ;
    
    { Usage:
    ON BLINKERS   \ will activate the timers and blink functions
    OFF BLINKERS  \ will cause the timers to timeout in the next millisecond and turnoff the LEDs  
    }
    

    ." missing something here"

    Yes, because in the old code BLINKERS could access the I index of the calling loop of TIMERTASK to ascertain which timer had timed out. With the new linked timers there is no index, however the address of the timer in question is available on the stack. The code would look like this then:
    [FONT=courier new]TABLE mytimers 8 8 * ALLOT     \ allot space for 8 doubles (leave next line blank!)
    
    pub @mytimers    2* 2* 2* mytimers + ;
    
    #16    == ledpins
    TABLE blinkrates
        #50 || #500 ||
        #50 || #300 ||
        #50 || #150 ||
        #50 || #285 ||
        #50 || #175 ||
        #50 || #335 ||
        #50 || #100 ||
        #50 || #195 ||
    pub BLINKER ( timeraddr -- timeraddr ) 
         DUP mytimers - 2/ 2/ 2/ >L            \ convert timeraddr to an IX index onto loop stack
         IX 2* 2* blinkrates +                \ point to a blinkrate for this timer 
         IX ledpins +                     \ point to the ledpin to use 
         DUP PIN@ IF PINCLR 2+ ELSE PINSET THEN    \ toggle the pin and (re)point to blinkrate
         W@ L> @mytimers TIMEOUT                \ Fetch and set that blinkrate (either the on or off one)
        ;
    pub clrpin       I ledpins + PINCLR ;
    pub BLINKERS ( flg -- ) 
        IF ' BLINKER ELSE ' clrpin THEN
         8 0 DO DUP I @mytimers ALARM 1 I @mytimers TIMEOUT LOOP DROP
         ;
    [/FONT]
    

    This is ugly though and there are better ways of doing this with the new linked timers but this provides the correction to the existing code so you can see how it works.
  • D.PD.P Posts: 790
    edited 2014-02-10 08:55
    Yes, because in the old code BLINKERS could access the I index of the calling loop of TIMERTASK to ascertain which timer had timed out. With the new linked timers there is no index, however the address of the timer in question is available on the stack. The code would look like this then:
    [FONT=courier new]TABLE mytimers 8 8 * ALLOT     \ allot space for 8 doubles (leave next line blank!)
    
    pub @mytimers    2* 2* 2* mytimers + ;
    
    #16    == ledpins
    TABLE blinkrates
        #50 || #500 ||
        #50 || #300 ||
        #50 || #150 ||
        #50 || #285 ||
        #50 || #175 ||
        #50 || #335 ||
        #50 || #100 ||
        #50 || #195 ||
    pub BLINKER ( timeraddr -- timeraddr ) 
         DUP mytimers - 2/ 2/ 2/ >L            \ convert timeraddr to an IX index onto loop stack
         IX 2* 2* blinkrates +                \ point to a blinkrate for this timer 
         IX ledpins +                     \ point to the ledpin to use 
         DUP PIN@ IF PINCLR 2+ ELSE PINSET THEN    \ toggle the pin and (re)point to blinkrate
         W@ L> @mytimers TIMEOUT                \ Fetch and set that blinkrate (either the on or off one)
        ;
    pub clrpin       I ledpins + PINCLR ;
    pub BLINKERS ( flg -- ) 
        IF ' BLINKER ELSE ' clrpin THEN
         8 0 DO DUP I @mytimers ALARM 1 I @mytimers TIMEOUT LOOP DROP
         ;
    [/FONT]
    

    This is ugly though and there are better ways of doing this with the new linked timers but this provides the correction to the existing code so you can see how it works.

    I would prefer the concept of "idea compresssion" as to ugly, this has given me insight not yet gleaned from the source, thanks.
  • FredBlaisFredBlais Posts: 370
    edited 2014-02-10 16:54
    Sorry to disrupt any discussion here,

    I have loaded Tachyon in my QuickStart board EEPROM and it works. Now I would like to add the EXTEND.fth file. I read the tutorial explanations :
    Select All and copy the text then paste this into your serial terminal which should have a line delay of around 20ms (no character delay) to allow time for Tachyon to process each line of source.

    The file is huge and contains spin comment, table of content, etc... is it the right file? https://docs.google.com/document/d/19t8NRAKQOdUNgcCKb6D3jGS3Y41l2IIxCUVjmWXqSCU/pub
    When I do a copy paste of all the file in my terminal (minicom on linux) it fails. Any advice?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-10 17:11
    FredBlais wrote: »
    Sorry to disrupt any discussion here,

    I have loaded Tachyon in my QuickStart board EEPROM and it works. Now I would like to add the EXTEND.fth file. I read the tutorial explanations :

    The file is huge and contains spin comment, table of content, etc... is it the right file? https://docs.google.com/document/d/19t8NRAKQOdUNgcCKb6D3jGS3Y41l2IIxCUVjmWXqSCU/pub
    When I do a copy paste of all the file in my terminal (minicom on linux) it fails. Any advice?

    Well I think you have run afoul of one of my late night edits, I've fixed that now. Yes, just select the lot and a paste into minicom will automatically filter out any non-text and it should work fine. You can type ^A F to send a break from minicom which will reset the Prop to start a clean load. The Google docs webpage version that you have grabs the header and footer of the document as well when you select all and that is why the header title is in brackets while the footer is a "Published blah blah blah which triggers an ignore line in Tachyon.

    BTW, there's always the dropbox versions but the link you have will always be the latest to work from, and sometimes, not work from :)
  • FredBlaisFredBlais Posts: 370
    edited 2014-02-10 17:24
    here is what I get :
      Propeller .:.:--TACHYON--:.:. Forth V23140203.0000                            
     Cold start - no user code - setting defaults                                   
    ----------------------------------------------------------------                
    TACHYON                                                                         
      Propeller .:.:--TACHYON--:.:. Forth V23140203.0000                            
     ok                                                                             
    0000  ok                                                                        
    0001  ok.fth )                                                                  
    0002  ok                                                                        
    0003  okND.fth    ." Primary extensions to TACHYON kernel - 140203-2145 " ;     
    0004  ok                                                                        
    0005  ok                                                                        
    0006  ok                                                                        
    \                                                                               
    0007  ok                                                                        
    0008  ok                                                                        
    0009  ok                                                                        
    0010  oko the latest Tachyon kernel web document )                              
    0011  ok                                                                        
    0012  ok                                                                        
    0013  ok                                                                        
    0014  ok                                                                        
    0015  ok                                                                        
    0016  ok                                                                        
    0017  ok                                                                        
    0018  ok                                                                        
    \                                                                               
    0019  ok                                                                        
    0020  ok ( --  \ do nothing - vectorable ) ;                                    
    0021  ok                                                                        
    0022  ok                                                                        
    0023  ok                                                                        
    0024 K ( on/off -- \ enable/disable OK prompts including the autospace )        
    0025                                                                            
    0026 F 0 ELSE ' NOOP THEN prompt 2+ W!                                          
    0027                                                                            
    0028  ok                                                                        
    0029  ok                                                                        
    0030 CHO ( on/off --  \ set the ECHO flag on/off for controlling output )       
    0031                                                                            
    0032 1 flags ROT BIT!                                                           
    0033                                                                            
    0034  ok                                                                        
    0035  ok                                                                        
    0036  ok                                                                        
    0037  ok                                                                        
    \                                                                               
    0038  ok                                                                        
    pri LEMIT       DUP $0A <> IF (EMIT) ELSin  --> ELSin <-- NOT FOUND 
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-10 17:32
    FredBlais wrote: »
    here is what I get :

    Sounds like you don't have line delay set. Type ^A T D in minicom and make sure it's set to 20
    D - Newline tx delay (ms) : 20
  • FredBlaisFredBlais Posts: 370
    edited 2014-02-10 17:39
    Success!!
    Propeller .:.:--TACHYON--:.:. Forth V23140203.0000                            
                                                                                    
    NAMES:  $5EA5...74EB for 5702 (3188 bytes added)                                
    CODE:   $0000...30F9 for 6835 (6393 bytes added)                                
    CALLS:  0506 vectors free                                                       
    RAM:    11692 bytes free                                                        
                                                                                    
    AUTORUN EXTEND.boot                                                             
    MODULES LOADED:                                                                 
    1800: EXTEND.fth          Primary extensions to TACHYON kernel - 140211-1100
    

    Thanks, I did not know where to put this line delay config. BTW, congrats for your 3000th forum post :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-10 17:47
    FredBlais wrote: »
    Success!!
    Propeller .:.:--TACHYON--:.:. Forth V23140203.0000                            
                                                                                    
    NAMES:  $5EA5...74EB for 5702 (3188 bytes added)                                
    CODE:   $0000...30F9 for 6835 (6393 bytes added)                                
    CALLS:  0506 vectors free                                                       
    RAM:    11692 bytes free                                                        
                                                                                    
    AUTORUN EXTEND.boot                                                             
    MODULES LOADED:                                                                 
    1800: EXTEND.fth          Primary extensions to TACHYON kernel - 140211-1100
    

    Thanks, I did not know where to put this line delay config. BTW, congrats for your 3000th forum post :)

    Great! Have fun and don't think twice about asking a question or making a suggestion, I can always ignore it :)
    My 3000th post!? yikes, I think I talk too much, but then I have a look at some other forum members and then I realize why they always seem to have an opinion...... but even 3000 posts are a lot, say if each one took 4 minutes average, that's 12,000 minutes or 200 hours....now I know where all the time goes, and yes, that erco character is to blame too.
  • D.PD.P Posts: 790
    edited 2014-02-10 23:56
    SPIWR is clocking at 4MHz, way to fast for the devices I'm trying to talk with.

    How can I slow this down, looking for 100ksps max.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-11 01:18
    D.P wrote: »
    SPIWR is clocking at 4MHz, way to fast for the devices I'm trying to talk with.

    How can I slow this down, looking for 100ksps max.
    It's easy enough to write one in Forth then, even then you might some extra delays. I will look at some code for you. Which device is it anyway? It doesn't sound right and also the ksps refers to the samples/second, not the bps.
  • D.PD.P Posts: 790
    edited 2014-02-11 08:08
    It's easy enough to write one in Forth then, even then you might some extra delays. I will look at some code for you. Which device is it anyway? It doesn't sound right and also the ksps refers to the samples/second, not the bps.

    Okay I can bit bang one out then, no worries. I thought there may be a way to (simply) down clock the current routine in the kernel The device is a legacy LCD that is built up on a custom board with multiple interface styles: ttl, rs232, SPI. The interface list 100kBps max for SPI.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-11 14:33
    D.P wrote: »
    Okay I can bit bang one out then, no worries. I thought there may be a way to (simply) down clock the current routine in the kernel The device is a legacy LCD that is built up on a custom board with multiple interface styles: ttl, rs232, SPI. The interface list 100kBps max for SPI.

    There is the SPIOD module which works just like the SPIO module except you can specify a delay. I have been sprucing up the Intro page and I have a little section in there about it which I will expand upon. Otherwise there is some Forth code in there under the CLOCK instruction usage that you can adapt. The TTL interface for the LCD sounds the easiest though.
  • D.PD.P Posts: 790
    edited 2014-02-11 22:50
    There is the SPIOD module which works just like the SPIO module except you can specify a delay. I have been sprucing up the Intro page and I have a little section in there about it which I will expand upon. Otherwise there is some Forth code in there under the CLOCK instruction usage that you can adapt. The TTL interface for the LCD sounds the easiest though.

    Found it, got SPIOD to do the job, great! Thanks and nice work on the Intro page.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-13 18:24
    I've gotten back into doing a little bit more with the webserver and ftp, sorting out timeouts and ftp clients. Even though I am still doing some testing and adjusting I will probably leave a Prop hooked up at tachyonforth.com as it also hosts a straight clone of the "Introduction to Tachyon Forth" as the home page (although the TOC links still point to the Google doc at present). There are various types of files I leave on the card for testing including PDFs, and images etc and I will also include all the source code pages too. So a Tachyon Forth Prop is hosting a website about itself, for itself!

    The unit will also have random text selections sent to it's RS232 port so it will be logging that also and normally you can see the text file by going to tachyonforth.com/log0001.txt etc. There have been some bugs I've noticed so I will probably log all console messages to the syslog.txt file as soon as I can including all those malware hack attacks I see coming in :) Please please hack the Prop, I wanna see you try.
  • D.PD.P Posts: 790
    edited 2014-02-13 18:38
    I've gotten back into doing a little bit more with the webserver and ftp, sorting out timeouts and ftp clients. Even though I am still doing some testing and adjusting I will probably leave a Prop hooked up at tachyonforth.com as it also hosts a straight clone of the "Introduction to Tachyon Forth" as the home page (although the TOC links still point to the Google doc at present). There are various types of files I leave on the card for testing including PDFs, and images etc and I will also include all the source code pages too. So a Tachyon Forth Prop is hosting a website about itself, for itself!

    The unit will also have random text selections sent to it's RS232 port so it will be logging that also and normally you can see the text file by going to tachyonforth.com/log0001.txt etc. There have been some bugs I've noticed so I will probably log all console messages to the syslog.txt file as soon as I can including all those malware hack attacks I see coming in :) Please please hack the Prop, I wanna see you try.

    Probably got it between builds:
     *No Card inserted!* *Card Error* *Card Error*  *No Card inserted!* *Card Error* *Card Error* HTTP/1.1 200 OK
    Date: Tue, 03 Dec 2013 04:19:05 GMT
    Server: Tachyon Forth 
    Last Modified: Tue, 08 Nov 2011 05:41:05 GMT
    Accept-Ranges: bytes
    Content-Length: 0000
    Connection: close
    Content-Type: text/html
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-13 18:40
    D.P wrote: »
    Probably got it between builds:
     *No Card inserted!* *Card Error* *Card Error*  *No Card inserted!* *Card Error* *Card Error* HTTP/1.1 200 OK
    Date: Tue, 03 Dec 2013 04:19:05 GMT
    Server: Tachyon Forth 
    Last Modified: Tue, 08 Nov 2011 05:41:05 GMT
    Accept-Ranges: bytes
    Content-Length: 0000
    Connection: close
    Content-Type: text/html
    

    Yep, you did. I need to implement a STOR word now so I can transfer files to the card as well. That should take about 15 mins or so. So there will be times when it doesn't seem to work but just check back at random intervals (like now).

    BTW, ROM.BIN contains the binary image made by SAVEROM so if your system is 10MHz you can probably load this otherwise all the current source files are there.
Sign In or Register to comment.