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

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

1103104105106108

Comments

  • proplem wrote: »
    @Peter Jakacki,
    you commented out ERASE$ in (V3) EXTEND.FTH
    pub ERASE$ ( str -- \ Fully erase the string - reads max len from header )
            DUP 3 - C@ ERASE
            ;
    
    Is something wrong with it?

    Mainly because not all strings are created equal, that is, those strings that were constructed with the STRING function had an additional field specifying the maximum string length which ERASE$ could use but a common string is normally just a null terminated string without any special fields. Applying ERASE$ to these common null terminated strings would cause definite problems.

    But there is the problem with any general erase string function for who knows how long a string is or can be.

    btw, V4.3 is just about ready.

  • Hi Peter,

    I know how the OK word can be used to turn off the prompt
    off OK
    

    Is there a way to suppress the "ok" and just have a CR returned?

    Thanks
  • MJBMJB Posts: 1,235
    edited 2017-04-26 09:03
    @D.P
    read the source ...
    \\\ original
    pub NOOP ;
    pub OK ( on/off -- )		IF 0 ELSE ' NOOP THEN prompt 2+ W! ; \ enable/disable OK prompts including the autospace )
    
    \\ so you can do:\
    pub MYPROMPT CR ;
    
    ' MYPROMPT  prompt 2+ W!   
    
    \\to get the original prompt back:
    prompt 2+ W~
    \\ or simply
    ON OK
    
    TESTED !! ;-)
  • Okay, the ESP8266 front end is really close now. But if the ESP is connected to prop pins 31/30 during ESP boot it resets Tachyon?

    The ESP bootloader produces this "init string" at 744000 baud before it engages the set baud rate.

    While you can divert debug message to the aux ESP serial port you cannot divert this output _Until the ESP boots.

    How can we prevent Tachyon V3 from rebooting from this initial "junk"?

    Thanks

    1739 x 121 - 7K
  • MJBMJB Posts: 1,235
    D.P wrote: »
    Okay, the ESP8266 front end is really close now. But if the ESP is connected to prop pins 31/30 during ESP boot it resets Tachyon?

    The ESP bootloader produces this "init string" at 744000 baud before it engages the set baud rate.

    While you can divert debug message to the aux ESP serial port you cannot divert this output _Until the ESP boots.

    How can we prevent Tachyon V3 from rebooting from this initial "junk"?

    Thanks

    is this 'junk' random or fixed?
    if fixed, what is it exactly in hex? any ^C in there ??

  • D.PD.P Posts: 790
    edited 2017-05-17 21:57
    The baud is 74880 and the message is constant for a given build. That ~ld could be the end load symbol perhaps
     ets Jan  8 2013,rst cause:1, boot mode:(3,0)
    
    load 0x4010f000, len 1384, room 16 
    tail 8
    chksum 0x2d
    csum 0x2d
    v3de0c112
    ~ld
    

    UPDATE:
    Setting the world to 74880 baud and testing is still causing a tachyon reboot even as I guard against this ESP8266 boot message. Time to sniff the stream for clues.
  • D.PD.P Posts: 790
    edited 2017-05-18 20:17
    Decided to implement software serial on 2 of the 4 available io pins to handle just the Propeller serial interface to Tachyon. This avoids all the ESP kernel boot messages now. So now the ESP can reset independent of the Tachyon Machine.

    Works well.



    D.P wrote: »
    The baud is 74880 and the message is constant for a given build. That ~ld could be the end load symbol perhaps

  • D.P wrote: »
    Decided to implement software serial on 2 of the 4 available io pins to handle just the Propeller serial interface to Tachyon. This avoids all the ESP kernel boot messages now. So now the ESP can reset independent of the Tachyon Machine.

    Works well.



    D.P wrote: »
    The baud is 74880 and the message is constant for a given build. That ~ld could be the end load symbol perhaps

    Good stuff, can't wait to see how you are using it. Come to think of it, while you are on a roll, maybe you could get the F32 interface up and running! :)

  • D.PD.P Posts: 790
    edited 2017-05-19 15:11
    D.P wrote: »
    Decided to implement software serial on 2 of the 4 available io pins to handle just the Propeller serial interface to Tachyon. This avoids all the ESP kernel boot messages now. So now the ESP can reset independent of the Tachyon Machine.

    Works well.



    D.P wrote: »
    The baud is 74880 and the message is constant for a given build. That ~ld could be the end load symbol perhaps

    Good stuff, can't wait to see how you are using it. Come to think of it, while you are on a roll, maybe you could get the F32 interface up and running! :)

    It seems that I should begin another journey and move my code bases to V4.4. That's probably gonna leave a mark. As for F32 some very basic pseudo code would help me unblock. On another note I'm currently implementing prooph and "event sourcing" on a complex phylogenic dataset with a mentor, the rabbit hole is deep here. So just a little pseudo code nudge would help F32 get to TOS. Also I am getting a non-critical intermittent websocket terminal disconnect that I need to debug on the ESP frontend. Now that the hardware serial port is "free" I've got the ability to debug the ESP again live. But no matter what happens to the ESP now it leaves the Tachyon machine running just fine i.e. leave the washing machine alone. Separation of concerns, my FONA module which is UI-ish will also get moved the the ESP.

  • I'm trying to make the jump from 2.7 to 4.4. Woopeee! I believe I read somewhere in the documentation that it can't be compiled in the PropTool. So I installed the Simple (Talk about a rich joke) IDE. I have been very comfortable working with the PropTool, TerraTerm and the SemWare Programming Editor -- but now SIDE wants to relieve me of that "burden" with projects and libraries etc. Ok, fine if we must, but how do I compile Tachyon V4.4-list.spin when I can't even load it? SIDE insists that I open a project but when I try to do so it requires a .c or .c++ extension. From the SIDE pdf file "New: Opens a dialog to select folder, project name, and project type (C or C++)."
    HALP!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-05-29 13:12
    artkennedy wrote: »
    I'm trying to make the jump from 2.7 to 4.4. Woopeee! I believe I read somewhere in the documentation that it can't be compiled in the PropTool. So I installed the Simple (Talk about a rich joke) IDE. I have been very comfortable working with the PropTool, TerraTerm and the SemWare Programming Editor -- but now SIDE wants to relieve me of that "burden" with projects and libraries etc. Ok, fine if we must, but how do I compile Tachyon V4.4-list.spin when I can't even load it? SIDE insists that I open a project but when I try to do so it requires a .c or .c++ extension. From the SIDE pdf file "New: Opens a dialog to select folder, project name, and project type (C or C++)."
    HALP!

    There was something at one time which was nothing more than a missing org which threw Proptool off but that was then fixed. Head on over to to the V4 thread if it is anything V4 specific.

    edit - here's the proof 4.4 compiles fine on Proptool
    proptool%20compile.png


    Btw, I tried to paste Forth source into Mecrisp Forth on Arm M0 and boy do I have to slow it down to 1ms character delay and 50ms line delay for it to compile. Tachyon with 5ms line delay and zero character delay just positively zips along.
  • D.PD.P Posts: 790
    edited 2017-05-30 15:01
    deleted
  • I need to display the contents of a variable in 32 bit binary form. Here are my attempts.

    relays_locked @ $1002 PRINTNUM 0000000010000000
    relays_locked @ $1802 PRINTNUM 000000010000000010000000
    relays_locked @ $1F02 PRINTNUM 0000000
    relays_locked @ $1C02 PRINTNUM 000
    relays_locked @ $1402 PRINTNUM 00010000000010000000
    relays_locked @ $1202 PRINTNUM 010000000010000000
    relays_locked @ $1102 PRINTNUM 10000000010000000

    I expected that $1F02 would show 31 bits. Am I missing something? ...still running Tachyon 2.7
  • MJBMJB Posts: 1,235
    I get similar, slightly different behaviour under V4.5

    tried to debug and DUMP the pad but Tachyon reboots ... :-(

    use this as a workaround
    relays_locked @ L>W $1002 PRINTNUM $1002 PRINTNUM
    
  • can this eeprom be used for 64k tachyon systems and replace the 32k on the PPDB?

    http://www.newark.com/microchip/24lc512-i-p/serial-eeprom-512kbit-400khz-dip/dp/62K0581
  • V2.7 and other versions may have had a problem with really long numbers as the digit buffer builds down and most numbers aren't more than 13 characters long including commas etc. IIRC I allow 23 bytes.
    MJBs solution works, maybe I'll add a .BIN to extend.

    @Shawn - any of those eeprom are fine.
  • Rather than make the number output buffer long enough for formatted binary numbers it's rather a simple matter to have a specialized word for this.
    Here's what I've added to EXTEND in V4.5 but the same can be done with older versions:

    console output
    ..  pub .BIN16  $5002 PRINTNUM ; 
    ..  pub .BIN32  L>W '%' EMIT .BIN16 '_' EMIT .BIN16 ; 
    ..   
    ..  0 @ .BIN32 %0000_0101_1011_1000_1101_1000_0000_0000 ok
    
  • Thanks for checking. I'm using very similar DUP 16 SHR instead of L>W. Guess I'll check that word out and learn something.

    use this as a workaround
    relays_locked @ L>W $1002 PRINTNUM $1002 PRINTNUM
    
    [/quote]

  • I am somewhat confused about the SWITCH CASE BREAK structure.
    It seems to lack a default clause option and an END SWITCH.

    I am accustomed to the CASE structure in the hp48 calculators:
    CASE
    test clause 1 THEN
    set of actions 1
    END
    test clause 2 THEN
    set of actions 2
    END
    ...
    test clause n THEN
    set of actions n
    END
    default set of actions
    END

    So I guess what I want is a way to do the same thing in Tachyon.
    Am I missing something?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-09-21 09:01
    @artkennedy - the case structure in Tachyon is designed to be flexible but because a BREAK can cause an early exit it is only suitable if it is used as a subroutine word rather than inline. For this reason once all the CASE BREAK statements have been exhausted then it will run any code after that by default so there is no need to specify this explicitly since it is implicit.

    Here is a simple sample of how to use it.
    pub MYCASE ( val -- )
    	--- store value to SWITCH register
    	SWITCH
    	$0D CASE PRINT"  Welcome!" CR BREAK
    	$20 CASE PRINT"  <making room> " BREAK
    	--- discard return address to escape
    	$1B CASE R> DROP PRINT" Escaping " CR BREAK
    	--- default is just to echo the character
    	SWITCH@ EMIT
    	;
    
    pub DEMOCASE	BEGIN KEY MYCASE AGAIN ;
    

    You can see that MYCASE was not coded inline with DEMOCASE but called so that any active CASE BREAK can return early.

    console test
    ..  DEMOCASE 123 <making room> 123 Welcome!
    NOW <making room> IS <making room> THE <making room>  Welcome!
     Welcome!
    Escaping 
     ok
    


  • "it is only suitable if it is used as a subroutine word rather than inline"

    Had a feeling that was the "case" but wanted to be sure. Thanks.
  • Just fired up v 4.5 and loaded Extend.fth for 4.5. Been poking around with my DS3231 and like what's been done to support it, including the temperature!
  • What's the advantage to using "pub" instead of ":" in defining a word?

    Thanks!

    Michael
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-01-03 00:29
    K6MLE wrote: »
    What's the advantage to using "pub" instead of ":" in defining a word?

    Thanks!

    Michael

    The use of pub and pri initially arose from wanting to make it more readable for many who were already familiar with Spin but couldn't seem to recognize the significance of the tiny : symbol. At the same time though I saw it as a mechanism whereby I could modify the header attributes to indicate that it was a private header and thus suitable for identifying when reclaiming memory, thus making them "private" :)
    Since the headers are packed end to end in a separate dictionary space these private headers can be removed and the dictionary recompacted easily. Now if you use : it may compile with a private attribute depending upon any preceding PUBLIC or PRIVATE directive which is normally used to set the batch attribute for constants and variables.

    Since then in harmony with the 3 letter "pxx" naming I also introduced "pre" for immediate or pre-emptive words that normally in Forth had an ugly IMMEDIATE directive. Overall I think the pub/pri/pre is quite clean and readable but using : does not impact normal operation although the IMMEDIATE word has been removed and it is necessary to use pre in those instances. If you are coding a large project and you want some control over what is visible in the dictionary and/or you need to reclaim memory, then use pub/pri.

  • Thanks, Peter!
    I'm playing with the DS3231 and MAX7219. Just working through the exercise of displaying the date, time and temperature data on the 8-digit display.
  • MJBMJB Posts: 1,235
    edited 2018-01-03 20:39
    K6MLE wrote: »
    Thanks, Peter!
    I'm playing with the DS3231 and MAX7219. Just working through the exercise of displaying the date, time and temperature data on the 8-digit display.

    this MAX7219 driver is from 2016 - did not try if it runs still on V4.5
    / after some modifications now loads fine on 4.5
    ... but I did not test - no HW set up right now
    TACHYON 
    FORGET MAX7219.fth
    pub MAX7219.fth		PRINT" MAX7219/7221 8-digit LED Driver by PBJ 160407-0000 " ;
    
    DECIMAL
    
    {
    2018-01-03 MJB modified for V4.5 but not tested, loads without errors.
    PBJ - Simplified version originally based on MJB's Tachyon code also makes it a totally streaming character output device
    Just select MAX7219 as the output device and driver handles special controls etc 
    This driver does not require a dedicated cog. 
    Characters to be displayed are maintained in a buffer and the display is updated for every new character
    The driver may be modified slightly to update the display only on a CR which will make it faster.
    
    
    160408 - added 7-segment decode table for all characters and symbols
    	- modified MJBs scroll and fixed a few little things up
    
    NAMES:  $5541...7173 for 7,218 bytes (+101)
    CODE:   $0924...46D0 for 15,788 bytes (+443)
    
    To specify ledpins have them defined before loading or else use "&xx.xx.xx.xx TO ledpins" to set
    
    }
    
    IFNDEF ledpins				--- use default if none is defined
    &14.12.13.15	== ledpins		--- setup hardware pinout as &ce.xx.mosi.sck (default=breadboard)
    --- &14.12.13.15 TO ledpins
    
    }
    0		== ledce		--- dummy chip enable pin gets set automatically
    --- &14.12.13.15 TO ledpins   ( ce.miso.mosi.clk --- ) \ 
    
    10 BYTES ledbuf				--- character write position plus 8 characters
    
    
    pub LED! ( val reg -- )			SPIWRB DROP SPIWRB DROP ledce HIGH ;
    
    --- refresh the display by copying the ledbuf to the chip - <182us
    --- pub REFRESH				9 1 DO ledbuf I + C@ I LED! LOOP ;	
    pub REFRESH				10 FOR ledbuf I + C@ I LED! NEXT ;	
    
    
    ( ASCII to 7-segment LED decode table - all characters and symbols )
    \  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    {
    TABLE 7segs 
    	$00 | $86 | $42 | $49 | $2D | $52 | $5B | $02 |			--- $20..$27  !"#$%&'
    	$39 | $0F | $C9 | $46 | $04 | $40 | $80 | $52 |			--- $28..$2F ()*+,-./
    	$3F | $06 | $5B | $4F | $66 | $6D | $7D | $07 |			--- $30..$37 01234567
    	$7F | $6F | $41 | $45 | $70 | $48 | $46 | $D3 |			--- $38..$3F 89:;<=>?
    	$7B | $77 | $7C | $39 | $5E | $79 | $71 | $3D |			--- $40..$47 @ABCDEFG
    	$76 | $30 | $0E | $72 | $38 | $23 | $54 | $5C |			--- $48..$4F HIJKLMNO
    	$73 | $7B | $50 | $6D | $46 | $3E | $62 | $1D |			--- $50..$57 PQRSTUVW
    	$52 | $6E | $5B | $39 | $64 | $0F | $01 | $08 |			--- $58..$5F XYZ[\]^_
    	$20 | $77 | $7C | $39 | $5E | $79 | $71 | $3D |			--- $60..$67 `abcdefg
    	$76 | $30 | $0E | $72 | $38 | $23 | $54 | $5C |			--- $68..$6F hijklmno
    	$73 | $79 | $50 | $6D | $46 | $3E | $62 | $1D |			--- $70..$77 pqrstuvw
    	$52 | $6E | $5B | $39 | $36 | $0F | $52 | $00 |			--- $78..$7F xyz{|}~
    }
    \  bits needed to be flipped because of required bit order
    TABLE 7segs 	
    	$00 | $BB | $23 | $4D | $60 | $27 | $74 | $22 |			--- $20..$27  !"#$%&'
    	$53 | $80 | $D6 | $34 | $11 | $01 | $88 | $27 |			--- $28..$2F ()*+,-./
    	$86 | $33 | $74 | $81 | $36 | $61 | $65 | $77 |			--- $30..$37 01234567
    	$87 | $83 | $45 | $56 | $07 | $09 | $34 | $04 |			--- $38..$3F 89:;<=>?
    	$76 | $7E | $21 | $53 | $41 | $54 | $4B | $64 |			--- $40..$47 @ABCDEFG
    	$3A | $06 | $3B | $29 | $0E | $68 | $16 | $1E |			--- $48..$4F HIJKLMNO
    	$6D | $76 | $05 | $61 | $34 | $42 | $25 | $62 |			--- $50..$57 PQRSTUVW
    	$27 | $3E | $74 | $53 | $14 | $80 | $44 | $08 |			--- $58..$5F XYZ[\]^_
    	$02 | $7E | $21 | $53 | $41 | $54 | $4B | $64 |			--- $60..$67 `abcdefg
    	$3A | $06 | $3B | $29 | $0E | $68 | $16 | $1E |			--- $68..$6F hijklmno
    	$6D | $54 | $05 | $61 | $34 | $42 | $25 | $62 |			--- $70..$77 pqrstuvw
    	$27 | $3E | $74 | $53 | $39 | $80 | $27 | $00 |			--- $78..$7F xyz{|}~	
    
    	
    	
    pub (LED) ( char -- )
        SWITCH								--- use the ASCII value as a switch in the case statement
        ^M  CASE ledbuf C~ BREAK						--- on CR reset display pos
        ^J  CASE ledbuf 1+ 8 ERASE BREAK					--- erase line but don't update yet
        ^L  CASE ledbuf 9 ERASE REFRESH BREAK				--- reset and blank
        ^N  CASE 1 12 LED! BREAK						--- enable display (unblank)
        ^O  CASE 0 12 LED! BREAK						--- disable display (blank)
        '.' CASE $80 ledbuf C@ 1- 7 AND ledbuf 1+ + C+! REFRESH BREAK	--- add in DP to previous character (or first)
        SWITCH@ $10 < IF BREAK						--- ignore any other controls <$10
        SWITCH@ $20 < IF SWITCH@ >N 10 LED! BREAK				--- set 4-bit brightness $10..$1F
        ( char is printable )
        ledbuf C@ >N 7 > 
          IF ledbuf 2+ ledbuf 1+ 7 CMOVE ledbuf C-- 50 ms THEN		--- scroll if at end but slowly so it can be read
        SWITCH@ $20 - 7segs + C@						--- decode character to 8 segments
    	DUP $7F AND 25 REV SWAP $80 AND OR 
        ledbuf C@ 7 AND ledbuf 1+ + C!					--- display it as a character
        ledbuf C++								--- increment position 
        REFRESH
    ;
    
    --- requires around 300us per character where 180us of that is the display refresh
    pub >LED ( char -- )
        ledbuf @ 0=						--- initialise the display if necessary (all zeros on startup)
        IF 
          ledpins SPIPINS					--- setup masks used by SPI instructions
          @SPISCK 3 + COG@ >| ' ledce 1+ !		--- automatically setup chip enable pin constant 
          ledce HIGH					--- ensure chip enable is and output and set to off
          @SPISCK COG@ OUTCLR				--- MAX7219 likes to work with clock low to high
          7 11 LED!						--- scan limit for 8 digits
          0 9 LED!						--- no decode, use table 
          0 15 LED!						--- don't forget to reset TEST mode
          $18 (LED)						--- SET BRIGHTNESS
          ^L (LED)						--- clear the display
          ^N (LED)						--- enable display
        THEN
       (LED)
    ;
    
    --- Switch Tachyon character output to the MAX7219 LED display
    --- i.e. MAX7219 CR PRINT" HELP" 123 PRINT CON
    pub MAX7219		' >LED uemit W! ;
    
    { Optional debug routine to view decode table
    pub .SEGS ( ch -- )
    	BL - 7segs + C@
    	CR DUP 1 AND IF PRINT"  __" THEN
    	CR DUP $20 AND IF '|' ELSE BL THEN EMIT
    	DUP $40 AND IF PRINT" __" ELSE 2 SPACES THEN
    	DUP 2 AND IF '|' ELSE BL THEN EMIT
    	CR DUP $10 AND IF '|' ELSE BL THEN EMIT
    	DUP 8 AND IF PRINT" __" ELSE 2 SPACES THEN
    	DUP 4 AND IF '|' ELSE BL THEN EMIT
    	$80 AND IF '.' EMIT THEN
    ; 	
    
    ( run this 1-liner to view all characters and symbols )
    / $7F $20 DO I .SEGS CR I .BYTE SPACE I EMIT PRINT"  =$" I BL - 7segs + C@ .BYTE CR LOOP 
    
     $20 FROM $7F FOR I .SEGS CR I .BYTE SPACE I EMIT PRINT"  =$" I $20 - 7segs + C@ .BYTE CR NEXT 
    }
    
    
    END
    
    
    
    
    
  • Hi MJB,
    Your routines work in 'no-decode' mode on the 7219, but not 'mode-b', correct?
  • The driver is designed for character i/o, not just numbers so it initialises into raw mode as there is no advantage otherwise.
    I think the internal digit decode is fine for numeric only displays or very limited resource micros which would be typically of the 7219 vintage.
    MAX7219 PRINT" HELLO!" CON
    
  • Thanks, Peter.
    I've altered my own code to not reflect mode-B at all and it's much more versatile!
  • Has anyone written the code to support the RA8875 display board from Adafruit? I'm attempting to do this, but didn't want to reinvent the wheel. It will be my first 'driver' foray with Tachyon!
Sign In or Register to comment.