Shop OBEX P1 Docs P2 Docs Learn Events
Propforth v5.5 is available for download - Page 23 — Parallax Forums

Propforth v5.5 is available for download

12021232526

Comments

  • Operated touchsensor(RH6010:i2c-device)

  • Made SingFace by using 8x8Matrix and MicrophoAmp

  • Built up Tinkerkit Braccio.
    Only moving.

  • caskazcaskaz Posts: 957
    edited 2016-05-09 09:12
    Anybody have curcuit diagram of Braccio-shield board?


    Moving code is below;
    fl
    
    {
    BRACCIO
    PropForth5.5
    
    2016/05/08 21:10:08
    
    QuickStart             BRACCIO shield board
                ---------
         3V3---|VCCA VCCB|----5V          
         P8----|A0     B0|----M1
         P9----|A1     B1|----M2
         P10---|A2     B2|----M3
         P11---|A3     B3|----M4
         P12---|A4     B4|----M5
         P13---|A5     B5|----M6
         GND---|GND    OE|----GND
                ---------
                 FXMA108
    }
    
    \ -------------------------------------------------------
    \ Constants
    \ -------------------------------------------------------
    \ Special register
    h1F8	wconstant ctra
    h1FA	wconstant frqa 
    h1FC	wconstant phsa 
    \ Time for servo
    d80 wconstant 1usec
    \ Max-limit and Min-limit for each servo
    wvariable servo_limit -2 allot
    d500 w, d2500 w,         \ base
    d900 w, d2300 w,         \ shoulder
    d600 w, d2500 w,         \ elbow
    d500 w, d2500 w,         \ vertical wrist
    d500 w, d2500 w,         \ rotary wrist
    d1350 w, d2200 w,        \ gripper
    
    \ top pin number of contiguous servo group
    8 wconstant servo
    \ each servo ch
    0 wconstant base
    1 wconstant shoulder
    2 wconstant elbow
    3 wconstant vert_wrist
    4 wconstant rot_wrist
    5 wconstant gripper
    
    \ channel[max:8]
    6 wconstant ch
    
    
    \ -------------------------------------------------------
    \ Variables
    \ -------------------------------------------------------
    \ target[ch],delta[ch],usec[ch]: each channel has 2byte(total 12byte)
    variable target 8 allot 
    variable delta 8 allot
    variable usec 8 allot
    
    \ -------------------------------------------------------
    \ Main
    \ -------------------------------------------------------
    
    \ Get address of target for each ch
    \ ( n1 -- n2 )  n1:servo ch n2:target_position's variable address for each ch
    : tgtPos 2 u* target + ;
    
    \ Get address of delta for each ch
    \ ( n1 -- n2 )  n1:servo ch n2:delta's variable address for each ch
    : deltaVal 2 u* delta + ;
    
    \ Get address of usec for each ch
    \ ( n1 -- n2 )  n1:servo ch n2:current_position's variable address for each ch
    : curPos 2 u* usec + ;
    
    \ Set servo-motor's pin to output
    \ ( n1 -- )   n1:top pin number of contiguous servo group
    : setup ch 0 do dup pinout 1+ loop drop ;
    
    \ Check if position is inside region
    \ ( n1 n2 -- n3 )  
    \ n1:servo ch  
    \ n2:servo position(microsecond)
    \ n3:Checked servo position(microsecond)
    : posCheck 
    over 4 * servo_limit + W@ max \ Check Min-limit 
    over                          \ ( n1 [n2 or min-limit] n1 )
    4 * 2+ servo_limit + W@ min   \ Check Max-limit
    ;
    
    \ Set selected servo(ch) to new position 
    \ ( n1 n2 -- )  
    \ n1:servo ch 
    \ n2:newpos specified in microseconds
    : setpos
    posCheck                      \ ( n1 n2 )
    over                          \ ( n1 n2 n1 ) 
    \ delta[ch] = 0
    deltaVal 0 swap W!            \ ( n1 n2 )  Save delta=0 to specified ch                    
    swap 2dup                     \ ( n2 n1 n2 n1 )
    tgtPos W!                     \ ( n2 n1 )  Save target_position to sprcified ch
    \ usec[ch] = newpos
    curPos W!                     \ ( -- )  Save new_position to specified ch
    ;
    
    \ Move selected servo from current position to newpos in n1 frames
    \ ( n1 n2 n3 -- )  
    \ n1:frame [1frame is 15msec(servo frame timing)]
    \ n2:servo ch
    \ n3:newpos
    : movpos
    posCheck                      \ ( n1 n2 n3 )
    rot                           \ ( n2 n3 n1 )
    dup 1 =
    if
         \ Moving rapidly
         drop                     \ ( n2 n3 )
         setpos
    else
         \ Moving slowly through frames
         over                     \ ( n2 n3 n1 n3 )
         >r                       \ ( n2 n3 n1 ) Push newpos
         >r                       \ ( n2 n3 )   Push frame
         over                     \ ( n2 n3 n2 )
         curPos W@ -              \ Calculate (difference from newpos and usec)
         abs d10 u*               \ ( n2 n3 calc_value )
         r>                       \ Pop frame
         u/                       \ ( n2 n3 calc_value )  Calculate 0.1usec/frame
         5 + d10 u/ 1 max         \ ( n2 compared_result )  round up to 1usec/frame
         over                     \ ( n2 compared_resulte n2 )
         deltaVal W!              \ ( n2 )  Update delta to specified ch
         r>                       \ ( n2 n3 ) Pop newpos
         swap                     \ ( n3 n2 )
         tgtPos W!                \ ( -- ) Update new_position to specified ch
    then
    ;
    
    \ Returns position (current output command to servo) of channel
    \ ( n1 -- n2 )  
    \ n1:servo ch  n2:ch's position(microseconds)
    : position curPos W@ ;
    
    \ Returns True when servo ch is at desired target
    \ ( n1 -- n2 )  
    \ n1:servo ch  n2:t/f
    : at_target dup curPos W@ swap tgtPos W@ = ;
    
    \ Wait until servo channel reaches at target position
    \ ( n1 -- )  n1:ch
    : wait_tgt begin dup at_target until drop ;
    
    \ Runs 6 servos
    \ ( n1 -- )  n1:top pin number of contiguous servo group
    : deltaServo
    dup 
    setup
    1 frqa COG!
    0 phsa COG!
    cnt COG@ d200000 +                 \ cnt + 2.5msec  
    swap
    \ run 6 slot(15msec)
    begin
         ch 0 do   
              \ Set PWM/NCO mode on servo pin       
              dup i + h10000000 or ctra COG!
              \ Set negative value to phsa      
              i curPos W@ 1usec u* negate phsa COG!
                   
              i curPos W@ i tgtPos W@ <
              if
                   i curPos W@ i deltaVal W@ +
                   i tgtPos W@ min
                   i curPos W!
              else
                   i curPos W@ i tgtPos W@ >
                   if
                        i curPos W@ i deltaVal W@ -
                        i tgtPos W@ max
                        i curPos W!
                   then
              then
              swap                                                    
              d200000 waitcnt                    \ cnt + 2.5msec
              swap
              0 ctra COG! 
         loop
    0 until
    \ fkey? swap drop until drop
    ;
    
    \ Start servo cog
    \ ( -- )   
    : servo_init
    base d1500 setpos                       
    shoulder d1800 setpos              
    elbow d1000 setpos
    vert_wrist d2500 setpos
    rot_wrist d1500 setpos
    gripper d1500 setpos
    
    c" servo deltaServo" 0 cogx
    ;
    
    : disp_pos
    ch 0 do 
         ." ch:" i .
         ." target:" i tgtPos W@ .
         ." delta:" i deltaVal W@ .
         ." usec:" i curPos W@ .
         cr
    loop
    cr
    ;
    
    : demo1
    d100 base d1500 movpos
    d100 shoulder d1600 movpos
    d100 elbow d1600 movpos
    d100 vert_wrist d1500 movpos
    d100 rot_wrist d1500 movpos
    d100 gripper d1500 movpos
    ;
    
    : demo2
    d100 base d1500 movpos
    d100 shoulder d1800 movpos
    d100 elbow d1000 movpos
    d100 vert_wrist d2500 movpos
    d100 rot_wrist d1500 movpos
    d100 gripper d1500 movpos
    ;
    : demo3
    d100 base d2000 movpos
    d50 rot_wrist 500 movpos
    d50 gripper d1350 movpos
    begin rot_wrist at_target until    \ Wait until reached at desired position    
    d50 rot_wrist 2500 movpos
    begin gripper at_target until      \ Wait until reached at desired position
    d50 gripper d2200 movpos
    ;
    
    
    : wait
    begin base at_target until
    begin shoulder at_target until
    begin elbow at_target until
    begin vert_wrist at_target until
    begin rot_wrist at_target until
    begin gripper at_target until
    ;
    
    : test demo1 wait demo2 wait demo3 wait demo2 ;
    
    600 x 450 - 249K
  • I wrote code for OLED-LCD128x32dots(SSD1306).

  • Hey Kaz! Will you post the code for SSD1306? I'd like see it if I could.
  • caskazcaskaz Posts: 957
    edited 2016-08-04 22:57
    Hi prof_braino.
    Please check i2c_device's folder inside my github.
  • Got it! Thanks!
  • Modified a little.

  • caskazcaskaz Posts: 957
    edited 2016-08-28 09:15
    File-loading use "fl" using hubram.
    In case of Development kernel, free area is 15kbyte.
    Big file cannot load in free area.
    So, I made RAMDISK(512kbyte).

    Loading sample.f(size:33kbyte) by "fl"
    sample.f combined from i2c_utility_0.4.2.f and SSD1306(128x32)_0.1 and demo_0.1.f.
    9224 characters overflowed
    Prop0 Cog6 ok
    
    CON:Prop0 Cog5 RESET - last status: 0 ok
    



    After Loading "RAMDISK_0,1.f" , execute below;
    Prop0 Cog6 ok
    initRAM
    Prop0 Cog6 ok
    

    Loading sample.f by "flRAM"

    Success loading file.

    There are text of "sample.f" inside RAMDISK
    Prop0 Cog6 ok
    0 500 dumpDISK
    00000 01F4:
    00000: 0D 0D 0D 0D 0D 3A 20 65 72 72 5F 6D 73 67 20 2E   .....: err_msg .
    00010: 22 20 49 32 43 20 65 72 72 6F 72 22 20 3B 0D 3A   " I2C error" ;.:
    00020: 20 65 72 72 3F 20 69 66 20 65 72 72 5F 6D 73 67    err? if err_msg
    00030: 20 63 72 20 74 68 65 6E 20 3B 0D 0D 6C 6F 63 6B    cr then ;..lock
    00040: 64 69 63 74 20 63 72 65 61 74 65 20 5F 65 65 73   dict create _ees
    00050: 74 61 72 74 20 66 6F 72 74 68 65 6E 74 72 79 0D   tart forthentry.
    00060: 24 43 5F 61 5F 6C 78 61 73 6D 20 77 2C 20 68 31   $C_a_lxasm w, h1
    00070: 32 32 20 20 68 31 31 33 20 20 31 2D 20 74 75 63   22  h113  1- tuc
    00080: 6B 20 2D 20 68 39 20 6C 73 68 69 66 74 20 6F 72   k - h9 lshift or
    00090: 20 68 65 72 65 20 57 40 20 61 6C 69 67 6E 6C 20    here W@ alignl
    000A0: 68 31 30 20 6C 73 68 69 66 74 20 6F 72 20 6C 2C   h10 lshift or l,
    000B0: 0D 7A 31 5B 69 78 6E 57 20 6C 2C 20 7A 31 5B 69   .z1[ixnW l, z1[i
    000C0: 78 6E 58 20 6C 2C 20 7A 32 57 79 50 5B 55 20 6C   xnX l, z2WyP[U l
    000D0: 2C 20 7A 32 30 69 50 61 6B 20 6C 2C 20 7A 33 72   , z20iPak l, z3r
    000E0: 79 50 57 30 20 6C 2C 20 7A 31 62 69 78 6E 57 20   yPW0 l, z1bixnW
    000F0: 6C 2C 20 7A 32 57 79 50 5B 56 20 6C 2C 20 7A 32   l, z2WyP[V l, z2
    00100: 30 69 50 61 6B 20 6C 2C 0D 7A 33 72 79 50 57 30   0iPak l,.z3ryPW0
    00110: 20 6C 2C 20 7A 31 62 69 78 6E 58 20 6C 2C 20 7A    l, z1bixnX l, z
    00120: 31 53 56 30 31 58 20 6C 2C 20 7A 6C 30 20 6C 2C   1SV01X l, zl0 l,
    00130: 20 7A 43 57 20 6C 2C 20 7A 57 30 30 30 30 20 6C    zCW l, zW0000 l
    00140: 2C 20 7A 47 30 30 30 30 20 6C 2C 0D 66 72 65 65   , zG0000 l,.free
    00150: 64 69 63 74 0D 0D 3A 20 53 72 20 5F 65 65 73 74   dict..: Sr _eest
    00160: 61 72 74 20 3B 0D 0D 3A 20 5F 65 65 73 74 6F 70   art ;..: _eestop
    00170: 0D 5F 73 63 6C 69 20 20 20 20 20 5C 20 52 65 6C   ._scli     \ Rel
    00180: 65 61 73 65 20 73 63 6C 20 0D 5F 73 64 61 69 20   ease scl ._sdai
    00190: 20 20 20 20 5C 20 52 65 6C 65 61 73 65 20 73 64       \ Release sd
    001A0: 61 0D 3B 0D 0D 3A 20 62 75 73 5F 63 6C 72 20 64   a.;..: bus_clr d
    001B0: 31 30 20 30 20 64 6F 20 5F 73 63 6C 6C 20 5F 73   10 0 do _scll _s
    001C0: 63 6C 6F 20 5F 73 63 6C 69 20 6C 6F 6F 70 20 3B   clo _scli loop ;
    001D0: 0D 0D 0D 6C 6F 63 6B 64 69 63 74 20 63 72 65 61   ...lockdict crea
    001E0: 74 65 20 5F 65 65 77 72 69 74 65 20 66 6F 72 74   te _eewrite fort
    001F0: 68 65 6E 74 72 79 0D 24 43 5F 61 5F 6C 78 61 73   hentry.$C_a_lxas
    
    Prop0 Cog6 ok
    
  • RAMDISK curcuit diagram
  • My first microcontroller board was TK85(CPU:8085).
    I wrote code to load program for TK85.
    It sound like nostalgia.

  • caskazcaskaz Posts: 957
    edited 2016-09-25 02:39
    Controlled clock speed.
    Uploded code and pdf to github(2016/9/25 11:54).

  • I always thought a variable speed clock with a week-long rotation period (weekends being 50% of the dial) would be a cool novelty item. Good to see caskaz !
  • Alittle modified code for adafruit 16x64 LED Matrix.
    c" PropForth5.5 " setUpperStr
    c" May the Forth be with you." setLowerStr
    2 color0 W!
    1 color1 W!
    adafruitStr
    

  • caskazcaskaz Posts: 957
    edited 2016-11-23 08:04
    Trying to work HD66732.
    This LCD controler has JIS Level-1 and Level-2 Kanji ROM.
    This also has character RAM(4line 20digit) and graphic RAM(120x52dots).
    Not operating perfectly yet.
    4320 x 3240 - 1M
  • Displayed Prop-character by using 2pcs of Adafruit16x32 LEDMatrix.

  • Trying to work HD66732.
    Not displaying 7bit-code characters yet.



  • TorTor Posts: 2,010
    edited 2016-12-01 11:21
    An off-topic question.. that HD66732 is interesting, but it seems to be difficult to find now. Is it still possible to find it in Japan?
  • caskazcaskaz Posts: 957
    edited 2016-12-02 01:10
    This module(LM4049:using HD66732) are sold only this shop in Nipponbashi.
    Including adaptor-board for film connector.
    Price is 980 Yen(including tax).
    It seems there are about 100 pcs in stock.
    No parts in Akihabara.
    1152 x 864 - 381K
  • TorTor Posts: 2,010
    Thanks, caskaz!
    I found the place on google maps. I may be able to go to Osaka again in a few months. It's much easier for me to go there than to Tokyo anyway (I have never actually been in Akihabara).
  • Graphic & character screen

  • caskazcaskaz Posts: 957
    edited 2016-12-31 01:15
    Hi.
    I try to use USB-memory by using CH376S.
    Using serial I/O.
    I have trouble.
    After opening/appending/writing file, error occur trying to open file again.
    Searching files inside directory, opening file have no error.

    When closing file, it seems file-pointer is file-end.

    Do you have how to solve trouble?
    Prop0 Cog6 ok
    init_USBmemory
    CMD_SET_USB_MODE operation successfull.USB device is present.
    Checking USB Disk connection status:>Connection to USB -- ok
    Mounting USB diskST: 0_000_000_031
    ST: 0_000_000_020
    >USB Mounted -- ok
    
    20_690 00_036:
    20_690: 000 128 000 001 031 115 109 105 066 085 070 070 065 076 079 032   .....smiBUFFALO
    20_706: 085 083 066 032 070 108 097 115 104 032 068 105 115 107 032 032   USB Flash Disk
    20_722: 052 048 048 048 058 032 100 105 115 107 081 117 101 114 121 013   4000: diskQuery.
    BUFFALO USB Flash Disk  4000
    
    Totale Capacity:505855 kb
    
    Logical Total Capacity:505248 kb
    Free Capacity:505248 kb
    FAT file system type:FAT
    
    Prop0 Cog6 ok
    dir /*
    >Readable inside directory
    TEST1.TXT       TEST2.TXT       TEST3.TXT       TEST4.          TEST8.TXT
    Prop0 Cog6 ok
    setFileName TEST1.TXT
    Prop0 Cog6 ok
    openFile .
    >File opened successfully
    20 Prop0 Cog6 ok                      <--- USB_INT_SUCCESS
    readFile
    Reading file:PropForth5.5
    Prop0 Cog6 ok
    0 closeFile
    Closing file:>File closed successfully.
    Prop0 Cog6 ok
    setFileName TEST1.TXT
    Prop0 Cog6 ok
    openFile .
    >Failed to open file. Error code:66
    66 Prop0 Cog6 ok                      <-- ERR_MISS_FILE
    dir /*
    >Readable inside directory
    TEST1.TXT       TEST2.TXT       TEST3.TXT       TEST4.          TEST8.TXT
    Prop0 Cog6 ok
    setFileName TEST1.TXT
    Prop0 Cog6 ok
    openFile .
    >File opened successfully
    20 Prop0 Cog6 ok                      <--- USB_INT_SUCCESS
    readFile
    Reading file:PropForth5.5
    
    Prop0 Cog6 ok
    0 closeFile
    Closing file>File closed successfully.
    Prop0 Cog6 ok
    
  • CH376S-board
    720 x 960 - 101K
  • caskazcaskaz Posts: 957
    edited 2017-01-02 11:46
    I modified a little code.
    : stop_CH376  0 5 cogio 2+ W! 5 cogreset ;
    

    Today is her 13years old birthday(Jan 2).
    900 x 1200 - 161K
  • TorTor Posts: 2,010
    Nice doggie.. my wife's Shiba will be 14 later this month. She can still run 100 meters faster than I can.. :)
  • caskazcaskaz Posts: 957
    edited 2017-01-07 03:28
    I try to get JPEG by LS-Y201.
    Sending JPEG data to Processing after receiving them from LS-Y201.

    Photo is a llitle dark and poor color.
    This is under debug yet.

    320 x 240 - 38K
    640 x 480 - 47K
    640 x 480 - 48K
  • CH376S code
    Not complete yet.
    Change directory to down is ok.
    But cd to up is NG.

    Createfile,Deletefile are ok.
    CreateDirectory is NG.
    Prop0 Cog6 ok
    init_USBmemory
    CMD_SET_USB_MODE operation successfull.USB device is present.
    Checking USB Disk connection status:>Connection to USB -- ok
    Mounting USB diskST: 0_000_000_031
    ST: 0_000_000_020
    >USB Mounted -- ok
    
    21_052 00_036:
    21_052: 000 128 000 001 031 115 109 105 066 085 070 070 065 076 079 032   .....smiBUFFALO
    21_068: 085 083 066 032 070 108 097 115 104 032 068 105 115 107 032 032   USB Flash Disk
    21_084: 052 048 048 048 032 032 032 032 032 032 032 032 032 032 032 032   4000
    BUFFALO USB Flash Disk  4000
    
    Totale Capacity:505855 kb
    
    Logical Total Capacity:505248 kb
    Free Capacity:505248 kb
    FAT file system type:FAT16
    
    Prop0 Cog6 ok
    dir /*
    
    >Readable inside directory
    TEST1.TXT       TEST3.TXT       TEST4.          TEST9.TXT
    Prop0 Cog6 ok
    readDemo /TEST1.TXT
    
    >File opened successfully
    Reading file:PropForth5.5
    
    Closing file>File closed successfully.
    Prop0 Cog6 ok
    appendDemo /TEST1.TXT
    
    >File opened successfully
    Setting file pointer:Pointer successfully applied
    Writing to fileSetting data length
    Writing data to file:7
    Updating file size:20
    Closing file>File closed successfully.
    Prop0 Cog6 ok
    readDemo /TEST1.TXT
    
    >File opened successfully
    Reading file:PropForth5.5-append
    
    Closing file>File closed successfully.
    Prop0 Cog6 ok
    createFile /TEST2.TXT
    
    Created file
    
    Prop0 Cog6 ok
    dir /*
    
    >Readable inside directory
    TEST1.TXT       TEST3.TXT       TEST4.          TEST9.TXT       TEST2.TXT
    Prop0 Cog6 ok
    deleteFile /TEST2.TXT
    
    Successfully to delete file
    Prop0 Cog6 ok
    dir /*
    
    >Readable inside directory
    TEST1.TXT       TEST3.TXT       TEST4.          TEST9.TXT
    Prop0 Cog6 ok
    cd /TEST4
    
    >Directory opened successfully.
    >Readable inside directory
    ..      ...     TEST5.TXT       TEST6.
    Prop0 Cog6 ok
    cd TEST6
    
    >Directory opened successfully.
    >Readable inside directory
    ..      ...     TEST7.TXT
    Prop0 Cog6 ok
    
  • caskazcaskaz Posts: 957
    edited 2017-01-23 06:03
    I tried USBmouse.
    Yet strange operation.
    Now under debug.
    test1
    Reset USBbus
    CMD_SET_USB_MODE operation successfull.USB device is present.
    SOF
    mouse Low speed
    USB-address is 1
    CH376-USB-address successful
    Configure successful
    
    over14 ST:
    
    0 1 0
    over14 ST:
    
    0 2 0
    over14 ST:
    
    0 2 0
    over14 ST:
    
    1 7 0
    over14 ST:
    
    1 23 FD
    over14 ST:
    
    0 FD 0
    over14 ST:
    
    0 E1 7
    over14 ST:
    
    0 B4 E
    over14 ST:
    
    0 2E 4
    over14 ST:
    
    0 32 0 -- Y axis
    | |
    | X axis
    |
    Left button=1
    Right button=2
    
    CH376S module has been reset.
    Prop0 Cog6 ok
    
    CON:Prop0 Cog5 RESET - last status: 0 ok
    
  • CH376S-board and USBmouse
    720 x 960 - 101K
Sign In or Register to comment.