Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Practical embedded system programming.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
9.24 Mб
Скачать

Practical embedded system programming

C/C++

Practice

Read and remember it

Circuitry

Important information

ARDUINO Sketch program

Fig. 1

How does it operates:

Please, before write C++ program codes on the strings of program and then verify it. If there are not red messages on the low black screen and on the green panel of program is the message "Done Compiling", the sketch was written without error [Fig. 2].

Fig. 2

Saving sketch INO-file:

When operation had been done the compilation completely, please, press on the button of program panel File\Save [Fig. 3]. Then include folder, rename on the "File name" and "Save" it [Fig.4] or save, pressing on the red button "Close" which is placed on up side right on the panel of program.

Fig. 3

Fig.4

Compilation INO-file to HEX-file or BIN-file:

When our sketch INO-file already is saved in the certain folder, for example, Arduino, we search and open this file. When our INO-file had been opened, we press on the button "Sketch" and then here press on "Export compiled Binary" and after completely compilation it exports two HEX-files [Fig.5].

Fig.5

Here always save two HEX-files eight analog input and boot-loader:

The "eight analog input" is for programming the programmable read-only memory (PROM); rather "boot-loader" is for flashing the flesh-memory.

By analog signals winking by the light-emitting diodes on the four pins.

/*

In this firmware can be activated address bus A0, A1, A2 and A3

This firmware operates with microcontrollers ATMEGA328P

A firmware can be debugged on the ARDUINO UNO R3

*/

void setup() {

// put your setup code here, to run once:

pinMode(14, OUTPUT); //

pinMode(15, OUTPUT); //

pinMode(16, OUTPUT); //

pinMode(17, OUTPUT); //

//

digitalWrite(14, HIGH); //set pullup on analog pin with address bus A0

digitalWrite(15, HIGH); //set pullup on analog pin with address bus A1

digitalWrite(16, HIGH); //set pullup on analog pin with address bus A2

digitalWrite(17, HIGH); //set pullup on analog pin with address bus A3

}

void loop() {

// put your main code here, to run repeatedly:

}

By analog signals, winking by the light-emitting diodes on the six pins.

/*

In this firmware can be activated address bus A0, A1, A2, A3, A4 and A5

This firmware operates with microcontrollers ATMEGA328P

A firmware can be debugged on the ARDUINO UNO R3

*/

Void setup() {

// put your setup code here, to run once:

pinMode(14, OUTPUT); //

pinMode(15, OUTPUT); //

pinMode(16, OUTPUT); //

pinMode(17, OUTPUT); //

pinMode(18, OUTPUT); //

pinMode(19, OUTPUT); //

//

digitalWrite(14, HIGH); //set pullup on analog pin with address bus A0

digitalWrite(15, HIGH); //set pullup on analog pin with address bus A1

digitalWrite(16, HIGH); //set pullup on analog pin with address bus A2

digitalWrite(17, HIGH); //set pullup on analog pin with address bus A3

digitalWrite(18, HIGH); //set pullup on analog pin with address bus A4

digitalWrite(19, HIGH); //set pullup on analog pin with address bus A5

}

void loop() {

// put your main code here, to run repeatedly:

}

/*

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]