Assembly language?

mickelsen

New Member
I spent my entire career designing and programming custom embedded microprocessor systems. I always used assembly language for programming since our hardware interfaces needed all the speed they could get. Also, there really weren't any high level language development systems that would work for what we were doing.
I still like assembly language for high speed interfaces, and I'm wondering if there is any provision for using assembly language routines along with the Basic programs that are used for things that don't require the speed? This may seem strange and counterproductive with the Picaxe system, but I would still like to have the possibility. Any chance this can be done?
Thanks,
Mark
 

inglewoodpete

Senior Member
Allowing assembled routines to be embedded in a PICAXE would open the door to downloading the proprietary firmware.

If you need absolute speed, stick to assembler. A little off that pace but faster to market than assembler would be an optimised, compiled program in 'C' or other languages.

I have found that it is a rare application that PICAXE can't handle. Having said that, I also use PIC32s but the development process can take me 10 times longer than using a PICAXE.
 

geoff07

Senior Member
Though individual commands may be relatively slow, each Picaxe command represents a lot of processing inside the beast, so for some things you may find the difference isn't that great (and you can run some at 64MHz). Though I mostly use Picaxe I have a project ongoing using PIC C because it needs floating point (MPLABX, HITECH C). I find that I'm often re-implementing over days things that can be done in one statement in Picaxe Basic. You probably understand the details of PIC peripherals. But for anyone else, the complexity is HUGE (as you might expect with a 500-page datasheet) and to be avoided if possible.
 

nick12ab

Senior Member
There's the AQA/OCR pseudo-assembler commands which are only available for X1 parts and can be enabled by clicking the Advanced button in the Options dialog when an X1 part is selected. However it are still interpreted, it is not the same as real assembler and why would you waste a PICAXE by using assembly language?
 

manuka

Senior Member
Keep in mind that PICAXEs were intended to educate,enthuse & motivate. I've seen many newbies spend frustrating weeks trying to flash a LED in low level assembler,when they can easily master such tasks in minutes with hi level commands-AND be ready for more! Stan (10th year with the little darlings)
 

mrburnette

Senior Member
Allowing assembled routines to be embedded in a PICAXE would open the door to downloading the proprietary firmware.
<...>
manuka: Keep in mind that PICAXEs were intended to educate,enthuse & motivate.
REALLY! Using "proprietary" and "educate, enthuse & motivate" in the same post is awkward. I do not wish to debate the RevEd business model (I have argued that before) but the fact is that proprietary firmware creates a limitation upon the PICAXE use (which would otherwise only be a PIC.) Said limitation is both performance and usage oriented. This does not mean that PICAXE is bad, it is just designed to do only one thing - BASIC... and not an open dialect of that!

My weekend project was getting my UNO to talk HID over the USB port (iOS, Windows, Linux)... this means no drivers required since the OS's support HID keyboard plug & play. This effort required C, C++, and assembler and compiles and downloads to the UNO in one click. Sometimes, assembler is required.


- Ray
 

mrburnette

Senior Member
Though individual commands may be relatively slow, each Picaxe command represents a lot of processing inside the beast, so for some things you may find the difference isn't that great (and you can run some at 64MHz). Though I mostly use Picaxe I have a project ongoing using PIC C because it needs floating point (MPLABX, HITECH C). I find that I'm often re-implementing over days things that can be done in one statement in Picaxe Basic. You probably understand the details of PIC peripherals. But for anyone else, the complexity is HUGE (as you might expect with a 500-page datasheet) and to be avoided if possible.
Yep! Well said. It is the "if" that I find troublesome since IF sometimes happens.

- Ray
 

SD70M

Senior Member
..... but the fact is that proprietary firmware creates a limitation upon the PICAXE use (which would otherwise only be a PIC.) Said limitation is both performance and usage oriented. This does not mean that PICAXE is bad, it is just designed to do only one thing - BASIC... and not an open dialect of that!.....
PICAXE created an easy to understand working model.
This model can educate the youth of today how PICs work, in a basic way, so as not to tax their brains.
This way they don't get fed up with long periods of time programming in a language they don't understand.
This itself can cause loss of interest.
If they decide they like the possibilities that PICs make available, they can go on to learn the more complicated languages.

I fail to see the problem. Without the PICAXE system I'd never have picked up a PIC of any kind. I know I'm old, but if the same thing happened with the youngsters of today, and none continued as they'd already lost interest, we'd have no future of technology.

The proprietry onboard firmware has to remain that way otherwise others could use it and release their own versions. The same principle as Pepsi or Coke not releasing their proprietry recipe.

it is a STARTING POINT, not the be-all/end-all.

Angie
 

mrburnette

Senior Member
<...>

it is a STARTING POINT, not the be-all/end-all.

Angie

Did I say otherwise?

