Shop OBEX P1 Docs P2 Docs Learn Events
PropForth 3.2 is available — Parallax Forums

PropForth 3.2 is available

prof_brainoprof_braino Posts: 4,313
edited 2010-09-06 19:04 in Propeller 1
Please note: PropForth 3.4 is now the current release as of 2010-Sept-05

http://forums.parallax.com/showthread.php?p=936909#post936909

The new version of PropForth is available on Google code
http://code.google.com/p/propforth/

The PropForth version 3.2 file set is a single archive download.

This version uses descriptive names and a (hopefully) clearer naming convention.

The README.txt file included in the archive includes a list of the name changes to help bring forward any existing code.

There are 10 types of people in the world,
Those who understand binary, and those who don't
«134

Comments

  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-11 16:46
    I imagine there's a logic to it, but aside from baffle-the-user I don't know what it is. So, here's my question: Why on earth would $C_ represent a Hub address, and why on earth would $H_ represent a Cog address? And why haven't they been swapped, for clarity of thought and intent?
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-11 17:54
    Fred Hawkins said...
    I imagine there's a logic to it, but aside from baffle-the-user I don't know what it is. So, here's my question: Why on earth would $C_ represent a Hub address, and why on earth would $H_ represent a Cog address? And why haven't they been swapped, for clarity of thought and intent?

    Sounds like a typo. Can you let me know where you saw it so I can take a look at it?

    [noparse][[/noparse]edited after examination]

    I think I found what you were referencing:

    http://code.google.com/p/propforth/wiki/PropForthTechnicalDocumentation

    had the explanations swapped for $C_ and $H_. It is fixed now, the explanation is consistent with the actual code and how you would expect it.

    Thanks for pointing this out. We don't have the resources to to review everything properly, so this kind of error can slip by.

    If something looks kooky, it's probably a mistake; just let me know and I'll fix it.

    cheers!

    Braino

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't

    Post Edited (prof_braino) : 7/12/2010 2:53:17 AM GMT
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-12 20:56
    I am a relative beginner at Forth (have been for 20+ years, just never got around to really getting serious about it). This PropForth has me intrigued and I am looking forward to working with it on the prop. I dusted off an old book I have on Forth and was even able to (with the help of Amazon) locate an allegedly 'mint condition' copy of "Starting Forth," as well as an eval copy of SwiftForth to use.

    I think that I have been all through the PropForth google site and I have been so far unable to find a doc or a list that contains the PropForth dictionary. I am particularly interested in the Prop's uniquenesses, i.e., setting pins as I or O, reading/setting pins, grouping pins as a single variable, access to counters, etc ... is there such a doc?

    Keep up the great work ...... cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-12 21:41
    prof_braino said...
    Fred Hawkins said...
    I imagine there's a logic to it, but aside from baffle-the-user I don't know what it is. So, here's my question: Why on earth would $C_ represent a Hub address, and why on earth would $H_ represent a Cog address? And why haven't they been swapped, for clarity of thought and intent?

    Sounds like a typo. ... [noparse][[/noparse]fixed]
    That's a relief, thanks.

    What would be real useful would be a simple archive that contains all of·PropForth's how-to pages.·That would be useful, especially if your latest version significantly morphs away from the older version and the how-to's·no longer match.

    Post Edited (Fred Hawkins) : 7/12/2010 9:59:42 PM GMT
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-12 21:47
    Brian Riley said...
    I am a relative beginner at Forth (have been for 20+ years, just never got around to really getting serious about it). This PropForth has me intrigued and I am looking forward to working with it on the prop. I dusted off an old book I have on Forth and was even able to (with the help of Amazon) locate an allegedly 'mint condition' copy of "Starting Forth," as well as an eval copy of SwiftForth to use.

    I think that I have been all through the PropForth google site and I have been so far unable to find a doc or a list that contains the PropForth dictionary. I am particularly interested in the Prop's uniquenesses, i.e., setting pins as I or O, reading/setting pins, grouping pins as a single variable, access to counters, etc ... is there such a doc?

    Keep up the great work ...... cheers ... BBR

    PropForth's GettingStarted·page says, "Documentation for the words in PropForth are in PropForthPart1.f and PropForthPart2.f."

    Nb:those last 2 links don't work. Both files are inside the both the 3.2 and 2.7 download archives under the same names. (in other words keep the versions·separate)



    Post Edited (Fred Hawkins) : 7/12/2010 9:56:11 PM GMT
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-12 22:18
    Fred Hawkins said...
    What would be real useful would be a simple archive that contains all of PropForth's how-to pages. That would be useful, especially if your latest version significantly morphs away from the older version and the how-to's no longer match.

    What he said! +1

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-12 22:49
    Thanks, Fred, that was very helpful. Much of those two files made sense to my lightly experienced eyes, but the Prop-specific was all Greek to me.

    Could one of you guys show some simple code to do BlinkLED ? say, blink an LED on pin 4, 1/2 second on, 1 second off in an endless loop.

    Thanks in advance ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-12 23:17
    Documentation is supposed to be in the source, except where the author is more clever than I can understand. Please ask questions and we will add more documentation on the google code site.

    Type in

    words

    at the forth prompt, this gives the entire dictionary in order

    Also, all the source for the words is in PropForthPart1 and PRopForthpart2

    The structure of the dictionary and the tasker is in propforth.spin but we didn't have any questions on that yet, so we didn't add any comments to the original

    You can get nearly all the forth books online as pdf downloads.

    Oh, I see Fred already responded. Glad to see this is getting used a little.

    Cheers guys!
    Brian Riley said...
    I am a relative beginner at Forth (have been for 20+ years, just never got around to really getting serious about it). This PropForth has me intrigued and I am looking forward to working with it on the prop. I dusted off an old book I have on Forth and was even able to (with the help of Amazon) locate an allegedly 'mint condition' copy of "Starting Forth," as well as an eval copy of SwiftForth to use.

    I think that I have been all through the PropForth google site and I have been so far unable to find a doc or a list that contains the PropForth dictionary. I am particularly interested in the Prop's uniquenesses, i.e., setting pins as I or O, reading/setting pins, grouping pins as a single variable, access to counters, etc ... is there such a doc?

    Keep up the great work ...... cheers ... BBR
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-13 01:43
    Brian Riley said...
    Thanks, Fred, that was very helpful. Much of those two files made sense to my lightly experienced eyes, but the Prop-specific was all Greek to me.

    Could one of you guys show some simple code to do BlinkLED ? say, blink an LED on pin 4, 1/2 second on, 1 second off in an endless loop.

    Thanks in advance ... BBR

    This is what I used with PropForth v2.5 for the 'make and LED blink' thread. http://forums.parallax.com/forums/default.aspx?f=25&p=1&m=427618
    There are two examples, the first one is long with many comments, the second one is for when you want to make life miserable for the next person that has to read it. I think the word 'variable' needs to change to 'wvariable' but you get the idea. They are pretty straight forward let me know if you have problems.

    \ FLASH AN LED using PROPFORTH 2.5 (new version of salsanci spinforth 1.1, not propellerforth from Cliffe Biffle)
    \ load PropForth.spin into eeprom and use teraterm 1 ms per char and 1 ms per line 38400 baud worked best for me
    \ save as file and "send file" in teraterm
    \ unmodified demo board
    \ sorry but I didn't get the parenthesis comments to work so the
    \ stack notes are at the end of each line (it looks funny to me, too)
    \ I always put in too many comments, force of habit [noparse]:)[/noparse]
    \
    \ each unit of functionality is implemented as a single word
    \ when each word is functioning correctly, string them together

    variable w-delay \ ( uses w@ w! time delay in milliseconds )
    : !DELAY w-delay w! ; \ ( ms - ) ( store the milliseconds to wait )
    : .DELAY w-delay w@ del_ms ; \ ( - ) ( wait for milliseconds in delay )

    : pin16-output 10000 dira ! ; \ ( - ) ( make pin16 output )
    : pin16-hi 10000 outa ! ; \ ( - ) ( make pin16 high LED ON )
    : pin16-lo 0 outa ! ; \ ( - ) ( make pin16 low LED OFF )

    \ ... string them together...

    : flash16 pin16-hi .DELAY pin16-lo .DELAY ; \ ( - ) ( flash LED using DELAY )

    \ ... and put it in a loop

    : FLASHES pin16-output 0 do flash16 loop ; \ ( number of flashes desired - )

    \ After one has determined what code is needed, it is possible to
    \ cram everything into a single word
    \ doing everything all in one word is sometimes refered to as
    \ write only code (write once - edit never again )
    \ this takes slightly less space but can be confusing on larger applications
    \ after the code has been left alone for a few days

    : ALL-ONE-WORD \ ( flashes - )
    10000 dira ! \ ( make pin16 output )
    0 do \ flashes to 0 DO ...
    10000 outa ! \ ( make pin16 high LED ON )
    100 del_ms \ ( delay for 100 ms)
    0 outa ! \ ( make pin16 low LED OFF )
    100 del_ms
    loop ;

    10 ALL-ONE-WORD
    \ next use the other method

    50 !DELAY
    20 FLASHES

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-13 04:25
    prof_braino said...
    Documentation is supposed to be in the source, except where the author is more clever than I can understand. Please ask questions and we will add more documentation on the google code site.

    Type in

    words

    at the forth prompt, this gives the entire dictionary in order

    Also, all the source for the words is in PropForthPart1 and PRopForthpart2

    The structure of the dictionary and the tasker is in propforth.spin but we didn't have any questions on that yet, so we didn't add any comments to the original

    You can get nearly all the forth books online as pdf downloads.

    Oh, I see Fred already responded. Glad to see this is getting used a little.

    Cheers guys!

    Thanks for the help ... I have 3.2 up and running on an old demo board (rev B 32k EEPROM) Does PropForth make use of a 64K EEPROM? I have several PropPlatforms with 2 64K EEPROMS is there any mods that would make use of the extra space?

    "Starting Forth" is only available on the web as HTML ... no coherent PDF. When my copy arrives I will make it a point to attempt to do as many of the exercises using just PropForth and see how far I get.

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-13 13:12
    Brian Riley said...

    Thanks for the help ... I have 3.2 up and running on an old demo board (rev B 32k EEPROM) Does PropForth make use of a 64K EEPROM? I have several PropPlatforms with 2 64K EEPROMS is there any mods that would make use of the extra space?

    ... BBR
    Sal's dev setup has 64k eeproms so I think yours should work, post if you notice issues. The only issue encountered was the 64k part supports 64 byte page write, while the stock demo board 32k part only supports 32 byte page write. Now, the eeptom uses only 32 byte page write and it works on all platforms test. This is in the docs somewhere, it is also in the propforth.spin 2.7 comments at the line where the value is coded.
    The only other thing I can think of is there might be something about the end of eeprom memory. There is either a constant for the max address, or it just goes and goes until it runs out (and crashes) and the user is responsible for keeping track if there is enough space. We tested in parallel and my demo board ran out of space once when I tried to load a particularly huge file using the FL (file load) command. But this is solved by breaking large files into smaller files and loading in multiple FL steps. You probably won't encounter these issues until you get further alone in experimenting, by which point it might be apparent what to do. In any case post issues and we will fix 'em.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't

    Post Edited (prof_braino) : 7/13/2010 1:42:22 PM GMT
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-13 14:42
    Thanks for your comments so far, they are a big help.
    Fred Hawkins said...

    What would be real useful would be a simple archive that contains all of PropForth's how-to pages. That would be useful, especially if your latest version significantly morphs away from the older version and the how-to's no longer match.

    This is something we are trying to do, but it keeps getting away from us due to the trade-off of new functionality versus complete documentation. Unfortunately, the documentation is trailing the code. Since we have limited resources, we only address items that are brought to our attention and thus placed near the top of the list. Your comments are driving corrections, the most specific comments and questions have the best chance of getting addressed sooner.

    I haven't had time to go through all Sal's original documentation (v2.4) and decode it into earth-speak, and therefore have not updated some to version 2.5, 2.7 or 3.2.
    Also, I haven't deleted anything, since key information is present, I just don't understand it yet. So it has been left as a reference in case someone smarter than I can use it. Old versions can be accessed through the search filter "DEPRACATED" in google code.

    What I have done is add information to the Main Page http://code.google.com/p/propforth/wiki/PropForth
    and to the FAQ http://code.google.com/p/propforth/wiki/PropForthFAQ

    The links listed on the Main Page if read in the sequence presented, should get you to the current state of the project (if the documentation is "clear and unambiguous", please point out where it is otherwise). The links on the main page listed as "under review" may or may not be useful, please read them if you get that far and post if there are problems.

    The FAQ was up-to-date as of v2.7. As questions come in (like these) I will start adding the v3.2 section at the top, and tagging the old answers in the v2.7 section that that will be the existing stuff and leave this at the bottom. Possibly later today.

    If you look at the wiki tab and try to read any of the pages that are NOT linked from the main page, you will most likely run across stuff that is out of date or inaccurate. If you would please let me know the problems, I can ask specific questions and post the answers.

    What I am asking for: Please flag the specific instances that cause you an issue, and post or PM to me or to the page (using 'comments' st the bottom)

    Note: The author, Sal Sanci, only does the low-level stuff (the fun part), and leaves the higher level testing, documentation and posting (the other fun part) to me. So I have to understand an issue enough to ask a specific question, otherwise the issue might not make it to the top of the fix-this-today list.

    Note to self: I should probably add all this to the FAQ, and edit this out when its done.

    Cheers

    braino

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • caskazcaskaz Posts: 957
    edited 2010-07-14 09:49
    Hi.
    I updated v3.2.
    And I changed lcd.f to v3.2. (mpxl->_maskoutlo @->COG@ mpxh->_maskouthi !->COG! pxo->pinout del_ms->delms)
    lcd.f work fine on v2.7.

    fl
    
    : command 
      2 _maskoutlo 4 _maskoutlo                \ A0 = L  WRX = L
      3 lshift outa COG@ or outa COG!            \ outa <-- data
      4 _maskouthi 2 _maskouthi                \ WRX = H A0 = H 
      FFFFF807 outa COG@ and outa COG!
    ;
    
    : parameter
      4 _maskoutlo                    \ WRX = L
      3 lshift outa COG@ or outa COG!            \ outa <-- data
      4 _maskouthi                \ WRX = H     
      FFFFF807 outa COG@ and outa COG!    \ D0 - D7(P3 - P10) clear
    ;
    
    : lcd_initial
       0 b 0 do dup pinout 1+ loop drop        \ P0 - P10 output set
      1 dup _maskouthi _maskoutlo            \ RESX P0 = H to L
      2 _maskouthi                \ A0 P1 = H
      4 _maskouthi                \ WRX P2 = H
      1 delms
      1 _maskouthi                \ RESX P0 = H
      1 delms
      CA command                \ Timing Control
      C parameter
      3 parameter
      0 parameter
      D parameter
      3 parameter
      28 parameter
      0 parameter
    
      30 delms
      94 command                \ Sleep Disable
      200 delms
      5C command 88 A710 0 do dup parameter loop drop    \ V-ram initilize
      AF command                \ Display On
    ;
    
    



    Loaded lcd.f, error occurred.
    Message:
    Cog6 ok

    : command
    2 _maskoutlo 4 _maskoutlo 3 lshift outa COG@ or outa COG! 4 _maskouthi 2 _maskouthi FFFFF807 outa COG@ and outUNDEFINED WORD out
    Cog6 ok

    Changed comment out "FFFFF807 outa COG@ and outa COG!" on word command, error has gone.

    Why does error occur?
  • caskazcaskaz Posts: 957
    edited 2010-07-14 12:39
    Hi.
    It work fine after deleting 2-space-character in front of "FFFFF807 outa COG@ and outa COG!".
    I think WordPad is bad.

    And I have question.
    I' m going to make array of bitmap for LCD(132dot X 162dot) and font data for character.
    How does array make?

    caskaz
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-14 20:21
    I took that BlinkLED as a bit of a minor challenge and had no problem updating it to Prop 3.2 using the README.txt and the dictionary files. IT runs fine on a Rev B Demo board.

    \ FLASH AN LED by Professor Braino - updated from PropForth 2.5 by BrianBR
    \ using PROPFORTH 3.2 (a new version of salsanci spinforth 1.1)
    \ (This is NOT propellerforth from Cliffe Biffle)
    \ load PropForth.spin into eeprom and use a terminal program too 'send textile' at 1 ms per char / 1ms per line 
    \   PC/Win "teraterm"   Mac OSX "ZTerm" set to 57600 8n1  baud worked best for me
    \ 
    \ will run on an unmodified 'Demo' board
    \ each unit of functionality is implemented as a single word
    \ when each word is functioning correctly, string them together
    
    variable w-delay \ ( uses w@ w! time delay in milliseconds )
    : !DELAY w-delay W! ; \ ( ms - ) ( store the milliseconds to wait )
    : .DELAY w-delay W@ delms ; \ ( - ) ( wait for milliseconds in delay )
    
    : pin16-output 10000 dira COG! ; \ ( - ) ( make pin16 output )
    : pin16-hi 10000 outa COG! ; \ ( - ) ( make pin16 high LED ON )
    : pin16-lo 0 outa COG! ; \ ( - ) ( make pin16 low LED OFF )
    
    \ ... string them together...
    
    : flash16 pin16-hi .DELAY pin16-lo .DELAY ; \ ( - ) ( flash LED using DELAY )
    
    \ ... and put it in a loop
    
    : FLASHES pin16-output 0 do flash16 loop ; \ ( number of flashes desired - )
    
    \ After one has determined what code is needed, it is possible to
    \ cram everything into a single word
    \ doing everything all in one word is sometimes referred to as
    \ write only code (write once - edit never again )
    \ this takes slightly less space but can be confusing on larger applications
    \ after the code has been left alone for a few days
    
    : ALL-ONE-WORD \ ( flashes - )
    10000 dira COG! \ ( make pin16 output )
    0 do \ flashes to 0 DO ...
    10000 outa COG! \ ( make pin16 high LED ON )
    100 delms \ ( delay for 100 ms)
    0 outa COG! \ ( make pin16 low LED OFF )
    100 delms
    loop ;
    
    \ 10 ALL-ONE-WORD
    \ next use the other method
    
    \ 50 !DELAY
    \ 20 FLASHES
    
    
    



    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-14 22:49
    caskaz said...
    Hi.
    It work fine after deleting 2-space-character in front of "FFFFF807 outa COG@ and outa COG!".
    I think WordPad is bad.

    And I have question.
    I' m going to make array of bitmap for LCD(132dot X 162dot) and font data for character.
    How does array make?

    caskaz

    1. Note that you can get the UNDEFINED WORD message if the serial transmission is garbled, usually this does not happen when typing, but if you paste to tera terminal and do not your the FL (file-load) command at the start of the text pasted you can get serial overrun.

    2. When you use the fl command (file load) it streams the pasted text into a temporary area which is unused EEPROM, and then interpreters the pasted text from EEPROM, then releases the EEPROM back to unused space. BUT at one time the temporary buffer manager did NOT SET the pointer for the TEMPORARY BUFFER back when it releases the EEPROM. So after multiple pastes using fl, it thinks it ran out of EEPROM. I thought Sal fixed this but maybe this bug got back into the code. Please check if this is a factor and please inform me.

    3. WordPad also causes problems; I use PSPad http://www.pspad.com/ as my editor as it was free and the first thing that came up on google.

    4. The word "create" make a new dictionary entry as in

    create MyArray

    The word "allot" allocates space in the dictionary as in

    10 allot

    so the full usage would be

    create MyArray 10 allot
    
    



    the number base defaults to hex so 10 means 16 decimal,
    and the amount allocated is in words (I believe) so this will allocate 16 words in the data dictionary which is hub memory (accessed via W@ and W!);
    but I haven't used it yet and Sal is on holiday, so please experiment and post if reality is different than my explanation

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't

    Post Edited (prof_braino) : 7/14/2010 11:00:30 PM GMT
  • caskazcaskaz Posts: 957
    edited 2010-07-15 00:39
    Hi.
    Thanks prof_braino.
    prof_braino said...

    2. When you use the fl command (file load) it streams the pasted text into a temporary area which is unused EEPROM, and then interpreters the pasted text from EEPROM, then releases the EEPROM back to unused space. BUT at one time the temporary buffer manager did NOT SET the pointer for the TEMPORARY BUFFER back when it releases the EEPROM. So after multiple pastes using fl, it thinks it ran out of EEPROM.
    Sorry,I can't understand.
    I used "Send File" on Tera Term to upload lcd.f to Prop.
    I thought lcd.f uploaded to Prop's RAM.
    My idea is wrong?

    I try "create MyArray 10 allot".

    caskaz

    Post Edited (caskaz) : 7/15/2010 12:45:09 AM GMT
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-15 00:53
    Brian Riley said...
    I took that BlinkLED as a bit of a minor challenge and had no problem updating it to Prop 3.2 using the README.txt and the dictionary files. IT runs fine on a Rev B Demo board.

    \ FLASH AN LED by Professor Braino - updated from PropForth 2.5 by BrianBR
    \ using PROPFORTH 3.2 (a new version of salsanci spinforth 1.1)
    \ (This is NOT propellerforth from Cliffe Biffle)
    \ load PropForth.spin into eeprom and use a terminal program too 'send textile' at 1 ms per char / 1ms per line 
    \   PC/Win "teraterm"   Mac OSX "ZTerm" set to 57600 8n1  baud worked best for me
    \ 
    \ will run on an unmodified 'Demo' board
    \ each unit of functionality is implemented as a single word
    \ when each word is functioning correctly, string them together
    
    variable w-delay \ ( uses w@ w! time delay in milliseconds )
    : !DELAY w-delay W! ; \ ( ms - ) ( store the milliseconds to wait )
    : .DELAY w-delay W@ delms ; \ ( - ) ( wait for milliseconds in delay )
    
    : pin16-output 10000 dira COG! ; \ ( - ) ( make pin16 output )
    : pin16-hi 10000 outa COG! ; \ ( - ) ( make pin16 high LED ON )
    : pin16-lo 0 outa COG! ; \ ( - ) ( make pin16 low LED OFF )
    
    \ ... string them together...
    
    : flash16 pin16-hi .DELAY pin16-lo .DELAY ; \ ( - ) ( flash LED using DELAY )
    
    \ ... and put it in a loop
    
    : FLASHES pin16-output 0 do flash16 loop ; \ ( number of flashes desired - )
    
    \ After one has determined what code is needed, it is possible to
    \ cram everything into a single word
    \ doing everything all in one word is sometimes referred to as
    \ write only code (write once - edit never again )
    \ this takes slightly less space but can be confusing on larger applications
    \ after the code has been left alone for a few days
    
    : ALL-ONE-WORD \ ( flashes - )
    10000 dira COG! \ ( make pin16 output )
    0 do \ flashes to 0 DO ...
    10000 outa COG! \ ( make pin16 high LED ON )
    100 delms \ ( delay for 100 ms)
    0 outa COG! \ ( make pin16 low LED OFF )
    100 delms
    loop ;
    
    \ 10 ALL-ONE-WORD
    \ next use the other method
    
    \ 50 !DELAY
    \ 20 FLASHES
    
    
    



    cheers ... BBR

    Thanks Brian

    I'd like to post your updates to these words on the google code site when I start the examples page

    Is it worthwhile to have two examples, 'ALL-ONE-WORD' vs the step-by-step-by construction of 'FLASHES' ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-15 01:30
    caskaz said...
    Hi.
    Thanks prof_braino.
    prof_braino said...

    2. When you use the fl command (file load) it streams the pasted text into a temporary area which is unused EEPROM, and then interpreters the pasted text from EEPROM, then releases the EEPROM back to unused space. BUT at one time the temporary buffer manager did NOT SET the pointer for the TEMPORARY BUFFER back when it releases the EEPROM. So after multiple pastes using fl, it thinks it ran out of EEPROM.
    Sorry,I can't understand.
    I used "Send File" on Tera Term to upload lcd.f to Prop.
    I thought lcd.f uploaded to Prop's RAM.
    My idea is wrong?

    I try "create MyArray 10 allot".

    caskaz

    Ah... Excellent, we have found something that is not clearly stated in the documentation, thank you very much.

    This is the issue:

    PropForth does not implement any flow control on the serial communication at this time, so it is possible to overrun the buffers.
    This is actually documented in the comments, but I read it and didn't catch it either, so I need to A) update the instructions and b) figure out a nice flow control

    Normally, typing will NOT overrun the input buffer, as the prop is faster than you type BUT

    If you send a big chunk of text to propforth, it interprets the text same as if you typed it, BUT
    when it gets to the end of a definition (the semicolon ';') propforth has to write to the dictionary, and processing the new dictionary entry takes a little more time than reading in characters.

    After several lines (definitions), the interpreter lags behind the buffer, and a couple characters get lost. In your case, the interpreter did not see 'outa', it saw 'out~~~~' due to the garbled data from the buffer overrun. (my guess).

    So, why does the author Sal permit this to happen? Turns out, he never send more than one line text directly into the interpreter, so this in never an issue for him.
    When he want to compile a file of text, he put 'fl' at the beginning of the text, and buffers it to unused eeprom

    fl
    
    <many lines of forth code definitions>
    
    



    Then these lines are buffered in the unused EEPROM

    This process allows one to paste entire files up to 26,000 character long to the propforth command prompt (the interpreter)
    The blue LED on the demo board flashes while the text is writing to EEPROM,
    then the RED LED flashes as each line of text is displayed at the forth prompt and the interpreter responds with

    ok
    
    



    after each line. If the interpreter does not respond with 'ok' after a line, there was an error and usually (always so far) it means there was an error in your code, and interpretation stops, and the rest of the definitions are discarded.

    Saving the text to EEPROM (the fl command) happens as fast as the text comes in, and propforth interprets the text from EEPROM at it own speed, so there is no problem.

    Sal found this 'buffer to unused EEPROM' method easier than implementing flow control. Probably this seems kooky, (I thought so too) but it works after you get used to it.

    SO TO SUMMARIZE:

    Try to use the fl command at the begin of a section of code that you PASTE into tera term,
    try NOT to use teraterm's built in send-file feature.

    This should eliminate the UNDEFINED WORD error you saw when the 'outa' word was trying to compile.

    Using the fl command should fix it.

    [noparse][[/noparse]edit]
    Sorry, I forgot your listing includes the fl command at the top as it should.

    The fl command is placed at the begining of the text pasted into the teraterm window, but the fl method is not tested with uploading a file using teraterm's upload file feature.

    If you paste the text in your listing into teraterm, you should not experience the issue I described.

    If you still have problems, we have found another bug, privat message me and we will work through it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't

    Post Edited (prof_braino) : 7/15/2010 1:46:12 AM GMT
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-15 02:13
    prof_braino said...

    Thanks Brian

    I'd like to post your updates to these words on the google code site when I start the examples page

    Is it worthwhile to have two examples, 'ALL-ONE-WORD' vs the step-by-step-by construction of 'FLASHES' ?

    By all means YES! Now, reminding you again of my Forth newby-ness and total rank beginner at PropForth, the differences between the two ways to express it taught me a lot.

    In fact several things I learned from that allowed me to create the words I needed to get through the first two chapters of exercises in "Starting Forth".

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-18 19:57
    Brian Riley said...
    Fred Hawkins said...
    What would be real useful would be a simple archive that contains all of PropForth's how-to pages. That would be useful, especially if your latest version significantly morphs away from the older version and the how-to's no longer match.

    What he said! +1

    cheers ... BBR

    Hopefully, the wiki listing code.google.com/p/propforth/w/list is the simplest archive that contains all the how-to and instructions. Most of the version tags have now been updated to show what has been modified for version 3.2

    Most of the google code pages for propforth code.google.com/p/propforth/ have been updated to include the comments and responses I have received up to and including version 3.2.

    If you follow the links from the main page code.google.com/p/propforth/wiki/PropForth in order, and come back to the previous page when you finish a page, you'll get the information in the same order that I constructed it. To me, this is the logical flow. Try this if the wiki listing doesn't get you what you want.

    The links to files that are still present and not deprecated pages from previous versions should still be relevant.

    If you notice anything that looks odd in a way that is not typical for forth to look odd, please post or send me a message and I will fix it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-19 00:28
    Prof Braino, my thought was to be able to download, along with the propforth version, a simple text file (labeled Good at Such and Such Date) with all of those pages. As it works for me now, I have to cut and paste all those pages to notepad to get a working text copy. I don't mind doing that, but having a current snapshot of the docs in one easy download would be a good thing. Currently, especially for the raw beginner, there's always doubts: Did I get it all? Did I get it right? and the everpresent, Should I bother with this? At all?

    I don't think anyone would mind if the snapshot lags the wiki as long as it does keep up with the major versions.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-19 00:58
    PB, considering the spec sheets for both the 32k and 64k eeproms, the former says it can handle 64byte-page writes and the 24lc512 can do 128 byte-page writes, but General Documentation page only suggests 64byte-page writes for the '512 and the default is set to 32bytes. http://code.google.com/p/propforth/wiki/PropForthspin

    I had a bunch of questions about all this but that was in the fast reply box - so I'll settle for a simple "what gives?"

    Meanwhile, oh joy: diving into eewritepage and friends in propforth1.f --- ahhhhhhhhhhhhh ooo murky waters indeed
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-19 04:01
    Fred Hawkins said...
    PB, considering the spec sheets for both the 32k and 64k eeproms, the former says it can handle 64byte-page writes and the 24lc512 can do 128 byte-page writes, but General Documentation page only suggests 64byte-page writes for the '512 and the default is set to 32bytes. http://code.google.com/p/propforth/wiki/PropForthspin
    I had a bunch of questions about all this

    It is an error in my notes. Thanks for sorting this out, I had a question about this and was waiting for Sal to get back from vacation to ask it.

    Please confirm this agrees with the data sheets:

    The 32k eeprom can do 64 byte page writes, and not 128 byte page writes.
    The 64k eeprom can to 128 byte page writes, as well as 64 byte page writes.

    If so, the propforth is set to 64 byte page writes, as it is intended to work for both parts, and didn't in a previous version.

    Does your application have a problem with the 64 byte page writes? I was under the impression the code works on both parts and just keep doing pages of the specified size until it runs out of data or hits the end of the EEPROM.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • caskazcaskaz Posts: 957
    edited 2010-07-19 14:07
    Hi.

    variable buffer
    : buffer_make create buffer a allot ;
    : buffer_display buffer a 0 do dup W@ . 2+ loop drop ;
    
    


    I do buffer_display after I put " buffer 9 W!".
    But value of buffer is not changed.

    Why doen't value change?
  • kuronekokuroneko Posts: 3,623
    edited 2010-07-19 14:14
    caskaz said...
    I do buffer_display after I put " buffer 9 W!".
    But value of buffer is not changed.

    Why doen't value change?
    ! & Co usually require (n a ->) not (a n ->).
  • caskazcaskaz Posts: 957
    edited 2010-07-19 14:37
    Thanks kuroneko-san.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-07-19 18:08
    prof_braino said...

    Please confirm this agrees with the data sheets:

    The 32k eeprom can do 64 byte page writes, and not 128 byte page writes.
    The 64k eeprom can to 128 byte page writes, as well as 64 byte page writes.

    If so, the propforth is set to 64 byte page writes, as it is intended to work for both parts, and didn't in a previous version.

    Does your application have a problem with the 64 byte page writes? I was under the impression the code works on both parts and just keep doing pages of the specified size until it runs out of data or hits the end of the EEPROM.

    The spec sheets confirm both of those points, but·raise another. Does Propforth only write once to a page, filling·the page·in the 32K·eeprom and leaving it half empty in a 65k eeprom? Or does·Propforth write twice (two 64 byte writes) to the bigger eeprom before advancing to the next page?

    (I think I am getting an understanding of the wiki now: we have Propforth/Sal/Prof_Braino/wiki and depending on where you sit, you get a different view. Works for me. And worth mentioning: Good job guys.)

    ·
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-07-19 23:00
    Fred Hawkins said...

    The spec sheets confirm both of those points, but raise another. Does Propforth only write once to a page, filling the page in the 32K eeprom and leaving it half empty in a 65k eeprom? Or does Propforth write twice (two 64 byte writes) to the bigger eeprom before advancing to the next page?

    (I think I am getting an understanding of the wiki now: we have Propforth/Sal/Prof_Braino/wiki and depending on where you sit, you get a different view. Works for me. And worth mentioning: Good job guys.)

    Thanks! And thanks again for you comments. Sal does the design; I ask him the questions, and write on the wiki. All typos are mine.

    The EEPROM write word does a maximum or 512 pages writes of 64 bytes on a 32k EEPROM, and does a maximum of 1024 page writes of 64 bytes on a 64k EEPROM.

    Sal indicated the EEPROM write routine is driven by the amount of data. That is, If you give it 123 bytes, it does two 64 byte writes. It just keeps doing 64 byte page writes to EEPROM until it runs out of data. When we tried to write 33k to my board (32k EEPROM), it crashed (locked up and had to be power cycled), but his board (64k EEPROM) had no problem.
    When we tried 65k, both boards locked up.

    So as I understand it, the EEPROM write routine just goes and goes until it runs out of data. If it hits the end of EEPROM, crash. No safety, no checking, no warnings. Programmer is responsible for understanding what he's asking. You can put checking in, but I think it would slow it by a factor of 2 or something, and so be aware it might interfere with the fl (load text file into EEPROM as a temporary buffer for interpretation) word.

    If you do the 'saveforth' word, you should see it print out a bunch of periods as it it 'saveforth'ing. Each period represents a (64 byte) EEPROM page write. So you should be able to calculate and verify using the 'free' word that the number of periods corresponds to the bytes written.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people in the world: those who understand binary, and those who don't
  • Brian RileyBrian Riley Posts: 626
    edited 2010-07-20 04:13
    Hey guys, a quick hack I put together to write the EEPROM image to an SD card to be later used via 'download binary' from BST or Prop Tool. Its clean and it works. I am gonna integrate it into sdloader ... but in the meantime here is a working utility.

    cheers ... BBR

    '' ==============================================
    ''
    '' File....... sd_saveforth.spin (Brian Riley = 19 July 2010)
    ''
    '' So you are using PropForth and you build up a good dictionary and use the
    '' "saveforth" command to save it to the EEPROM. That's nice so long as you
    '' are not working on anything else. Suppose you have a second piece of code,
    '' completely different, how do you switch back and forth without extensive
    '' cut and paste or file loads. This hack lets you dump the EEPROM to a file
    '' on an SD card which can leter be reloaded to EEPROM from your desktop/laptop
    ''
    '' SD_SaveForth is a hack adapting sdloader to read a forth image in lowEEPROM
    '' and write a binary file to an SD card. THIS IS A QUICK HACK ... it works.
    ''
    '' I plan to make it more elegant. I took the foundation code of sdloader,
    '' commented out the main routine and put in sd_saveforth. So once again, kudos
    '' to Mike Green and his great FemtoBasic SD/EEPROM routines
    ''
    '' This hack requires an SD/uSD card adapter and an SD/uSD card. No SDHC
    '' SD adapter pins may be non-sequential - see code
    ''
    '' Load this program to RAM ONLY! Otherwise you will kill the EEPROM image
    '' that you are trying to harvest.
    ''
    '' Once again ... DO NOT LOAD THIS PROGRAM INTO EEPROM!!!!!!
    ''
    '' Writes a file named FORTH.IMG to SD card. Take SD card to computer and copy
    '' it over and rename it FORTH.binary. Then at some time later it can be restored
    '' to EEPROM from BST or the Prop Tool.
    ''
    '' ==================================================

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
Sign In or Register to comment.