For the average Arduino user, any form of ASM
so ,you tottaly oposite that user open costycnc tool , write sbi 5,5 compile upload and ledon , cbi 5,5 ledoff , almost one time in your life,or also with extern c?
nothing? nada?
You miss the point. I am writing the game in AVR ASM because I want to and, yes, in order to do it I need to understand PORTs, registers, addressing modes and the instructions to use them.
As it happens I have previously written the game in ASM for a simple processor (SC/MP), originally in the 1970s on real hardware and this year in a simulator that I wrote using an Arduino
I could write the game in C/C++ on the Arduino in a fraction of the time taken to learn enough AVR ASM to write it.
For me this is a challenge, but it is one that I have set myself. I am not doing it because I have to or because I cannot understand what functions like pinMode(13, INPUT_PULLUP); do behind the scenes.
You are right here, but at first, it sounded like you were saying that no Arduino IDE user should ever even try ASM!
So, when a user asks where the pull-up resistor disappears to when making a pin an output, is it better to explain it in ASM or in abstract C++?
link?
OK, so you are the hobbyist but how it can be your advantage. I do not know, if you are
aware, how your or anybody's knowledge is exposed to the truth on the internet.
The problem with that rigid, "forced" pedagogy is that it can turn Assembly into a lifelong trauma for students. When people hear the word "ASM," it can instantly trigger their defense mechanisms because they associate it with the dry, academic experience they struggled through in the past.
How can you even know?
Education is not easy for sure. Not from the student side, nor from the teacher side.
These are charlatan statements. You have no idea.
My approach is not that complex, academic ASM. I am not trying to filter people out or tell someone who struggles with abstract theory to "go focus on something else." My goal is to let everyone in.
In your topics, with more of 1000 posts each, we are frequently spinning in a circle. You are miles away from your goal now. I do not want you discourage you, I already indicated it before, but why not just admit you need help. You do not have capacity tutoring others, at least for now.
At this moment, I would expect you to have studied ATmega328P datasheet from the beginning to the end and backward, but it doesn't look so.
However, apparently you seem to be improving.
When I say "students," I mean anyone trying to learn...
Maybe the correct term would be "hobbyists" then.
Formal education requires...
You frequently wrote about formal education like it is something toxic.
For some beginners, it may even come before Arduino: first see the MCU directly, with almost no abstraction and no installation, and then move on to Arduino and higher-level programming.
Maybe, maybe not.
I understand and appreciate your effort.
Port pin manipulation is not the thing to study for weeks. Move on.
Inventions and educational tools don't need an institutional stamp to be useful.
Sometimes, it takes a carpenter to design a friendlier cabinet.
Sure, I agree.
However, you seem to me overconfident, pretty much.
I am sorry but I cannot make ans sense of what you are saying
"This is exactly my point. You know how hard it was to learn ASM for your specific purpose, to the extent that you wouldn’t even recommend a simple sbi 5,5 to anyone. But this is precisely the paradox I was talking about. Almost everyone discourages Assembly because, based on their own past experience, they struggled hard to grasp certain concepts. They assume that when I talk about learning ASM, I expect users to learn everything they had to suffer through.
But that is not what I am saying at all! I am only talking about opening a drawer and flipping a switch to light up a LED, and then letting them decide whether to move forward or not. If I asked a beginner to study the entire architecture of an MCU and every single ASM instruction, only to ask them after a year of forced study if they want to continue—yes, that would be unfair. But spending just one minute with sbi 5,5 and cbi 5,5, directly on the web with zero installation, to turn a LED on and off, and then ask him if he wants to continue... there is simply no comparison."
questo e punto , sai uanto difficile e stato imparare asm per il tuo scopo che non consiglierei a nessuno almeno sbi 5,5 ,ma questo e estamente paradosso di quale parlavo prima.quasi tutti non racomanda asm ,perche da loro esperienza hanno avuto fare fatica imparare alcuni concetti,come che io quando mi riferisco a asm dico che utenti dovrebbe imparare almenno quello che hanno imparato loro, e non dico uesto, dico solo chiudere un interurrore in un casetto per accedere led, e dopo sara loro a decidere di andare vanti o no . se chiedo a un novice di studiare tutta rchitectura di un mcu e tutti instruzioni asm , e dopo una anno di studio forzato demndarlo se vuole andare avnti , si ,e ingiusto , ma 1 minuto con sbi 5,5 e cbi 5,5 diretoo in web senza installare nulla acedrere spegnere il led e dopo demndare se va avanti ,non si compara
I am glad we are discussing things about ATmega, its internal behavior, ASM etc. Very interesting for me. It made me move my old rusty buttock so do not get me wrong.
Here are things i feel they need to be corrected.
Who are they? How many people you are talking about?
From this forum thread it does not seem like almost everyone. Not even close.
Again and again sbi, cbi commands. Next problem, please.
We spent much more time than one minute discussing about opening a drawer and flipping a switch... I do not see the progress.
If you just expect more visitors on your web, then your intentions are not so pure.
To be stubborn and claim that your ASM even without aliases is more figurative then Arduino commands, it is nonsense. It is just a lie.
Many of @costycnc's arguments fall into the category of pure gaslighting or straw man.
Let me be clear,
I am not saying that nobody would benefit by being introduced to ASM in order to appreciate what functions such as pinMode(13, INPUT_PULLUP); actually do. I accept that your toy assembler might be useful as part of that introduction.
What I am saying, and have been saying during the many topics in which this has been discussed, is that the number of new users who will benefit from being exposed to ASM if they can't understand pinMode(13, INPUT_PULLUP); is tiny. The function does exactly what it says, ie it sets pin 13 to INPUT and activated the internal PULLUP resistor.
In contrast, the sbi 0x04, 5 ASM command means "set bit in i/o register and its parameters have no obvious connection with a pin number printed on the board. In order to explain what is going on you introduce the concept of drawers and switches and explain that bit/switch 5 of port 0x04 is connected to pin 13 by means of some magic
Sorry, but the ASM explanation is more complicated than the original code and how far do you take it ? For instance, the pinMode() function is called in the setup() function. Do you explain how functions are used using your toy assembler and, if so, when do you stop ? for loops, while loops, if/else if/else, etc, etc
As a matter of interest, have there been many instances of you using your method of helping users stuck with the not understanding the C++ functions /
I am contributing in all your topics and I'm trying to be factual and as I already wrote many interesting things we discussed.
It can be written pinMode(LED_BUILTIN, INPUT_PULLUP).
You are absolute beginner, you see LED on UNO R3 or Nano (ATmega328P) board and that's it. You do not need know the number of the pin.
And you can start to dig deeper before you get bored.
Personally I think that using LED_BUILTIN can cause confusion although it is convenient to use as a starting point, but it has no obvious connection to pin 13
The problem comes when you want to use a different pin. My test system has 4 buttons permanently connected to pins A3, A2, A1 and A0, wired to be taken LOW when the button is pressed, and LEDs, with resistors, permanently connected to pins 3, 5, 6 and 9 that turn on when the pin goes HIGH. The LEDs and buttons are clearly marked with their pin numbers on the PCB
When my granddaughter asked what the electronic mess on my desk was I showed her how the LED on pin 3 could be turned on with a few commands then blinking it using delay() to turn it on and off.
When I asked her how we might blink the LED on pin 5 instead she got it straight away and made the required changes, but it was no surprise to me that she showed no interest in going further !
That is an unfortunate example. It is true for the Uno R3, but not for the Nano, which might add confusion for an absolute beginner.
It is true on the Uno R3 because it has an Opamp to drive the LED:
-- https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf
The Arduino Nano drives the LED directly off the pin, so it needs the pinMode(LED_BUILTIN,OUTPUT)
-- https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf
If you really dig down and learn the hardware, then the op-amp feature makes pin 13 of the board capable of working as a logic probe.
Yes, you are right.
This is syntactically correct, but it is semantically wrong which the C++ compiler is unable to detect. The "LED_BUILTIN" refers to an output device (the L) on UNO R3 board. So, the IO line that drives the L must have its direction as OUTPUT. However, I would accept gladly if you write pinMode(13, INPUT_PULLUP);.
This is a point to discuss and it's interesting. I wanted to try to explain some things with ASM in some posts, but the moderators prevented me from doing so. They said I can open threads with ASM, but never try to reply to any topic with ASM, and I comply with that! However, for me it would be an interesting challenge to explain some concepts with ASM as well, but we also have to take into account the fact that today almost no one uses the ATmega328 anymore, almost everyone is using an Uno R4 or ESP32.
Regarding this, we should actually thank the Arduino team for how they handle these contradictions. Balancing hardware abstraction is a massive job, and it is impossible to resolve every single edge case 100% perfectly.
We must remember that Arduino's primary goal is to make coding easy and accessible. Digging too deep into these semantic details—even if they are completely true—can easily confuse a novice who is already struggling.
However, if the moderators allow me the experiment of replying with ASM, I would definitely do it! And to be clear, I would do it natively using extern "C" to link the code, and not through my costycnc tool.
voglio dire a mostafa che per questo deve ringraziare team arduino come rizolve le contradizioni, e un lavoro pesante che mai non puo risolverla 100% , e che dobiamo che il scopo di team arduino e di fare il codice facile , e no cercare come me zappare in profondo con cose che anche se sono vere , puo "disturbare" il novice che ancora e confuso, ma se mi permettono moderatori un esperimento di rispondere con asm lo farei!