But, you give youth a restrictive model... almost a learning restriction. My experience is that Arduino C can be learned just as easily as BASIC. And (IMO) C is far more portable through school and college. Some people like Coke, some people like Pepsi, and others like myself buy the house blend from Audi which is less than 1/2 the price!

You state BASIC is "less complicated" by saying that youth (they) "can go on to learn the more complicated languages." If such reasoning was sound, then human speech would be composed of BASIC language and 'more complicated languages'; obviously, evolution has led to a child being taught the native language in incremental, more difficult vocabulary... not a different language. However, I concede that teaching any programming language to youth is better than teaching none at all... the development of logical thought is enhanced when a person converts thoughts to programming statements and then has the ability to "test" that logic... and often to back-up and address it again in a corrective fashion.

While I appreciate your stance, I do not think your response is focused. There is no problem, at least I do not see one in rereading my earlier post; however, I stand firmly on my statement, "Said limitation is both performance and usage oriented." And, I can back that statement up with personal experience working with open source and closed/proprietary systems. I can also back that up with working projects... Magic Morse required a 20X2 @ 64MHz to decode 28WPM of Morse Code. I have the ATmel C version running on a ATtiny85 at 16MHz decoding 60+WPM... the tiny85 cost $0.90. I'm even using the RC oscillator instead of a X-tal and it still performs admirably.

- Ray
 

nick12ab

Senior Member
But, you give youth a restrictive model... almost a learning restriction. My experience is that Arduino C can be learned just as easily as BASIC.
I'm not going to deny that PICAXE 'sucks' (that term summarizes what you've said) but BASIC is easier and if they see C, youths might just not even attempt programming, but if they are given steps to help them get there (flowcharts then BASIC) then they will be much more motivated to learn C.

and others like myself buy the house blend from Audi which is less than 1/2 the price!
From where?
 

boriz

Senior Member
An inline assembler would be the best! I've been plugging one for years. But unless it can be achieved without compromising the security of the proprietary firmware, it's not going to happen. Sad but true.

Still. No reason why you can't add a co-processor to your Picaxe project :)
 

SD70M

Senior Member
I'm not going to deny that PICAXE 'sucks' (that term summarizes what you've said)....
I don't think it does suck. NASA astronauts didn't begin with the shuttle, they started with aircraft. Baby steps.

.... but BASIC is easier and if they see C, youths might just not even attempt programming, but if they are given steps to help them get there (flowcharts then BASIC) then they will be much more motivated to learn C.
Exactly. I didn't start web development using ASP and integrated databases on secure hosts, I started with HTML, then JavaScript, then ASP. Now I speak all of them fluently. I don't need the WYSIWYG apps that are prevalent in the web development business sphere. I do know it's easier for me to find the errors, when they occur, than someone who uses those apps.

Angie
 

premelec

Senior Member
I think it's good for beginners to _look_ at simple assembly just to get an idea of what's going on in the chips - de-mystify it into a bunch of switches - however I don't think it's necessary for them to program in assembly! And they don't have to read Alan Turing's original manuscript but could be told of its 'simple' [!] conclusions. And I personally do better with a language closer to my native language in speech - and even then often forget the syntax which the machine will not forgive me! FORTH was fun and now my brain is decaying... whatever works for what you want to do...
 

mrburnette

Senior Member
I think it's good for beginners to _look_ at simple assembly just to get an idea of what's going on in the chips - de-mystify it into a bunch of switches - however I don't think it's necessary for them to program in assembly!
...
Remember those old MPU emulators with the LEDs and toggle switches? Set the data bits, set the address, push the button, watch the LEDs... ah, those were the days. Either you learned the basics or you would get calluses on your switch flipping finger!

- Ray
 

boriz

Senior Member
A parallel education in electronics and programming will meet at Machine Code, (ASM).*

Once you know one ASM language, all the others follow pretty easily.

ASM has a reputation of being hard. It's not!

It's a bit like English, French and German are the equivalent of BASIC, COBOL and FORTRAN. And ASM is the alphabet.

Learn the alphabet first, and everything else follows...





*Ok, parallel lines don't meet unless they exist on a +1 dimensional surface (which they actually do). Then they can meet, cross, go in spirals, whatever :)
 
Last edited:

inglewoodpete

Senior Member
REALLY! Using "proprietary" and "educate, enthuse & motivate" in the same post is awkward - Ray
"the same post"? I can't actually see what you seem to be reading, Ray. I didn't use anything like the term "educate, enthuse & motivate" and Stan's post doesn't show the word "proprietary". For clarification, I used the word "proprietary", meaning "Exclusively owned". I'm not a lawyer but it seems pretty clear to me.

... and mickelsen can come out from under his bed if he likes:). I wasn't intending to set the forum ablaze - only trying to explain the ins and outs of the firmware.
 

mrburnette

