Loading libraries into Propeller tool : DONE
bbrien
Posts: 561
I have been trying to load the "FullDuplexSerialplus library into the propeller tool without luck.
Comments
Any typos or errors are mostly my own, I learned from the best out there....
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.
Added screen shot w/ relationship of Directory==>object.spin files ===>OBJ name:object file ===>Method call in Object
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.
Eagle eyes Jon!
Help me CodeMeJon McPhalen your our only hope..............;)
https://www.businessinsider.com/how-to-screenshot-on-windows
}
_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
Mike