In: Computer Science
You have to write an ARM Assembly M4 program for SLTB004A Thunderboard Sense 2.
Write an assembly program that blinks the red LED to send out a SOS Morse code (... --- ...). The dot duration must be 1/4 second and the dash one - 1/2 sec. Duration between dots and dashes is 1/4 second. After displaying SOS the program must delay for 2 seconds and then loop back to blink out SOS again. Use LETIMER for generating all time intervals.
Write an assembly program that controls the brightness of the green RG LED on the demo board. Pressing the BUTTON0 should increase the LED brightness while pressing BUTTON1 should decrease it. Implement 32 grades of brightness. Initial LED duty cycle must be 50%. Use LETIMER for generating PWM and CRYOTIMER for buttons debouncing.
Write an assembly program that first asks the user to enter initial time string in format hh:mm:ss (military time hours:minutes:seconds, 2 digits for each with leading zeros, if needed and colons as separators). After this by pressing BUTTON0 the program should start countdown from this time down to 0 and display valid time. Every press of BUTTON1 should postpone the countdown which can be further continued by pressing BUTTON0 from the time it was stopped before. The program should update time and display it in TeraTerm console window (every time in a new line) with 1 second period. Use RTCC to generate 1-sec events. No button debouncing is required.
Design assembly program that takes two numbers from the user input: n and m with n < m. Then it sets RTCC_CNT register with n and RTCC_CC0_CCV register with m and starts the RTCC. Reaching the alarm moment must be indicated by turning on the red LED.
First of all downlod the ardiono IDE.
(IDE is a peripheral that communicates between the hardware and
the
software interface having a very user friendly User interface. It
has it's necessary command
arranged in a graphical way to make it easy and interesting for
beginners )
At the initial stage we have to blink a LED . so to program the board I used my ISP through ardiono IDE. I opend the blink code from file-->examples-->basics-->blink.
// constants wont change. They're used here to set pin umbers:
const int buttonPin = PA2; // the number of the pushbutton pin
const pin ledPin = PA7; // the number of the LED pin
// variables will change :
int buttonState = 0; // variable for reading the push button status vois setup(){
// initialize the led pin as an output :
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input :
pinmode(buttonPin,INPUT);
}
void loop(){
//read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. if it is, the buttonState is High :
if(buttonState == HIGH){
// turn LED on :
digitalWrite(ledpin,HIGH);
}
else{
//turn LED off;
Then I connected the ISP to my echo-hello board with the jumpper wires. and then I connected the ISP to my laptop.
After that I changed few configurations in ardiuno IDE.
following steps I did.:
1. Changed the baord to ATtiny 24/44/84
2. Processor I select ATtiny 44 becouse I have used that in my
board.
3. Clock I changed to 8 MHz.
4. I select the port where I was connected the ISP.
5. Then I selected programmer as USBtiny ISP
After that I clicked on burn bootloader and burned the bootloader.
and before clicking on verify I changed the and verified the code
and clicked on update.
Blink
Turns on LED on for one seconf, them off for one second , repeatedly.
Most Ardunios have an on-board LED you can control. On the UND, MEGA and ZERO it is attached to digital pin 13 l on MCR1000 on pin6. LED_BUILTIN is set to the correct LED pin independent of which board is used.
if you want to know what pin the on-board LED is connected to on your arduino model .
// the setup function runs once when you press reset or power the board
void setup(){
// initialize digital pin LED_BUILTIN as an output.
pinMode(z,OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite{
digitalWrite(z, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(z,LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
the LED started blinking all the way!!
After this I wanted to run a button code I went to File -> Examples -> Digital -> Button, becouse I wanted to run the button program.
This program is a connecting the button to the LED via micro controller.