Senior Member
"the same post"? I can't actually see what you seem to be reading, Ray.
<...>
The dichotomy only appeared (to me) after reading the two posts (yours and Stan's) ... which were separated in the thread. Educate, as in Education, is a cradle for creativity... creating and sharing is an initiative that has materialized in many areas, but certainly institutions of higher learning: University OSI projects - many readers may not actually know that some significant software products are Open: 11-biggest-open-source-success-stories.html

I drew a contrast in the word "proprietary" in the exact context as you described, because like Ying & Yang, Proprietary and Open Source are night and day apart. In this context, 'proprietary' is akin to "secret"... like that CokeCola formula.

It's OK mickelsen... there are only a few land-mines in the forum, you stepped on one and Inglewoodpete really did not light the fire, I did.

BTW: where did the lawyers come from?

- Ray
 
Last edited:

nickwest

Member
Sorry for going off-topic... back in post #7 you mention doing some USB-HID stuff on an Arduino... do you have a link to that? This could be useful in so many ways!

OK, back to picaxes :)
 
Last edited:

mrburnette

Senior Member
Sorry for going off-topic... back in post #7 you mention doing some USB-HID stuff on an Arduino... do you have a link to that? This could be useful in so many ways!

OK, back to picaxes :)
(I'm responding in the forum rather than PM because I am aware that many members are broadly interested in microcontrollers, in general.)

For the off-topic response: vusb and
vusb-for-arduino and my test code
mrburnette (Yes, Ray Burne is my pseudonym used often on Instructables)

PM me with additional questions if you are thinking about dropping down to the commandline and compiling for the ATtiny85.
 
The problem I have is regarding WS2811/2 LED chains and the very fact that there is an outline Adafruit C++ program where, they can be utilised on an Arduino. But The Adafruit C++ dives into assembler for I/O bit manipulation where it also utilises 'NOP' null instructions timing things by expending cpu cycles.
IF, the Huge If, an effective driver for WS2811 LED chains could be produced, it would then open a door for 'Youngster programming' of colourful light displays.
Now my own confession: I am a grandfather where I have been tutoring my 7 year old grandson with Blocky. But he is intrigued by the WS2811 lights his father has programmed. So my own perfect solution would be a block of Pic Basic in a Blocky 'bubble' that may have to also dive into assembler.
Hopefully, there is an alternative and that would be to utilise an APA102 LED chain.
The other alternative would be to develope an IO 'Front End' for the WS2811/2 LED chain.
 

AllyCat

Senior Member
Hi,

Welcome to the forum. Unfortunately, PICaxe cannot run "real" (fast) assembler, only (some) Op-Codes converted to the (very slow) PICaxe Interpreted language. For the WS2811/2 the definitive answer is for example from @hippy HERE.

BTW, you can write a NOP as for example: b0 = b0 , but it will still run around 500 times slower than the native PIC instruction, and Basic bit manipilations are about 400 times slower. :(

Cheers, Alan.
 

erco

Senior Member
@OldTinkerer: Welcome and thanks for resurrecting this 9-year old thread! I had not seen it previously.

As others have said, it's "Horses for Courses". I do some teaching and Picaxe is IMO a great gateway to get people coding who might otherwise not. It's not set up to run assembler, but fortunately blank PICs are cheap & abundant, as is programming hardware for anyone who wants to go that route. Nice to hear you're getting your grandson involved early! My 12-year old daughter only recently became interested in BASIC programming and learning Morse code because they are featured in her favorite TV show: https://picaxeforum.co.uk/threads/stranger-things-lights.32554/
 

inglewoodpete

Senior Member
Now my own confession: I am a grandfather where I have been tutoring my 7 year old grandson with Blocky. But he is intrigued by the WS2811 lights his father has programmed. So my own perfect solution would be a block of Pic Basic in a Blocky 'bubble' that may have to also dive into assembler.
Hopefully, there is an alternative and that would be to utilise an APA102 LED chain.
The other alternative would be to develope an IO 'Front End' for the WS2811/2 LED chain.
The PICAXE is a great microcontroller for learning. Well done for encouraging your grandson to explore them.

PICAXEs CAN control chains of RGB LEDs BUT not the WS2811 or WS2812. Have a look at hippy's post from a couple of years ago, which lists a few alternatives that the PICAXE can control. The post links to another thread that gives more specific details. I have had success with PICAXEs and the WS2801 and APA102, which can be purchased in chains.
 
I am not familiar with the WS2801 BUT I ave found that the APA102 overcomes many of the problems. However in strings of 60 leds it tryes to cook the voltage regulator such that it it needs a significant heat sink. Even with that its only suitable for childrens use in short less than 10 LED lengths. But with some Blocky self contained sub tasks dropping back to lines of Picaxe Basic, I may have a solution for my Grandson.
I may now have a Plan, but my Grandson will undoubtedly ask " Please can we make it do like ?????".
 
Top