PUB/PRI code to use OBJ?
$WMc%
Posts: 1,884
Hello All
I'm looking for some code that will help me understand "SPIN"
I have found a ton of object codes, But without a good SPIN code to run the OBJECT file; its worthless.
Any suggestions would be great.
_________________$WMc%__________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
Post Edited ($WMc%) : 11/14/2009 1:52:44 PM GMT
I'm looking for some code that will help me understand "SPIN"
I have found a ton of object codes, But without a good SPIN code to run the OBJECT file; its worthless.
Any suggestions would be great.
_________________$WMc%__________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
Post Edited ($WMc%) : 11/14/2009 1:52:44 PM GMT
Comments
Have a look at these programs:
http://forums.parallax.com/attachment.php?attachmentid=61850·· Spin Program
and
http://forums.parallax.com/attachment.php?attachmentid=64740·· Zip file with Spin programs
and
http://forums.parallax.com/attachment.php?attachmentid=62056·· Spin Program
and
http://forums.parallax.com/attachment.php?attachmentid=62136·· Zip file with Spin programs
and
http://forums.parallax.com/attachment.php?attachmentid=62391·· Zip file with Spin programs
and
http://forums.parallax.com/attachment.php?attachmentid=62392·· Zip file with Spin programs
Samuel
Post Edited (SamMishal) : 11/14/2009 3:10:14 AM GMT
"Ron W.-You can't fix stupid-A'm I a lost cause"
so as long as you don't add some more specific information what you would like to know or what you would like to do
Sam has given an answer that goes far beyound duty
best regards
Stefan
Thanks for the Spin code. I'll study these examples.
StefanL38 : After I get the hang of Spin and then a little Propeller Assembly, I plan on changing out the 3 BS2s on my remote controlled Bush Hog with 1 Propeller.
I need to learn how to:
use the 27980 and 27981 RF units with the Prop.
PWM with ramp up/down and direction control with the Prop.
Tach input
serial LCD
But for now I'm just trying to learn the program flow and how to interact with Object files.
Any links or suggestions really help. Thanks in advance.
____Sam Thanks again for the links, Great info!_____________$WMc%______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
so the main difference between PBasic and spin is that pbasic has more sophisticated commands
than you have in SPIN.
PBasic example
in PBASIC the serin-command is hardcoded and you can't change its behaviour.
The only variance is to call the command with different values for the parameters.
In SPIN the "high-sophisticated" commands are realized through the combination of
basic commands
example receive a serial byte is done by the code
"PUB" indicates a subroutine (similar to a label in PBasic
"Rx" is the name of the subroutine
repeat while are elementary SPIN-commands
the command "rxcheck" inside the subroutine "Rx" is another subroutine
defined or "build" with elementary SPIN-commands
now the command "if" used in "RxCheck" is a REAL elementary SPIN-command
all the rest are variables that are nescessary to make it work but the variables are not important for the user
This means: in SPIN more complex commands are not "hardwired" like in PBasic
they are build out of elementary commands by defining sub-routines
Objects in SPIN are simply SPIN-files containing a collection of subroutines all build with the elementary set of SPIN-commands
which provide complex commands. In the code-example above a command to receive a byte over a serial connection
Now you may ask where are the parameters like IO-pins and baudrate ?
the parameters IO-pins and baudrate have to be configured ONE time.
The propeller-chip has 8 processor cores. These cores are called "COGs"
All the bitbanging for send and receive serial data is done by a second COG which works as a "driver" in the background
This cog has to be started before you can do serial communication.
This means a part of the code inside the file FullDuplexSerialPlus.spin is executed in the second COG running ALL THE TIME
waiting for serial data to be received and transmitted. This part of the code runs parallel to the first COG.
You can imagine this driver as if you would have a butler listening for the doorbell and as soon as he hears the doorbell
going to the door open it and take in the presents that are delivered. And listening for orders to bring some documents
to Mister A, oder Mister B
There is an object for serial communication, for creating a TV-signal, VGA-Signal etc., etc., etc.
If you want to use these complex commands you define a "connection" between the filename and an object-name
after defining this name "Debug" you can access the omplex SPIN-commands wich are defined in the file FullDuplexSerialPlus.spin
by writing ObjectName.Methodname
in the example above to receive a byte
if you want to learn more about objects and how to use them
read the chapter OBJECTS LAB page 81 in the Propeller Education Kit Labs
You can open this from the help-menu in the propellertool
see attached picture
I also attached a demo-code how to use the object for the serial communication
best regards
Stefan
Post Edited (StefanL38) : 11/14/2009 7:08:05 PM GMT
I can't thank you enough for the detailed post reply.
I have learned more from your explanation of Spin, Then I have from any other publication.
I thought SPIN was a highly advanced code,Over Basic, But after reading your post reply, I see its just the opposite.
I think You should be on the parallax payroll
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
I didn't realize that I was still using and older Propeller Editor ver 1.2.5 .I down loaded ver 1.2.6 and it has all the examples and the PE kit/labs.
Thanks again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA