Shop OBEX P1 Docs P2 Docs Learn Events
Loading libraries into Propeller tool : DONE — Parallax Forums

Loading libraries into Propeller tool : DONE

bbrienbbrien Posts: 561
edited 2020-07-17 05:05 in Propeller 1
I have been trying to load the "FullDuplexSerialplus library into the propeller tool without luck.
«1

Comments

  • Open the library. Press F9 to make sure it compiles (there may be dependencies). From the File menu, select Save to... and from the fly-out menu select Propeller Library. If you did a standard install of the Propeller Tool this is really the only way. The Program Files (x86) folder is protected from direct access (i.e., through the file explorer). Since Propeller Tool "owns" the library folder, it has access rights and can use that folder without problems.
  • Simplify your life for now, just put all the objects you have written or are using i.e. FullDuplexSerial.spin into the same directory. Prop Tool should find them all. Don't worry about libraries. See page 141 of Prop manual v1.2 Obj for the actual order of search for an object. For every object you did NOT write yourself, again FullDuplexSerial.spin for example, go through it and note each of the PUB references so you know how the ones you want to use are called with both name and required values and the order they are expected. After you are familiar with the section on Objects, and how to use them, what I have done below in the extract from a working sensor project should be pretty easy to follow.
    
    CON
    
    ' stuff
    
    RxD      = 26       ' Serial in     NOT the usual pin, could have been almost any pin, this feeds to a Android ternimal
    TxD      = 27       ' Serial out   NOT the usual pin, could have been almost any pin, this feeds to a Android ternimal
    Mode     = 0        ' not sure why 0, just worked and left well enough alone (help me CodeMeJon your my only hope....)
    Baud     = 115200   ' rate
    
    Vref      = 3300     ' Vref = 3.3V * 1000   scaling made the display in mV easier.
    States   = 4096     ' 2^n 12 bits = 4096
    
    
    'more stuff
    
    obj
    
       fdx  : "FullDuplexSerial"             'name that object, left side, what you name it in YOUR code : right side .spin file
       '  other objects                          ' prop tool should look in the open tabs, then the current directory, then lib.
    
    VAR
    ' stuff
      word ADCChans[Chans]             'output data array
    
    PUB Main
    
      Init                                             ' start up comms and LCD
    
    ' bunch of stuff I wrote
    ' to be tested by sending to a terminal
      Results (@ADCChans, Chans)           ' address of 12 bit data value per channel and number of channels
    
    
    PUB Results  ( ChanOut, ChanNo ) | n   ' Test printout to terminal
    
      fdx.tx($a)      ' print a newline
      fdx.tx($d)      ' print a return 
      ChanNo--
       repeat n from 0 to (ChanNo)              ' print the values  for each ADC
         fdx.tx($d)                                        ' separate groups of readings
         fdx.tx($a)                                        ' with cr/lf extra at top of read
         fdx.str(string("Channel "))                ' print channel
         fdx.dec(n)                                        ' number
         fdx.str(string(" "))                             ' space
         fdx.hex(word[ChanOut],4)                ' print hex
         fdx.str(string(" "))                              ' space
         fdx.dec((word[ChanOut])*Vref/States)    ' print derived human value
         fdx.str(string("mV"))                          ' and units
         ChanOut += 2                                  ' word storage for 12 bit value
      
    
    
    PUB init
      LCD.Init                                      ' start up an LCD display module
      fdx.Start (RxD,TxD,Mode,Baud)  ' setup serial comms in a cog, 6 left to abuse... 
    
    

    Any typos or errors are mostly my own, I learned from the best out there....
  • @JonnyMac,

    Looks like you got ahead of me on this one. I suggested the OP not mess with libraries until he has a need for them. Far easier to put what he needs all in one subdirectory and does not get tripped up by which version of object.spin he may have in a library somewhere the content of which he may not be able to find and review.

    Kinda like putting the contents of your (or any good complete) project template (as posted a few pages back) in a "my_shiny_new_whiz_bang_project" directory for a fast jump start working on the project rather than wasting time on setting up an environment which most of the time starts pretty much the same way. Just had an extra 2cents to put in rather than hoarding it until my next visit to the CoinStar machine.
  • Checked all of my libraries and there is a copy of FullkDuplex SerialPlus in all librariues but the compiler still can't find the object.
  • Tried to use the"PropellerIDE but no files for fdserial in any form in the library and unable to load to the PropellerIDE
  • frank freedmanfrank freedman Posts: 1,983
    edited 2020-07-09 21:22
    Forget about libraries, save it for once your project is working. Just for now, copy all of your spin objects into a single directory. Make sure the names of the spin files match the names of the right side spin object names in your OBJ part of the code. Post a screen shot of the spin tool when you get the error.



    Added screen shot w/ relationship of Directory==>object.spin files ===>OBJ name:object file ===>Method call in Object
    2520 x 1734 - 598K
  • How do I capture a screen shot.
  • Picture below, only way I know how.
    1152 x 864 - 361K
  • 1. First open your propeller tool. 2. Open the full duplex plus from the forum spin file. 3. Find the (X86) program files, click on that. 4. Then scroll down the tree until you find parallax, then propeller, then library. 5. Now go up to file top left. 6. click save as. 7. Find Program files(X86) again. 8. Click on (X86), find parallax, propeller, and library again, and save it in your library. 9. Hopefully your telescope program is saved in your library too. Looks good your library is open, make sure the file name matches the file name in your object exact.
    If you have ser : "FullDuplexSerialPlus" listed in your Object, the file name saved in your library needs to have the same exact name,"FullDuplexSerialPlus"

    Not "FullDuplexSerialPlus1" or 2 or 3 Etc.
  • JonnyMacJonnyMac Posts: 9,161
    edited 2020-07-09 23:00
    Jumpin' Jiminy on a cracker!!! You have a space in the name of the object. Also, you don't need to put the extension in the object file name -- it's a Spin compiler, it knows to look for .spin files.
    1152 x 463 - 1M
  • JonnyMac wrote: »
    Jumpin' Jiminy on a cracker!!! You have a space in the name of the object. Also, you don't need to put the extension in the object file name.

    Eagle eyes Jon!
  • I did miss the space, but whatever is in the quotes " " must match, The (1) is probably just a another copy.
  • Duplicate. windows will add numbers to duplicate files esp when downloading a file that already exists in the destination directory. Also, win10 screen shot, shift+win+s gives a snapshot menu. Then upload the .png file.

    Help me CodeMeJon McPhalen your our only hope..............;)
  • Made another attempt at testing the serial but to no avail. Nothing on the terminal screen and no function to the output pins Do I need to setup a second set of serial pins. Whats the dope on this.
    1152 x 864 - 288K
    1152 x 864 - 283K
  • Sorry, I don't get it.
  • The pictures are fuzzy. Post your latest code (the whole code). I see the value strings value 1, 2 etc. let see what's in your ser.dec(????)
  • What values are you expecting, PIN number , pulse count, pin state etc.
  • I expect to see the same as in the second photo, four values and four numbers, each value has a level . Values 2 and 4 are either 1 or 0 and values 1 and 3 are levels between 0 and 255. Each time I press a direction button either value 1 and 2 will display a level or value 3 and 4 will display a level
  • unable to open your file my comp. wouldn't allow.
  • longcon {timing}

    _clkmode = xtal1 + pll2x
    _xinfreq = 5_000_000


    CLK_FREQ = ((_clkmode - xtal1) >> 6) * _xinfreq

    'CLK_FREQ = ((_clkmode >> 6) * _xinfreq * _xinfreq
    MS_001 = CLK_FREQ / 1_000
    US_001 = CLK_FREQ / 1_000_000

    con { io pins }

    RX1 = 31 {I}
    TX1 = 30 {O}
    SDR1 = 29 {I/O}
    SCL1 = 28 {I/O}

    con {user io}

    NS_PLS = 16
    NS_Dir = 15
    EW_PLS = 14
    EW_Dir = 13

    BTN_N = 7
    BTN_E = 5
    BTN_S = 6
    BTN_W = 4

    con {navigation}

    NORTH = %1000
    EAST = %0100
    SOUTH = %0010
    WEST = %0001

    #0, GO_NORTH, GO_SOUTH
    #0, GO_EAST, GO_WEST

    CYCLE_TIX = CLK_FREQ / 50
    MOVE = MS_001 * 15
    MOVES = US_001 * 1500
    STOP = 0

    con

    #true, on, off
    #false, no, yes

    var

    long nspulse
    long ewpulse
    long status_N
    long status_S
    long status_E
    long status_W
    long Stack0[30]
    obj

    ser: "fullDuplexSerialPlus"
    ' LCD : "debug_lcd"


    PUB Main




    Cognew(serial ,@Stack0)
    main1
    pub main1 | t, nav




    setup

    ser.start(31, 30, 0, 9600)

    t := cnt
    repeat
    nav :=scan_nav_buttons(5)
    case nav
    NORTH :
    nspulse := MOVE
    outa[NS_Dir] := GO_NORTH
    ewpulse := STOP

    EAST :
    ewpulse := MOVE
    outa[EW_Dir] := GO_EAST
    nspulse := STOP

    SOUTH :
    nspulse := MOVE
    outa[NS_Dir] :=GO_SOUTH
    ewpulse := STOP

    WEST :
    ewpulse := MOVE
    outa[EW_Dir] := GO_WEST
    nspulse := STOP

    other :
    ewpulse := MOVES
    outa[EW_Dir] := GO_WEST
    nspulse := STOP

    ' serial
    phsa := -nspulse
    phsb := -ewpulse

    waitcnt (t += CYCLE_TIX)

    pub scan_nav_buttons(ms) : nav | t

    --nav
    t := cnt
    repeat ms
    waitcnt(t += MS_001)
    nav &= (ina[BTN_N] << 3) | (ina[BTN_E] << 2)|(ina[BTN_S] << 1)| ina[BTN_W]
    status_N:=ina[BTN_N] | status_E:=ina[BTN_E] | status_S:=ina[BTN_S] | status_W:=ina[BTN_W]

    pub setup

    outa := $00000000
    dira := $00000000

    ctra := %00100 << 26 | NS_PLS
    frqa := 1
    phsa := STOP
    dira[NS_PLS] := 1
    dira[NS_Dir] := 1

    ctrb := %00100 << 26 | EW_PLS
    frqb := 1
    phsb := STOP
    dira[EW_PLS] := 1
    dira[EW_Dir] := 1


    pub serial

    repeat
    ser.str(string( " value 1: "))
    ser.Dec(nspulse)
    ser.str(string( " value 2: "))
    ser.Dec(Status_N)
    ser.str(string( " value 3: "))
    ser.Dec(ewpulse)
    ser.str(string( " value 4: " ))
    ser.Dec(Status_S)
    ser.str( string( " "))
    ser.Tx(13)

    ' nspulse := ser.Getlong
    ' outa[NS_Dir] := ser.Getlong
    ' ewpulse := ser.Getlong
    ' outa[EW_Dir] := ser.Getlong
  • Here is one with correct indentation:
    ''Telescope test 2b
    
    longcon  {timing}
    
    _clkmode = xtal1 + pll2x
    _xinfreq = 5_000_000
    
     
        CLK_FREQ = ((_clkmode - xtal1) >> 6) * _xinfreq
    
         'CLK_FREQ = ((_clkmode >> 6) * _xinfreq * _xinfreq 
    MS_001 = CLK_FREQ / 1_000
    US_001 = CLK_FREQ / 1_000_000
    
    con  { io pins }
    
      RX1 = 31 {I}
      TX1 = 30 {O}
      SDR1 = 29 {I/O}
      SCL1 = 28 {I/O}
    
    con  {user io}
    
      NS_PLS = 16
      NS_Dir = 15
      EW_PLS = 14
      EW_Dir = 13
    
      BTN_N  =  7
      BTN_E  =  5
      BTN_S  =  6
      BTN_W  =  4
    
    con {navigation}
    
      NORTH = %1000
      EAST  = %0100
      SOUTH = %0010
      WEST  = %0001
    
      #0, GO_NORTH, GO_SOUTH
      #0, GO_EAST,  GO_WEST
    
      CYCLE_TIX = CLK_FREQ / 50
      MOVE  = MS_001 * 15
      MOVES = US_001 * 1500
      STOP  = 0
    
    con
    
      #true,  on, off
      #false, no, yes
    
    var
    
      long nspulse
      long ewpulse
      long  status_N
      long  status_S
      long  status_E    
      long  status_W    
      long  Stack0[30]  
    obj
    
      ser: "fullDuplexSerialPlus"
      ' LCD : "debug_lcd"
    
    
    PUB Main
    
    
      
    
         Cognew(serial ,@Stack0) 
     main1
    pub  main1 | t, nav
    
    
       
    
      setup
    
      ser.start(31, 30, 0, 9600)
    
      t := cnt
      repeat
        nav :=scan_nav_buttons(5)
        case nav
          NORTH :
            nspulse := MOVE
            outa[NS_Dir] := GO_NORTH
            ewpulse := STOP
    
          EAST :
            ewpulse := MOVE
            outa[EW_Dir] := GO_EAST
            nspulse := STOP
    
          SOUTH :
            nspulse := MOVE
            outa[NS_Dir] :=GO_SOUTH
            ewpulse := STOP
    
          WEST :
            ewpulse := MOVE
            outa[EW_Dir] := GO_WEST
            nspulse := STOP
    
          other :
            ewpulse := MOVES
            outa[EW_Dir] := GO_WEST
            nspulse := STOP
            
       ' serial
        phsa := -nspulse
        phsb := -ewpulse
    
        waitcnt (t += CYCLE_TIX)
    
    pub  scan_nav_buttons(ms) : nav | t
    
      --nav
      t := cnt
      repeat ms
        waitcnt(t += MS_001)
              nav &= (ina[BTN_N] << 3) | (ina[BTN_E] << 2)|(ina[BTN_S] << 1)| ina[BTN_W]
            status_N:=ina[BTN_N] | status_E:=ina[BTN_E] | status_S:=ina[BTN_S] |  status_W:=ina[BTN_W] 
         
    pub  setup
    
      outa := $00000000
      dira := $00000000
    
      ctra := %00100 << 26 | NS_PLS
      frqa := 1
      phsa := STOP
      dira[NS_PLS] := 1
      dira[NS_Dir] := 1
    
      ctrb := %00100 << 26 | EW_PLS
      frqb := 1
      phsb := STOP
      dira[EW_PLS] := 1
      dira[EW_Dir] := 1
            
    
    pub  serial
    
     repeat
      ser.str(string( " value 1: "))
      ser.Dec(nspulse)
      ser.str(string( " value 2: "))
      ser.Dec(Status_N)
      ser.str(string( " value 3: "))
      ser.Dec(ewpulse)
      ser.str(string( " value 4: " ))
      ser.Dec(Status_S)
          ser.str( string( "    "))  
      ser.Tx(13)
    
     ' nspulse      := ser.Getlong
     ' outa[NS_Dir] := ser.Getlong
     ' ewpulse      := ser.Getlong
     ' outa[EW_Dir] := ser.Getlong
    
  • msrobotsmsrobots Posts: 3,709
    edited 2020-07-13 18:13
    what is longcon supposed to do?

    Mike
  • I have no Idea , The first one sent to me had it in the code.
  • Sorry posted the wrong format on the lisitng. Just open your prop tool and click on the spin file. The longcon is in your program. You can just comment that out.
  • What I don't understand is how the serial cog can output the pulses to the output pins when cog0 is in control of the output pins . The EW_PLS pin is always sending a pulse and The EW_Dir pin is always high when in tracking mode . Also doesn't the "FullDuplexSerialPlus set up the cog new anyway?
  • Your pulse out pins are 14 and 16. Pin 14 out is controlled by Input pin 4,5 , and 6. Pulling pin 6 high stops the output to pin 14. Pulling PIn 4 or 5 varies pulse width. Pin 16 only outputs when Pins 6 or 7 are pulled high. Pins 13 is in a constant high output. Pulling input pin 5 makes pin 13 go low. Pin 15 you can toggle high or low with pins 6 and 7. This is your code I just made it work so you can see it on the serial term.
Sign In or Register to comment.