non-parallax advice
TC
Posts: 1,019
Hello all,
First off, I would like to say I am sorry for asking on the parallax forum. But I don't know where I should go.
I am the proud owner of a Atmel STK300I. I got it because I want to learn how to program in assembly. Now I know the prop can do assembly, but I kept getting confused trying to understand things. Because I could not find anything for beginners. I have never programed in assembly, so I don't know where to start.
I was hoping the gurus on here could guide me where I should look, or go to get the support I am going to need.
Thanks, and I hope I don't get lynched for breaking the cardinal rule
TC
First off, I would like to say I am sorry for asking on the parallax forum. But I don't know where I should go.
I am the proud owner of a Atmel STK300I. I got it because I want to learn how to program in assembly. Now I know the prop can do assembly, but I kept getting confused trying to understand things. Because I could not find anything for beginners. I have never programed in assembly, so I don't know where to start.
I was hoping the gurus on here could guide me where I should look, or go to get the support I am going to need.
Thanks, and I hope I don't get lynched for breaking the cardinal rule
TC
Comments
in other assembly languages are just fluf.
http://highered.mcgraw-hill.com/sites/0072467509/
As for the Propeller, there are two getting started guides: potatohead's and deSilvia's.
http://gadgetgangster.com/news/45-designer-news/275-propeller-assembly-tutorial.html
The STK300 is the programming device for any AVR device (to a computer's parallel port... very retro style). And OpenAVR provides a C compiler.
I fear that assembler for a newbie on an AVR is going to be more of a slog than learning PASM on the Propeller... ton's of registers, a bit of EEPROM, a bit of FLASH, and a bit of RAM. Every processor has a different structure and requires rather deep study. That's why they like to use C.
There is a good reason that Parallax named their IDE, SimpleiDE. You will find that the Atmel AVR is a jungle of options. If you really want to learn assembler on something other than the Propeller and want something simple, a PIC 16F84 programmer might be far less daunting. You get one of Mike Preko's books used (they are out of print now)
Thank you for the info, I am currintly tring to find a good deal on the book, and I downloaded the PDFs
You are correct.
You could be correct on that part. But that is what i was drawn to. I dont have a 100% understanding of RAM, EEPROMS, FLASH, etc.. and I was figuring this would be the best way to learn more then I know.
Never used C, and it feels like everyone now and days are refusing to remember the old technology. But I won't. I am amazed how products were 10-20 years ago, when they had limited resources. Some of the products from 10-20 years ago are still better then the products being made today.
I think I will get his book.
I think the best beginner's book on assembly Is "how computers do math" .
http://www.clivemaxfield.com/diycalculator/index.shtml
Brian
OK, that book is one I have to have. Thank you
Edit:
And I just found the whole book on PDF
PASM is by far the easiest assembler language to learn I have ever seen and using it from within Spin with the Propeller Tool or SimpleIDE is very easy to get started with.
Start with something dead simple. If you can flash a LED from Spin, try and do the same from PASM.
And, importantly, when you get stuck you only have to ask here !
And bit banging serial ports and such with only 32 bytes of RAM can really show what drives all the other stuff.
When you have 32Kb or 512Kb of ram, you begin to ignore the fundamentals and the little things that enhance speed. You really don't need USB either. It tends to add a hardware expense and a software overhead for the sake of 'one plug does all'.
Serial ports and parallel ports still do a lot and can do a heck of a lot. Even FTDI sells chips that convert USB to parallel.
It was a bit sad that Parallax discontinued the SX chips. I think that it pulled out a big chunk of what should be in an educational curriculum.
Try www.piclist.com for code examples and such. Even Chip Gracy got started with 8 bit PICs for the BasicStamps.
It becomes very obvious with 8 bit that the range of numbers in any microprocessor is not infinite. And also, that converting to and from decimal is just please humans... the real speed is in binary maths, unsigned integer maths, and signed interger maths.
All good stuff, but if you are new to all this and perhaps just want to checkout what all this assembler business is about anyway then why not make it as painless as possible?
This is why they teach assembler courses in universities using the MIPs architecture and running in a simulator.
PIC is a pain, AVR is a bit better, the Propeller is fun. Just hit F9 and it runs.
8 bit assembly has a lot to be recommended, but it is also well off the beaten path. If there are 8 bit systems you enjoy, I recommend learning assembly language, if not, then I second the comment Heater made.
And I would add, having two systems to program for can teach you a lot about what assembly language is.
Do go and blink that LED, and then do go and do it parametrically, by using numbers to set the blink rate. If you are bored, use a speaker and make some fun sounds! It's the same program, which highlights some of what assembly language is right there.
Then go and do it on your other system. This will factor out a lot of the assumptions you make and raise some great questions to think on.
I read deSilva's tutorial several times but it was initially way over my head (I still recommend it). I finally was able to make some sense of PASM with the help of JonnyMac's SpinZone articles.
After reading the SpinZone articles and trying out the examples (and modifying the examples) I was able to write some of my own PASM drivers.
I somehow missed hearing about potatohead's tutorial until much later (I haven't read it).
I have links to these various resources in post #3 of my index.
With single core mcu, you have to make sure you think in statemachine-way if you are doing multiple things, and that is harder.
With the Prop you can dedicate on cog to a single task.
In Asm you have to create you own subroutines and you don't use brackets but instead cmp then jmp to label.
What is the difficult part for you to grasp?
I have thought of that. And everyone on here has been extremely helpful for me for years(since it was a Yahoo forum).
From what I have seen on Google, Atmel uses assembly. And the datasheet for the ATMEGA103(the chip I have) only talks about assembly.
I learn by dissecting the code, I am able to see what happens when I change a value, add a line, remove a line, etc..
That is what makes it great. Since I am a gear head, I like things to be efficient, and preform to the max. From what I can tell (on Google) assembly and these older chips forces you to be efficient.
Thank you for the encouragement. I dont have a 8-bit system I enjoy, I only know parallax (Prop, BS2). I feel for me to learn more, I have to get out of my Parallax bubble and explore new things. But I will not get into the whole Arduino thing, the crowd base is way to large for me. It makes me uncomfortable.
Cool, thanks for the info.
What is so bad about thinking in "statemachine-way"? Could you imagine how much better programs and apps would be if the programer went back to the basics, and wanted to make the program use the processioning power to its fullest? Lets use this just as an example; in PSAM each command(dont know the real term) takes 4 clock cycles. and the prop is really fast at doing stuff in PSAM. Now what if we could run the PSAM code on my computer(5MHz quad core, 32GB RAM)? The program would be insanely fast.
The difficult part is, not knowing how or where to start.
For assembly programming, it would be hard to imagine a more beginner-friendly architecture than that of the Propeller.
-Phil
It's the correct way to program in asm down the road, but to learn starting with one task programs that allows wait/loops is easier,
I'm working on 16bit StateMachine for the P1, there are only 4 opcodes for Boolen IF statements but with a true or false setting for the correct condition match (up to 16 per line),
no wait or loops what so ever, it just re-run the machine 1000/sec
_IF_ P01L, P10H, R1=$A800, R31&3, notR2=2 _DO_ P02H, P07T, R20+8, R16<<2
But I learned all about assembler reading his early book 'Understanding the 68000 Leon Heller '...
Enjoy!
Mike
As I've said many times, I found your articles very helpful.
Here is a link to the SpinZone articles.
exactly.
I had that book way before I had the ATARI ST. Loved it.
Thanks Leon!
Enjoy!
Mike
+1
I have programmed in assembly on close to a dozen minicomputers, starting with IBM1401 SPS and most of the early 8 bit microprocessors (8080, 6502, 1802, Z80, 6800, 6809, etc) and have to agree with Heater. Once you learn how to start a cog PASM is about the easiest assembly language going, and still covers all the basic machine language instructions you need to do anything a computer can do.
That was a long time ago!
Maybe so, but it is a very good book. I may not always agree with what you post, but I do read them and value your opinions and advice.
Processor architecture....
When you learning Assember, you also are learning what the processor architecture is all about. A simpler, cleaner concept to processor architecture makes your first Assembler projects much easier to comprehen.
AVR architectures require a lot more documentation as they are not simple and you have to read and understand all that to get results. If you change from one AVR chip to another, you have to start over if you are programming in Assembler. (In C, they use #include <file> to protect you from having to know all that.)
IDE...
Complex IDEs are frustrating as they throw a lot of options at you that are a distraction to your actual studies.
For the Propeller, my first choice is Brad's Spin Tool as it offers a bit more information than the PropellerTool or SimpleIDE. But all 3 are much better than the free Atmel IDE that is intended to dazzle the professional engineer by having all and everything.
Maths...
So people just can't seem to comprehend that Floating Point Decimal is a human user accomodation feature and try to force their code to always use it.
When working with Assembler, it is best to start out with anything but Floating Point Decimal.
For most Maths, use either Unsigned Integer or Signed Integer and learn why you decided one of the other.
For Boolean operations and i/o ports, learn to use Bit manipulation.
And don't expect your numbers to extend to infinite. You have a limit based on what the processors architecture is (8 bit limits your range to 256 integers at most, unless you do some doubling up to make 16bits possible)
Here is a clarification
For 8 bit
In Unsigned integer (usually used for counting loops and such), your range is 0 to 255, and then it rolls over
In Signed integer (usually used for maths that requires negative numbers, your range is -127 to 128. This is twos-compliment format which you need to learn right away.
32 bit makes the range much wider, but Signed integer is still half the range of positive numbers Unsigned integer.
So it is all about the Limitations of number range, the Limitations of the architecture, and the task you desire to code.
Good luck.
Next get a momentary push of a button to turn on/off that LED.
After that, piece of cake...
Note with some microcontrollers like Microchip's, those basic steps could take a month of reading, installing software for the IDE, trial and error, learning the internal sections of the microcontroller, etc.
The SECRET to learning this is to start with a microcontroller which has tons of documentation and a forum loaded with intelligent people. That would be Parallax's and Microchip's forums.
As for myself, I easily understand complex things, but DON"T GET the basic easy stuff! (The things everyone else in the whole world knows... Maybe because everyone else knows it, they don't bother to explain it anywhere?)
Like a PIC "FOSC". Everywhere in their documentation it says FOSC this and FOSC that... But good luck finding out what FOSC is! (Actually it is the ENTIRE settable oscillator module or "Flexible Oscillator Structure".)
Anyway nice to have a good forum where you can ask questions like that.
Could not agree with you more.