StickBasic
Duane C. Johnson
Posts: 955
PropStick basic ( StickBasic )
Written in DongleBasic varient of FemtoBasic.
NEW
10 LET P=10
20 FOR A=0TO 27STEP 1
30 PRINT A;" ";
40 OUTA [A]=1
50 PAUSE P
60 OUTA [A]=0
70 PAUSE P
80 OUTA [A]=1
90 PAUSE P
100 OUTA [A]=0
110 PAUSE P
120 NEXT A
130 PRINT ""
140 GOTO 20
RUN
This, in sequence, pulses pins 27..0 .
When done, pins 15..0 go to input and 27..16 remain as outputs
as you said.
However, pins 11..9 start and remain as outputs and are high.
Or this:
NEW
10 OUTA [27..0]=$05555555
20 PAUSE 100
30 OUTA [27..0]=$0AAAAAAA
40 PAUSE 100
50 GOTO 10
RUN
When done, pins 15..0 go to input and 27..16 remain as outputs
with the values at the last known state. Except, pins 11..9
start and remain as outputs and are high.
Is it possible there is another cog grabbing port A pins 11..9?
I looked really hard and can't find where this is happening.
However, I am not skilled in Spin nor low level programming.
I know the hardware is running well as PropForth works properly.
( My favorite controller language but I wouldn't force that
insanity on others. )
BTW, I just got 2 DIP-40 Propellers running.
The first is just a plug board version of the PropStick.
The second is my equivalent of the obsolete PropStick
with Pin 12 as a voltage input of 3.3V to at least 12V.
The construction was done with a 40 pin socket and 2 20 pin
header sockets. This way I could break pin 12 and insert a
3.3V low dropout regulator. All of the parts are directly wired
in the space between the socket and the bottom of the Propeller.
The plan is for this micro to be easily programmed in just basic
for my nephew so he can get an interest in small controllers.
I am not a low level programmer. However I could muddle through
if given enough guidance.
Has anyone got a dumbed down version of FemtoBasic?
A no frills version where all 28 bits are available to the user.
Thanks!
Duane
Written in DongleBasic varient of FemtoBasic.
NEW
10 LET P=10
20 FOR A=0TO 27STEP 1
30 PRINT A;" ";
40 OUTA [A]=1
50 PAUSE P
60 OUTA [A]=0
70 PAUSE P
80 OUTA [A]=1
90 PAUSE P
100 OUTA [A]=0
110 PAUSE P
120 NEXT A
130 PRINT ""
140 GOTO 20
RUN
This, in sequence, pulses pins 27..0 .
When done, pins 15..0 go to input and 27..16 remain as outputs
as you said.
However, pins 11..9 start and remain as outputs and are high.
Or this:
NEW
10 OUTA [27..0]=$05555555
20 PAUSE 100
30 OUTA [27..0]=$0AAAAAAA
40 PAUSE 100
50 GOTO 10
RUN
When done, pins 15..0 go to input and 27..16 remain as outputs
with the values at the last known state. Except, pins 11..9
start and remain as outputs and are high.
Is it possible there is another cog grabbing port A pins 11..9?
I looked really hard and can't find where this is happening.
However, I am not skilled in Spin nor low level programming.
I know the hardware is running well as PropForth works properly.
( My favorite controller language but I wouldn't force that
insanity on others. )
BTW, I just got 2 DIP-40 Propellers running.
The first is just a plug board version of the PropStick.
The second is my equivalent of the obsolete PropStick
with Pin 12 as a voltage input of 3.3V to at least 12V.
The construction was done with a 40 pin socket and 2 20 pin
header sockets. This way I could break pin 12 and insert a
3.3V low dropout regulator. All of the parts are directly wired
in the space between the socket and the bottom of the Propeller.
The plan is for this micro to be easily programmed in just basic
for my nephew so he can get an interest in small controllers.
I am not a low level programmer. However I could muddle through
if given enough guidance.
Has anyone got a dumbed down version of FemtoBasic?
A no frills version where all 28 bits are available to the user.
Thanks!
Duane
Comments
Sorry for that. I looked at the code again and remembered that pins 8-11 are used for an optional SD card. Pin 8 isn't affected normally since that's an input for the Propeller, but pins 9-11 are outputs used by the cog that does the SD card I/O and thus overrides any use from Basic.
Attached is a slightly modified version of DongleBasic. Whenever it attempts to mount an SD card, the mount routine returns an error without initializing the I/O pins involved (9-11). These should work normally. Don't use any of the statements that make use of a mounted SD card. They'll all report an error Nothing else is changed except the version #. The change is in BB_massStorage.spin around line #305.
I have fixed the problem with I/O pins 16-27 where they don't get put back to input mode when a program stops
Thank you for fixing that SD card problem!!
It now works just fine.
However, the I/O pins 16-27 dirrection operation was not changed. They remain set to outputs after sending an ESCape code.
I went back to the previous revision to test it. Actually all pins did get set to inputs after a hard reset. I believe I didn't describe what I was seeing correctly.
Pins 16-27 remain as outputs after a SOFT reset, i.e. ESCape code. Of course the last port pin operation had to have been an output.
Actually, I kind of like this mode. Where the port pin "remembers" its last operation type and stays that way until changed.
I'm not sure what the standard pin philosophy is for basic. But the Propeller has 3 instruction types. INA, OUTA, and DIRA instructions. By adding a Direction command one could do this in the basic program.
In any case, where was the change you made? Line # ?
Thanks
Duane
2) In "doline", I changed the repeat range from 0-15 to 0-27 (line #1182). If the I/O pin was last used in an OUTA statement, it gets reset to input mode when the program stops. See the code for INA (line #388) and OUTA (line #986).