Group assignment:

Compare the performance and development workflows for different microcontroller families

First of all, I decided to use the microcontroller Atmega328p and review the Data Sheet

Considerations When Using the ATmega328P

This product contains multiple 8-bit microcontrollers of different shapes, pin configurations, and sizes. Designers should be careful when choosing the proper microcontroller for their project since the members of the product line are not interchangeable. The ATmega328P has two variants of its own, one 5 mm square and the other 7 mm square.

Since memory on the ATmega328P is programmable, this introduces the capacity for software bugs with the potential to impact processor execution. For less experienced programmers or designers, this could make it difficult to distinguish between hardware and software bugs when testing a project.
The ATmega328P does not contain a C compiler, so programmers must choose their own. Some C compilers do not contain certain bit definitions in their header files. Without these bit definitions, C code for the registers and memory will not compile, even if the code is correct. Programmers should look in the documentation for their C compiler to determine whether these bit definitions are properly supported.
The size of the flash memory boot loader section is modifiable, and the ATmega328P allows code to be read from memory at the exact same time as new code is being written. Since the boot loader section can write to itself, it means it is possible for incorrect code to overwrite the ability for the chip to boot properly. Proper maintenance of this feature allows programmers to modify boot instructions dynamically, but this should only be done with a thorough understanding of how this parallel execution works. This read-while-write functionality is a form of parallel programming, even though it’s only on one chip. Information Link

Special ATmega328P Features

The ATmega328P has specialized features for power management: a brown-out mode and six different sleep modes. The brown-out detector (BOD) is not enabled by default, but when enabled, monitors the power consumption in sleep modes. Some sleep modes allow disabling of the BOD, which can save power, but this may also put other operations at risk if power is unexpectedly lost. While sleep mode is usually a simple idle, the sleep modes for the ATmega328P distinguish between idle, noise reduction, power down, power save, standby, and extended standby. Each of these states rely on different stimuli to know when the chip should wake up again.

All functions of the ATmega328P are optimized for speed, but depending on the type of programming or data writing being done, different operations are completed in different time periods. Assuming nothing impedes the writing operations, the ATmega328P can write or erase data within a time interval of 1.7 to 4.5 milliseconds. This range of time can either be helpful or a hindrance to programmers, depending on how they handle chip interrupts during the writing process. Programmers should not rely on all writes happening in the same amount of time. In addition, programmers should be aware of the many different potential interrupt sources in both the hardware and software of the ATmega328P. This gives fine-grained control over execution and writing but can be difficult to master without the datasheet.

The diiference between an analog pin consist in, analog reads all the values between 0V and 5V. A digital pin reads only 0V or 5V, it reads only the binary language.

    VCC: Digital supply voltage.

    GND: ground

    Port B: is an 8-bit bi-directional I/O

    Port C: is a 7-bit bi-directional I/O port

    PC6/RESET: If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin

    PortD: is an 8-bit bi-directional I/O

    AV: is the supply voltage pin for the A/D Converter

    AREF: AREF is the analog reference pin for the A/D Converter

    ADC: serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as - - 10-bit ADC channels

    Analog to digital converter: Is a pin for Inputs, it can be use for both analog and digital signals

    Instruction set summary: specify the number of clocks

    Electrical characteristics: Shows the minimum and maximum voltages and temperatures that the microcontroller use and support

Installing Attiny support on Arduino

I set Arduino to get comunication with thw board and PC. I follow this Tutorial

to install Attiny support on Arduino.

//Firs Try
					//972020
					#include 
					
					#include 
					
					// initialize the library with the numbers of the interface pins
					LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
					
					
					int sensorValue = 0;
					
					int outputValue = 0;
					
					int pos = 0;
					
					int estado_sensor = 0;
					
					Servo servo_9;
					
					void setup()
					{
					  pinMode(A0, INPUT);
					  pinMode(8, OUTPUT);
					  //Serial.begin(9600);
					  
					  
					  // set up the LCD's number of columns and rows:
					  lcd.begin(0, 2);
					  // Print a message to the LCD.
					  lcd.print("S1:");
					  
					  
					  //configure pin2 as an input and enable the internal pull-up resistor
					  pinMode(7, INPUT_PULLUP);
					  
					   servo_9.attach(10);
					
					}
					
					void loop()
					{
					  // read the analog in value:
					  sensorValue = analogRead(A0);
					  // map it to the range of the analog out:
					  outputValue = map(sensorValue, 0, 1023, 0, 255);
					  // change the analog out value:
					  analogWrite(8, outputValue);
					  // print the results to the serial monitor:
					  //Serial.print("sensor = ");
					  //Serial.print(sensorValue);
					  //Serial.print("\t output = ");
					  //Serial.println(outputValue);
					  // wait 2 milliseconds before the next loop for the
					  // analog-to-digital converter to settle after the
					  // last reading:
					  delay(2); // Wait for 2 millisecond(s)
					  
					  // Low: 0 - 402
					  // Medio: 403 - 510
					  // High: mayor o igual 511
					  
					  
					  if (sensorValue>=0 && sensorValue <=402)
					  {
						//estado_Sensor=1;
						lcd.setCursor(0, 1);
					  // print the number of seconds since reset:
					  lcd.print("L"); 
					  }
					 
					  if (sensorValue>=403 && sensorValue <=510)
					  {
						//estado_Sensor=1;
						lcd.setCursor(0, 1);
					  // print the number of seconds since reset:
					  lcd.print("M"); 
					  }
					  
					  if (sensorValue>=511)
					  {
						//estado_Sensor=1;
						lcd.setCursor(0, 1);
					  // print the number of seconds since reset:
					  lcd.print("H"); 
					  }
					  
					  // set the cursor to column 0, line 1
					  // (note: line 1 is the second row, since counting begins with 0):
					////  lcd.setCursor(0, 1);
					  // print the number of seconds since reset:
					///  lcd.print(sensorValue);
					  
					 // lcd.setCursor(6, 1);
					//  lcd.print(outputValue);
					  
					  
					   
					  
					  
					   //read the pushbutton value into a variable
					  int sensorVal = digitalRead(7);
					  //print out the value of the pushbutton
					 // Serial.println(sensorVal);
					
					  // Keep in mind the pullup means the pushbutton's
					  // logic is inverted. It goes HIGH when it's open,
					  // and LOW when it's pressed. Turn on pin 13 when the
					  // button's pressed, and off when it's not:
					  
					  servo_9.write(0);
					  
					  if (sensorVal == LOW) 
					  {
						//digitalWrite(13, LOW);
						servo_9.write(180);
						} 
					  
					  
					  } 
					
					
					

Conclusion

  • Designing the tracks on the computer it is necessary to take it easy, for me this was one of the biggest drawbacks in this process.
  • It is not necessary to be an expert in the use of digital tools, it is advisable to review the information of previous students who had similar problems.
  • To make the cut in the CNC milling machine the best option is to do a test before applying the cut, especially if you have never used this machine before.
  • After having several problems with programming I took the option of doing the programming in the Arduino simulator and this made the process much easier.

Files