SPIN -> Assembly
Lafet
Posts: 23
Hi,
I'm beginner. Help me please. How it is possible put into Assembly this programme in SPIN?
"pwm.output" is Assembly in object file "pwm.spin"
Thank you very much. Lafet
I'm beginner. Help me please. How it is possible put into Assembly this programme in SPIN?
PUB Rotary | i repeat repeat i from 0 to 5 pwm.output(PIN_SEQ[i],PWM_PIN[i],70) repeat 6 waitpeq(%10000, %10000, 0) waitpne(%10000, %10000, 0) DAT PWM_PIN byte 0, 1, 2, 0, 1, 2 PIN_SEQ byte %001, %101, %100, %110, %010, %011 [/i][/i]
"pwm.output" is Assembly in object file "pwm.spin"
Thank you very much. Lafet
Comments
Ok I totally get the "what are you tryin' to do", but what other good references are out there for those tryin' to learn the code who are beginner programmers? Other than the manual and the forum....anyone brave enough to offer classes yet?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
can you please pass the jelly....
(a) The code you posted makes not much sense, but I assume I understand what you intend to do.
(b) The object PWM you posted consists of a machine language part which is not well adapted to its interface. The assembly part regularly looks for modulation date that is provided only once in the beginning... It seems, this PWM is still unfinished
(c) But WRT to your purpose it looks best you just add (SPIN) code to this object!
(d) The speed possible in machine language may be needed for your intend or maybe not, but you are far better off by using a timer/counter. How to programm a timer for PWM application is well explained in AN001.
So, I do not think translating your program into assembly language makes any sense..
There are books being written, some piecemeal on this forum, and some quietly in the background. There is a lot of information already available in the forums and in the Hydra and Propeller manuals. If you want classes, do you have enough money to pay for plane fare, housing, tuition (pricey), etc.? I'm sure there are several people who would be willing to put on a nice 3 or 4 day workshop in a resort-y place for $500-$750 per person, minimum 15 attendees, transportation and accomodations not included, 2-3 months' advanced booking required, Propeller tools provided at cost.
PIN_SEQ byte %001, %101, %100, %110, %010, %011 is mask for setting P2..P0 to High or Low.
PWM drives always pin, which is in sequence ones with logical value (%001 = P0, %101 = P1, ...).
To 15.000 revolutions is duration impulse on P4 17 microseconds. I think, that the SPIN is slow.
Lafet
The action after 6 pulses has to involve very little action
because the next pulse will start very quickly. If the pulse is short
so you don't have to wait for it to end, then you won't need the
waitpeq.
Spin can "bit bang" asynchronous serial I/O at over 19.2KBaud. That's
about 50us per bit and the code involved in that loop is a little more complex
than what you need here. It's worth trying to see if you can do this in Spin.
Other options include using the edge detection mode for one of the cog counters
and having your Spin program sit in a loop waiting for the edge count to reach 6,
then resetting the count and changing the BLDC motor information. The counters
can count edges at about a 40MHz rate and can be administered from Spin.
Post Edited (Mike Green) : 8/14/2007 9:46:42 PM GMT
take care
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
can you please pass the jelly....
RE the propeller conference.
I'd be willing to attend. Would you if there were at least 15 paying attendees? It could really be something...
John