Shop OBEX P1 Docs P2 Docs Learn Events
Propforth4.0a available for download - Page 6 — Parallax Forums

Propforth4.0a available for download

12346

Comments

  • prof_brainoprof_braino Posts: 4,313
    edited 2011-05-13 19:22
    SSteve wrote: »
    Starting Forth is the bible for Forth beginners.

    I wouldn't go as far as "bible", but it is a fun read.
    All this talk of Forth has made me nostalgic. Back in the second half of the 80s I wrote the first commercial MIDI voice librarian program for DOS. It was all in Forth. I haven't had time to explore Propforth yet, but this has got me to install gforth on my Mac and play around with it a little.

    So that was you! When you get warmed up, come out and play. Your skills should not lay idle! The prop and forth were made for each other. (Or at least propforth is being made for the prop :) )
  • MGreimMGreim Posts: 114
    edited 2011-05-14 08:42
    The construct
    c" My text here "
    
    is the text handling mechanism

    The construct
    0 emit 32 emit 40 emit
    
    is for outputing numerical values off the stack

    Did you try:
    4 5 9600 2 startserialcog
    7 emit 0 emit 4F emit 4B emit 2 cogx 
    

    I didn't check, but I think that
    " 7 emit 0 emit 4F emit 4B emit "
    gets put into cog 2's input buffer, andit executes just as if you typed it from the command line.

    Unfortunately this didn't work

    To make a BREAK signal (longer the one byte ) i mo dified the PropForth.spin a little bit.
    In the
    Asemby language serial driver
    label serentryPFA i made a small cahange in the Transmit routine
    ' Transmit
    '
    transmit                jmpret  task1Ptr, task2Ptr
                            rdword  txdata, v_in
    
                            cmp     txdata, #$000 wz   'oo generates a break
    
            if_z            jmp     #:sbreak 
                            
                            test    txdata, #$100 wz   ' wz is 1 if all bit after AND are 0 -> sending data if bit 8 is not set
                            
            if_nz           jmp     #transmit
    
                                                     
                            mov     t1 , #$100
                            wrword  t1 , v_in        ' write $100 back to addres V_in
    
                            or      txdata,#$100     ' add start and stopbit
                            shl     txdata,#2
                            or      txdata,#1
                            mov     txbits,#11
                            mov     txcnt,cnt         ' cnt = system counter
                            jmp     #:bit
    
    :sbreak                  mov     t1 , #$100
                            wrword  t1 , v_in        ' write $100 back to addres V_in
    
                            mov     txdata, #$1   ' write 1 to Txdata
                            shl     txdata, #32     ' shift left 1 to %10000000000000000000000000000000
                            sar     txdata, #32     ' shift arithmetic right to get $FFFFFFFF, is there any better way to get this result?
                            
                            mov     txbits, #32     ' reduce this number to get a shorter break now its 32 marks/spaces
                            mov     txcnt, cnt
    
    
    

    Modifiing strings works as followes:
    : zeile c" xxx" ;
    0 zeile 1+ C!
    
    

    To suppress the Crlf at the output
    c" test" 2 cogx

    i modified cogx a little bit:

    \ the  origianal code
    : cogx io 2+ W@ rot2 cogio io 2+ W! .cstr cr io 2+ W! ;   
    
    \ without CRLF
    : cogwocrlf  io 2+ W@ rot2 cogio io 2+ W! .cstr io 2+ W! ;   
    
    

    thanks all the help, i will now progress with handling the incoming bytes.
  • SSteveSSteve Posts: 808
    edited 2011-05-14 09:06
    So that was you! When you get warmed up, come out and play. Your skills should not lay idle! The prop and forth were made for each other. (Or at least propforth is being made for the prop :) )

    I had at least two dreams last night in which I was using Propforth. That's weird. I guess it means I'd better get it installed and working. :-) It's going to be a couple weeks, though. I have three choir concerts this weekend and UPEW next weekend.
  • caskazcaskaz Posts: 957
    edited 2011-05-14 18:18
    Hi.

    I try to use serial-communication between proto(forth_master_work_02.f) and Demo(slave_work_o2.spin).
    Sending from proto to demo is OK.
    But receiving from demo to proto cannot receive.

    Sending data(1 2 3 4 5 6 7 8 9 0) from demo to proto. (Not forth_master_work_02.f and slave_work_o2.spin)
    Checking cog5's io and it is always 0x100(no data).
    And I checked (0x9dc - 0xa5b) inside cog5's cogdataarea(from 0x9d8 224byte). There are datas.
    How do datas get?
    Do you have any ideas?
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-15 01:57
    MGreim wrote: »
    :sbreak mov     t1 , #$100
            wrword  t1 , v_in       ' write $100 back to addres V_in
    
            mov     txdata, #$1     ' write 1 to Txdata
            shl     txdata, [COLOR="red"]#32[/COLOR]     ' shift left 1 to %10000000000000000000000000000000
            sar     txdata, [COLOR="red"]#32[/COLOR]     ' shift arithmetic right to get $FFFFFFFF
                                    ' is there any better way to get this result?
    
    Did you actually test this? The way it is now you'll end up with txdata == 1. If you want $FFFFFFFF then use neg txdata, #1 (or shift by #31).
  • doggiedocdoggiedoc Posts: 2,245
    edited 2011-05-15 07:53
    Downloaded. Will tinker with as time allows.

    Paul
  • MGreimMGreim Posts: 114
    edited 2011-05-15 11:04
    kuroneko wrote: »
    Did you actually test this? The way it is now you'll end up with txdata == 1. If you want $FFFFFFFF then use neg txdata, #1 (or shift by #31).


    Thanks, i am stupid...neg is so easy,

    Kind Regards

    Markus
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2011-05-18 10:11
    I can not speak for any one else. Though for me Forth is a good language, though I prefer BASIC, Assembly, and Pascal. I thank Prof_Braino for getting me to try Forth, it has helped expand my knowledge. I have enjoyed my short lived excursion into Forth, it is back to the traditional infix languages for me now.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-18 10:15
    David,

    Your small "whispering" font is hard to read. Please stop using it.

    -Phil
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2011-05-18 13:30
    PHIL: Ok no problem :) .
    :):) I often forget that not every one has the eyes to work with LQFPs with the naked eye. My apology.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-18 14:30
    I often forget that not every one has the eyes to work with LQFPs with the naked eye.
    LOL! I can still do that, but LQFPs don't annoy me. Teensy paragraph text does; so thanks! BTW, in cases where I've wanted to signal a whisper in the forum, I've kept the font size the same but changed the color to gray. I suppose that may have annoyed some people, too, though.

    -Phil
  • jazzedjazzed Posts: 11,803
    edited 2011-05-18 14:53
    BTW, in cases where I've wanted to signal a whisper in the forum, I've kept the font size the same but changed the color to gray. I suppose that may have annoyed some people, too, though.

    Even your whispers are quite loud and I've hung on to most of your words except in a few cases.
    Yes, I've been annoyed, but it has been mostly a good time. You need to work on your Rhett Butler accent though.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-18 16:09
    Frankly ... Oh, never mind! :)

    -Phil
  • MGreimMGreim Posts: 114
    edited 2011-05-19 02:19
    Another question:
    I have to extend the serial transmsion code at serentyPFA for a break and a parity bit transmission.
    It works so far, but the SPIN compiler is compalining now, thats it is missing some long words.

    I have stolen 4 longs from the wfreespacestart at the end of PropForth.spin.
    Is this dangerous, or only cutting my free space for my own FORTH words?

    Regards

    Markus
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-05-19 07:03
    MGreim wrote: »
    ... extend the serial transmsion code at serentyPFA for a break and a parity bit transmission.
    SPIN compiler is ... missing some long words.

    4 longs from the wfreespacestart at the end of PropForth.spin. Is this dangerous, or only cutting my free space for my own FORTH words?

    You can take from free space as needed. BUT the kernel wants to know what it starts and stops.

    When you change material in the kernel, its a good idead to re-generate the kernel using the spinmaker process as described in the documation pages. If spinmaker process can be completed successfully, you can be confident that the new kernel is correct. If spinmaker does not complete successfully, you have found your first error.

    Running spinmaker is the regression test for kernel changes, as it uses most functions when recreating the kernel code.
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-05-19 15:57
    MGreim wrote: »
    Any idea how to send a break (2ms) ?
    2 cogstop
    4 5 9600 2 startserialcog
    c" teststring sending " 2 cogx

    \this works fine
    \now i will try to send a break on TxD

    4 pinlo
    2 delms
    4 pinhi

    seems not to work, because the serilacog seems to stuck port 4

    Sal's reply:
    "Break functionality was not implemented in the serial driver. If it needs to be done only once,
    stop the serial driver,
    tx pin to out,
    tx pin lo for 2 ms,
    tx pin to hi,
    tx pin to input,
    restart the serial driver. "

    So all you need to add is stop and restart serial driver;
    and be sure that the pin has changed to "out" and back to "in" (<= was ommitting this step the cause for getting stuck?)
  • MGreimMGreim Posts: 114
    edited 2011-05-21 07:42
    In principle it works in this way, but the time between the break and the next sign i can send is quite long.

    I have to handle i quite curious protocol (its British ;-) ) where the maximum time between the break and the next sign is restricted.

    The other things is, that i have to handle ODD parity in this protocol. So i am just extending the serial driver with some small add. features (as it was already done by
    Ken Peterson http://forums.parallax.com/showthread.php?106657-Odd-Parity-Device-and-Hex-Strings&p=752143&viewfull=1#post752143 3 years ago).

    I like to extend the startserialcog word with one or two more options.
    This would give me and us a very powerful tool to handle several serial devices with different protocols on different ports.

    For my opinion the Propeller is a great part for all this I/O stuff, really fantastic in combination with FORTH.

    Unfortunately i fear that Parallax is going now this mainstream way with Eclipse + C . This MEETO strategy i guess is not helpful, also not for entering the industrial market.

    The Propeller (II) as scalable (1..n COGs) IP for FPGAs would be fantastic for this, but this is off topic here..

    Regards

    Markus
  • caskazcaskaz Posts: 957
    edited 2011-05-21 23:17
    Hi.
    I uploaded.
    Serial-communication between proto(propforth) and demo(spin) looks like ok.
  • MGreimMGreim Posts: 114
    edited 2011-05-22 02:40
    caskaz wrote: »
    Hi.
    I uploaded.
    Serial-communication between proto(propforth) and demo(spin) looks like ok.

    Hi Caskaz,

    Due to my (still) poor FORTH knowledge, i can only estimate what you have done,
    but as far as i can see it would be very helpful for me and others to handle incoming and outgoing serial data in
    FORTH.
    May ad some small more small comments to give us the chance to learn a little more about your
    demo ?

    Greetings from Germany

    Markus
  • caskazcaskaz Posts: 957
    edited 2011-05-22 06:29
    Hi MGreim.
    I upload textfiles.
    I think sals_sample.txt is useful for you.


    HIVE group is nice, there are many prop-user in Germany?
    I had been for 2weeks in G
  • Brian RileyBrian Riley Posts: 626
    edited 2011-05-22 16:14
    SSteve wrote: »
    Starting Forth is the bible for Forth beginners. It is available online at http://www.forth.com/starting-forth but I haven't been able to find a PDF version. There is a PDF version of Thinking Forth at http://prdownloads.sourceforge.net/thinking-forth/thinking-forth-color.pdf?download. Thinking Forth isn't so much a Forth beginner's book as a general programming practices book using Forth for examples. It's a great book, but Starting Forth is the one to start with.

    All this talk of Forth has made me nostalgic. Back in the second half of the 80s I wrote the first commercial MIDI voice librarian program for DOS. It was all in Forth. I haven't had time to explore Propforth yet, but this has got me to install gforth on my Mac and play around with it a little.

    Four months ago, I was able to get a used, in great condition, paperback copy of "Starting Forth" for about $22 through Amazon, you should give it a try.

    I just now went to www.amazon.com and searched "starting forth leo brody" and it showed 17 used paperback copies available from various dealers, with stated condition ranging from 'used-good' to 'used-very good' and ranging in price from $3.43 to $64.00 (average about $25 plus $3.99 shipping).

    I hope this helps.
  • Brian RileyBrian Riley Posts: 626
    edited 2011-05-22 16:28
    SSteve wrote: »
    Starting Forth is the bible for Forth beginners ...
    I wouldn't go as far as "bible", but it is a fun read.

    Maybe not "bible," but as a widely recognized starting point for the Forth language it is as close to what "K & R" is to the C language as we have.
  • MGreimMGreim Posts: 114
    edited 2011-05-23 00:57
    Hi Caskaz,

    thanks a lot for the comments and hints, i will study it today. The Hive project is really astonishing, a kind of "grassroot computing" or real personal computer, where you can understand every bit if you like, fantastic.
    How many Prop Users are in Germany is hard to say. Would be a good question to the Parallax stuff how many percent of the Propellers are delivered to Europe.
    I guess its more exotic here, then in the US where Parallax is a well introduced brand at least in the semi-professional area. Here, all the
    PICs and Atmels are dominating. But i love the Propeller because i already spent to much time of my life, finding deadlocks and similar bugs with interrupts.

    After ten years its time to visit Germany again, isn't it?..;-)

    Regards

    Markus
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-05-23 18:36
    Don't know if this affects your odd parity changes, but Sal reports that he found a bug and has made a change that will be in the next release:
    There is a bug is the serial port driver in that it may send a garbage character on startup,

    fixed in 4.5

    If you wish to retrofit the fix, it is a one line add:

    in the spin code:
                            org     0
    
    serentryPFA
                            mov     t1 , par
                            mov     v_rxbuff , par
                            add     v_rxbuff , # 4
                            rdlong  v_bitticks , t1
                            add     t1 , # 4
                            rdlong  v_rxmask , t1
                            add     t1 , # 4
                            rdlong  v_txmask , t1
                            mov     v_in , par
                            mov     v_out , v_in
                            add     v_out , #2
    
                            mov     t1 , # $100
                            wrlong  t1 , par
                 
                            mov     task1Ptr,#transmit
                            mov     task2Ptr,#task2Code
    
    ' ********************************************************** add this line
                            or      outa , v_txmask  
    
                            or      dira , v_txmask
    
  • caskazcaskaz Posts: 957
    edited 2011-06-02 23:13
    Hi.
    I did experiments about slave-prop.
    I rewrite 2_wire_LCD.
    2_wire_LCD_1.3 control LCD's backlight-brightness by NCO.
    Contrast is adjusted by pot.
    fsload norom.f
    Prop0 Cog6 ok
    
    : bootslave 8 9 A B rambootnx ;
    
    Prop0 Cog6 ok
    
    : demo bootslave 1 0 e100 4 startserialcog 10 delms 4 0 term ;
    
    Prop0 Cog6 ok
    
    demo
    
    Hit CTL-F to exit term
    
     SLAVEProp8 Cog6 ok
    
    þ
    
    UNDEFINED WORD þ   <---- Only first time  Maybe this is caused by startserialcog's bug.
    
     SLAVEProp8 Cog6 ok
    
     Copy/paste 2_wire_LCD_1.3.f to TeraTerm
    
    lcd_demo  <----  Demo running on connected LCD to slave-prop
    
     SLAVEProp8 Cog6 ok
               <--- Enter CTL-F
    Prop0 Cog6 ok
    
    4 0 term
    
    Hit CTL-F to exit term
    
    lcd_clear   <----  Clear on connected LCD to slave-prop
    
     SLAVEProp8 Cog6 ok
    
    200 lcd_dec  <----  Displaying "512" at pos(0,0) on connected LCD to slave-prop
    
     SLAVEProp8 Cog6 ok
                     <--- Enter CTL-F
    Prop0 Cog6 ok
    
    1024 x 768 - 87K
    1024 x 768 - 94K
    1024 x 726 - 51K
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-06-03 07:26
    caskaz wrote: »
    SLAVEProp8 Cog6 ok
    
    þ
    
    UNDEFINED WORD þ   <---- Only first time  Maybe this is caused by startserialcog's bug.
    

    Is there more info in this? We are testing v4.5 for public release, I want to make sure all the old stuff is fixed and in there.
  • caskazcaskaz Posts: 957
    edited 2011-06-03 23:27
    Hi prof_braino.
     SLAVEProp8 Cog6 ok
    
    þ
    
    UNDEFINED WORD þ   <---- Only first time  Maybe this is caused by startserialcog's bug.
    
    This error always occure on my protoboard.
    Using propforth4.0a.
    I think reason is startserialcog's bug(#175) maybe.


    Changing line 209 On norom.f :
    0 L@ 4 rshift setHzb ---> 0 L@ d u/ setHzb
    I think slave-prop's clock is 98MHz.
    Do you think slave is operating?
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-06-07 11:07
    caskaz wrote: »
    I think reason is startserialcog's bug(#175) maybe.

    That could be the case. I't unusual that you would see it consistently, Sal said it should only happen in a very rare circumstance. The bug from #175 is fixed in 4.5
    ... slave-prop's clock is 98MHz. Do you think slave is operating?

    I haven't messed with modifying the synchronous serial yet, I'm still figuring out the multi-channel part of it.
    They say the prop should be fine up to 120MHz and higher, so that shouldn't be a problem.

    As long as the master and slave can sync you should get a response. If they cannot, the slave won't load, and will stop.

    So it depends on whether the slave come back with a prompt.
  • caskazcaskaz Posts: 957
    edited 2011-06-14 00:17
    Hi.

    I translated dwd_jm_quickstart_demo110610i.spin to forth-code.
    And I add 24C512 to QuickStart board.
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-06-14 08:24
    caskaz wrote: »
    I translated dwd_jm_quickstart_demo110610i.spin to forth-code. And I add 24C512 to QuickStart board.

    HEY! I was going to do that! You beat me to it!

    Thanks for post, I'm still busy with the v4.5 regression test for release later this week(?).

    Don't forget to call and ask for a 64k version!

    http://forums.parallax.com/showthread.php?132191-WARNING-Quickstart-board-has-a-32K-EEPROM-not-a-64K&p=1009316&viewfull=1#post1009316
Sign In or Register to comment.