Shop OBEX P1 Docs P2 Docs Learn Events
non-parallax advice — Parallax Forums

non-parallax advice

TCTC Posts: 1,019
edited 2014-04-25 16:08 in General Discussion
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 :lol:

TC
«1

Comments

  • SRLMSRLM Posts: 5,045
    edited 2014-04-19 05:36
    This is the book that taught me assembly programming. I like it because it uses a small 16 instruction assembly language to teach you everything you need to know. All the other instructions
    in other assembly languages are just fluf.

    http://highered.mcgraw-hill.com/sites/0072467509/
    Patt_lg.jpg

    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
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-19 05:47
    Well, it seems you got it from Mindrobots.

    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)
  • TCTC Posts: 1,019
    edited 2014-04-19 06:19
    SRLM wrote: »
    This is the book that taught me assembly programming. I like it because it uses a small 16 instruction assembly language to teach you everything you need to know. All the other instructions
    in other assembly languages are just fluf.

    http://highered.mcgraw-hill.com/sites/0072467509/
    Patt_lg.jpg

    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

    Thank you for the info, I am currintly tring to find a good deal on the book, and I downloaded the PDFs
    Well, it seems you got it from Mindrobots.

    You are correct.
    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.

    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.

    Every processor has a different structure and requires rather deep study. That's why they like to use C.

    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.
    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)

    I think I will get his book.
  • Brian_BBrian_B Posts: 842
    edited 2014-04-19 06:19
    Hi,
    I think the best beginner's book on assembly Is "how computers do math" .
    http://www.clivemaxfield.com/diycalculator/index.shtml

    Brian
  • TCTC Posts: 1,019
    edited 2014-04-19 06:29
    Brian_B wrote: »
    Hi,
    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
  • Heater.Heater. Posts: 21,230
    edited 2014-04-19 07:20
    I would seriously suggest learning assembler by playing with PASM in a Spin program for the Propeller.

    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 !
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-04-19 07:47
    A problem I think you're going to run into is that the Atmel AVR chips were designed with C programming in mind. Atmel pushes this aspect, and their tools are centered around it. On the other hand, the 8-bit PIC chips are routinely programmed in assembler, and so the the Internet is full these of examples, likely many for the kinds of things you're most interested in learning about. I find it's always easiest when you have a working example in front of you that you can dissect.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-19 08:10
    I know it may seem wierd, but learning 8-bit assembler really makes you aware of the core of computers..

    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.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-19 08:27
    A problem I think you're going to run into is that the Atmel AVR chips were designed with C programming in mind.
    Maybe you can give an example of why this is a problem? I've found AVR instructions easy to use. Small PICs require page swapping for accessing data which to me is a horrible hack.
  • Heater.Heater. Posts: 21,230
    edited 2014-04-19 09:02
    Ultimately when you need to use assembler you will have to learn the architecture of whatever device you are confronted with, the assembler syntax of the tools provided and whatever quirks of actually programming the hardware.

    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.
  • potatoheadpotatohead Posts: 10,261
    edited 2014-04-19 09:15
    I second the book recommendations so far.

    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.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-19 10:07
    The only assembly I know is PASM.

    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.
  • tonyp12tonyp12 Posts: 1,951
    edited 2014-04-19 13:23
    Learn PASM, cognew(@entry, 0) and you are in pasm mode

    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?
  • TCTC Posts: 1,019
    edited 2014-04-19 15:17
    Heater. wrote: »
    I would seriously suggest learning assembler by playing with PASM in a Spin program for the Propeller.

    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 !

    I have thought of that. And everyone on here has been extremely helpful for me for years(since it was a Yahoo forum).
    A problem I think you're going to run into is that the Atmel AVR chips were designed with C programming in mind. Atmel pushes this aspect, and their tools are centered around it. On the other hand, the 8-bit PIC chips are routinely programmed in assembler, and so the the Internet is full these of examples, likely many for the kinds of things you're most interested in learning about. I find it's always easiest when you have a working example in front of you that you can dissect.

    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..
    I know it may seem wierd, but learning 8-bit assembler really makes you aware of the core of computers..

    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.

    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.

    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.
    potatohead wrote: »
    I second the book recommendations so far.

    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.

    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.
    Duane Degn wrote: »
    The only assembly I know is PASM.

    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.

    Cool, thanks for the info.
    tonyp12 wrote: »
    Learn PASM, cognew(@entry, 0) and you are in pasm mode

    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?

    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.
  • TCTC Posts: 1,019
    edited 2014-04-19 15:20
    With everyone help, I have decided to put this board away for a little bit, and use PSAM to get me started learning. Then after I start getting the hang of it, bringing out the Atmel board and start playing with it.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-04-19 15:45
    Some people have found my Nuts & Volts column (which are somewhere on the Parallax site...) helpful, as I mix Spin and PASM. I do my best to talk people through the logic of the PASM code so they can modify it for their own needs.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-19 16:06
    I've programmed AVRs in assembly and Props using PASM. PASM is by far the easier of the two. What makes AVRs a challenge is their irregular architecture. Instructions that you think ought to be there are not, because they were not deemed necessary for C programs. Likewise for register usage: some registers can be used for some things but not for others. In PASM, there are no "missing" opcodes that were sacrificed on the altar of C efficiency. And every register is treated the same. Moreover, every pin can be used for any I/O function. In AVRs, the hardwired perpherals connect only to their own pins. Finally, just to use the AVR's hardwired peripherals, you have to initialize numerous configuration registers.

    For assembly programming, it would be hard to imagine a more beginner-friendly architecture than that of the Propeller.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2014-04-19 16:07
    >What is so bad about thinking in "statemachine-way"?
    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
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-19 16:40
    I know that a lot of people are bashing @Leon.

    But I learned all about assembler reading his early book 'Understanding the 68000 Leon Heller '...

    Enjoy!

    Mike
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-19 16:53
    JonnyMac wrote: »
    Some people have found my Nuts & Volts column (which are somewhere on the Parallax site...) helpful, as I mix Spin and PASM.

    As I've said many times, I found your articles very helpful.

    Here is a link to the SpinZone articles.
  • potatoheadpotatohead Posts: 10,261
    edited 2014-04-19 17:19
    Anybody who gave the Moto 68K some love can't be bad. :)
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-19 17:27
    potatohead wrote: »
    Anybody who gave the Moto 68K some love can't be bad. :)

    exactly.

    I had that book way before I had the ATARI ST. Loved it.

    Thanks Leon!

    Enjoy!

    Mike
  • kwinnkwinn Posts: 8,697
    edited 2014-04-19 22:39
    Heater. wrote: »
    I would seriously suggest learning assembler by playing with PASM in a Spin program for the Propeller.

    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 !

    +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.
  • kwinnkwinn Posts: 8,697
    edited 2014-04-19 22:41
    PS - Plus having this forum to help is icing on the cake and then some.
  • LeonLeon Posts: 7,620
    edited 2014-04-19 23:03
    msrobots wrote: »
    I know that a lot of people are bashing @Leon.

    But I learned all about assembler reading his early book 'Understanding the 68000 Leon Heller '...

    Enjoy!

    Mike

    That was a long time ago!
  • kwinnkwinn Posts: 8,697
    edited 2014-04-20 00:14
    Leon wrote: »
    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.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-20 02:20
    For learning assembly language programing there really are some fundamential issues that crop up regularly.


    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.
  • TCTC Posts: 1,019
    edited 2014-04-20 07:01
    Thank you everyone. I am going to learn with PSAM. You will be hearing a lot from me as I learn. I will start learning after I complete my reflow oven.
  • bill190bill190 Posts: 769
    edited 2014-04-20 09:08
    The place to start with assembly is to get an LED to blink on/off.

    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.
  • TCTC Posts: 1,019
    edited 2014-04-20 14:12
    bill190 wrote: »
    Anyway nice to have a good forum where you can ask questions like that.

    Could not agree with you more.
Sign In or Register to comment.