






Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
Lenguaje de programación para microcontroladores
Tipo: Apuntes
1 / 10
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!







https://www.electronicdesign.com/technologies/embedded-revolution/whitepaper/ 21131371/micropython-for-embedded-systems MicroPython is a compact implementation of the popular Python programming language. The smaller counterpart can run on microcontrollers for embedded applications. Jason Moth MAY 14, 2020 Python is popular, interpretive programming language that's used in a variety of areas from controlling robots to running websites to handling artificial-intelligence and machine-learning chores. "MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments." We have collected our articles covering MicroPython for your reading pleasure. An Introduction to MicroPython and Microcontrollers How to Program Hardware with MicroPython
Microcontrollers don’t have to be programmed in C. MicroPython works just fine. Jason Moth MAY 14, 2020 There are currently around 600 programming languages to choose from, so picking the one that’s right for you can be pretty difficult. But if you’re looking for a language that’s incredibly popular, has a low barrier of entry, and can easily be integrated with a wide variety of other languages, then Python is arguably your best bet right now. Python is the second most in-demand programming language as of 2020, and it might even end up taking the crown from JavaScript one day in the near future. But while Python can be used for anything from web hosting and software development to business applications and everything in between, it can’t run on microcontrollers, which somewhat limits its capabilities. Luckily, an intrepid programmer took care of this little issue a few years back when he came up with MicroPython. Just as its name suggests, MicroPython is a compact version of the popular programming language that was designed to work hand-in- hand with microcontrollers. In this tutorial, we’re going to teach you everything you need to know about microcontrollers and discuss the benefits of using MicroPython over other boards. There’s quite a bit to unpack here, but before we jump into the nitty-gritty of things, let’s take a trip back in time and see where the idea behind MicroPython came from. MicroPython History and Overview The year is 2013. Damien George, an undergraduate at Cambridge University at the time, launches a Kickstarter
The PyBoard runs MicroPython on a STMicroelectronics STM32F405RG microcontroller based on a 186-MHz Arm Cortex-M4. The board is currently available in a few different versions, with prices generally ranging between $20 and $35, though some are a bit more expensive. If you’re not looking to invest in a microcontroller just yet, you can go to MicroPython Live to play around with a board for free in an online environment. MicroPython offers some very exciting possibilities for hardware-programming experts and beginners alike. That’s because, unlike regular Python, MicroPython can seamlessly integrate with circuits, buttons, sensors, LCD displays, and various other electronics. Not only that, but MicroPython requires far fewer resources and doesn’t have to rely on an operating system because MicroPython itself acts as the OS for the Pyboard or any other microcontroller. Essentially, all you need to set up a MicroPython project is compatible hardware and some coding skills. The latter may seem like a problem if you’re not a coder. But don’t worry, because MicroPython is an open-source project that’s supported by a very passionate and helpful community. If you have a specific project in mind, you can generally expect to be able to find code libraries and tutorials from developers that can help you bring it to life. Usually developers use services from providers such as Bluehost or AWS to host their open-source projects, so you will have access to them at any time. MicroPython may have started as a one-man effort, but nowadays the project is supported by a large community of programmers, hobbyists, and even major organizations like the European Space Agency, who helped fund Damien’s work. Physical Computing
Whereas regular Python is one of the best scripting languages for software programming, MicroPython is perfect for anyone interested in physical computing. The term physical computing can refer to lots of things when used in a broad sense, but as far as this tutorial is concerned, we’re primarily going to use it to describe the interactive systems and devices created with the help of MicroPython. Regardless of which hardware programming project you plan to tackle, you’ll need to take into account the following three main elements:
In many cases, microcontrollers work alongside a central computer. However, they can also be programmed to communicate only with other microcontrollers or to operate individually inside the same system. What are the Core Elements of a Microcontroller? As mentioned earlier, a microcontroller only has three core elements, so let’s take a closer look at each one of them: Central processing unit (CPU) The processor is the part of a computer that performs operations and executes instructions. It’s essentially the brain of a regular computer and the same concept applies to microcontrollers, too. Like any CPU, the microcontroller’s processor performs basic logic, arithmetic, and I/O operations, but can also perform data- transfer operations. These come in the form of instructions, which are communicated to other components that are part of a larger system. Memory The memory stores data received by the CPU via the microcontroller’s I/O ports. The memory comes equipped with a certain set of instructions that are used to respond to the information received from the processor. A microcontroller works with two types of memory, each of which performs a different function. Data memory stores information while instructions are being executed by the CPU. Meanwhile, program memory stores information related to the instructions themselves. Data memory is temporary and disappears once the microcontroller is no longer connected to a power source.
Program memory is non-volatile and remains on the device even after its power source has been removed. I/O Ports The input and output ports allow the microcontroller’s CPU to interface with the outside world. I/Os are used by the microcontroller to interact not just with human users, but also other information processing systems. The microcontroller’s CPU gathers data via its input ports and uses output ports to send instructions or signals externally. In addition to the three core elements detailed above, microcontrollers generally rely on other components that connect to the I/O ports. These components act as peripherals that create a bridge between the processor and various devices. A few examples include the system bus, digital-to-analog converters, analog-to-digital converters, and serial ports. Why Choose MicroPython Boards Over Other Microcontrollers? Microcontrollers have existed long before Damien George came up with the idea for MicroPython, so why not go with one of those instead? Well, there are plenty of good reasons, the most obvious of which has to be accessibility. Regular Python is known for being extremely friendly to newcomers, and the same can be said about MicroPython. If you want to learn the basics of hardware programming and start working on your own projects as soon as possible, MicroPython is for you. Another big advantage of MicroPython is that you can interact with it using the intuitive REPL (read-eval-print loop) environment. The REPL prompt allows you to quickly