EMBEDDED PROGRAMMING

The goal of this week is to read the data sheet of a microcontroller; using different programming languages. And also different devices for programming (AVRISP2, ASPUSB 2.0, ubstinyISP)

1. Group Assignment

compare the performance and development workflows for other architectures.

1.1 INTRODUCTION

A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.Sometimes referred to as an embedded controller or microcontroller unit (MCU), microcontrollers are found in vehicles, robots, office machines, medical devices, mobile radio transceivers, vending machines and home appliances among other devices.

_

1.1.1 Microcontroller features

A microcontroller's processor will vary by application. Options range from the simple 4-bit, 8-bit or 16-bit processors to more complex 32-bit or 64-bit processors. In terms of memory, microcontrollers can use random access memory (RAM), flash memory, EPROM or EEPROM.

Microcontroller architecture can be based on the Harvard architecture or von Neumann architecture, both offering different methods of exchanging data between the processor and memory. With a Harvard architecture, the data bus and instruction are separate, allowing for simultaneous transfers. With a Von Neumann architecture, one bus is used for both data and instructions.

1.1.2 Intruction set of Microcontroller

Microcontroller processors can be based on complex instruction set computing (CISC) or reduced instruction set computing (RISC). CISC generally has around 80 instructions while RISC has about 30, as well as more addressing modes, 12-24 compared to RISC's 3-5. While CISC can be easier to implement and has more efficient memory use, it can have performance degradation due to the higher number of clock cycles needed to execute instructions. RISC, which places more emphasis on software, often provides better performance than CISC processors, which place more emphasis on hardware, due to its simplified instruction set and, therefore, increased design simplicity, but because of the emphasis it places on software, software can be more complex. Which ISC is used varies depending on application.When they first became available, microcontrollers solely used assembly language. Today, the C programming language is a popular option.

1.1.3 Types of microcontrollers

Common MCUs include the Intel MCS-51, often referred to as an 8051 microcontroller, which was first developed in 1985; the AVR microcontroller developed by Atmel in 1996; the programmable interface controller (PIC) from Microchip Technology; and various licensed ARM microcontrollers. A number of companies manufacture and sell microcontrollers, including NXP Semiconductor, Renesas Electronics, Silicon Labs and Texas Instruments.

1.2 ATtiny25 / ATtiny45 / ATtiny85

ATtiny (also known as TinyAVR) are a subfamily of the popular 8-bit AVR microcontrollers, which typically has fewer features, fewer I/O pins, and less memory than other AVR series chips. The first members of this family were release in 1999 by Atmel.Check " Data sheet"

_

For this assignment we use the Attiny45, circuit developed in week 7, where we add an LED and a button to the Echo Hello-World board and to test it (Blinking - On / Off button

2. Individual Assignment

Read a microcontroller data sheet program your board to do something, with as many different programming languages and programming environments as possible

2.1 PROGRAMMING OF MICROCOTROlLER
2.1.1 AVR-C

To program in the AVR-C language, you must verify the output pins of the microcontroller.

  • VCC: supply voltage
  • GND: ground
  • PORT B: 4-bit I / O port - internal pull-up resistors - Digital inputs and outputs.
  • PORT A: 8-bit I / O port - internal pull-up resistors - analog to digital converter (ADC)
  • RESET: restart the program

To start programming the microcontrollers, I took the examples provided by the FabAcademy.

This example will be used to program the microcontrollers. This program controls the speed of LED on and off; increasing or decreasing to check if our program was recorded in the microcontroller.

1. Header: These are library files that help us to code.

2. It is the entry point and the main function that is compiled and that you can write what you want.

3. these are the entry or exit records that will be used in the microcontroller.

4. A cyclic structure, which allows us to execute one or several lines of code in a repetitive way without having to have an initial value.

5. It is the task of the microcontroller.

6. This is to indicate the return value of a function..

  • "hello.c"
  • "makefile"

    _

  • 2.1.2 Aduino C++

    To program in arduino, we must first download the software (HERE). Then you must be careful with the pins. Arduino uses another designation for the pins.

    _

    2.2 ENVIROMENTS

    To be able to burn the microcontroller, an interface is needed. This could be:

    AVRISP

    _

    USBTiny44

    This is a device developed by a student of the 2016 fabacademy. It serves as an interface to burn other microcontrollers.

    _

    ASP USB V2.0

    USBasp V2.0 es un programador en circuito USB para los microcontroladores de las series ATMEGA, ATTINY, AT90, AT90CAN y AT90PWM.

    2.2.1 Programming through the terminal
    • You must have the files you want to burn inside a folder (hello.c and makefile).
    • Then you must clean the previously compiled files (if they were).
    • Then compile the new hex. Files are generated from hex
    • Then enter the code (avrdude -F -P usb -c usbtiny -p attiny45 -U flash: w: hello.hex) to pass the compiled files from the pc to the microcontroller, this through an interface (usbtiny)
    • -c usbtiny: -c your_programmer.
    • -p attiny45: -p your_mcu.
    • U flash:w:hello.hex: -U flash:w:your_file_name.hex

    programing from Ivan Callupe on Vimeo.

    SELF EVALUATION

    WHAT WORKED:
    WHAT DID NOT WORK:
    THINGS TO IMPROVE:

    If you want to review the previous topics, click on the following icons.

    WEEK 8 WEEK 10

    Contact Me

    Feel free to contact me via email or phone.

    Address

    Ate - Lima, PerĂº

    Phone Number

    +51 945 065 478