- •Practical embedded system programming
- •Void setup() {
- •In this firmware can be activated address bus a0, a1, a2 and a3
- •Void setup() {
- •Void setup() {
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup() {
- •Void setup()
- •Void setup(){
- •Void setup(){
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup() {
- •Void setup() {
- •Void setup(){
- •Void setup() {
- •Void setup() {
- •Void setup()
- •Void setup()
- •Void setup() {
- •Void setup() {
- •Void setup() {
- •Void setup() {
- •Void setup()
- •Void setup()
- •Void setup()
- •Void setup() {
- •Void setup() {
- •Void setup() {
- •Void setup() {
- •Void setup() {
- •Void setup() {
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(A0, OUTPUT); //
pinMode(A1, OUTPUT); //
pinMode(A2, OUTPUT); //
pinMode(A3, OUTPUT); //
pinMode(A4, OUTPUT); //
//
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(A0, HIGH); //set pullup on analog pin with address bus A0
delay(50); //
digitalWrite(A0, LOW); //set pullup on analog pin with address bus A0
delay(90); //
digitalWrite(A1, HIGH); //set pullup on analog pin with address bus A1
delay(60); //
digitalWrite(A1, LOW); //set pullup on analog pin with address bus A1
delay(80); //
digitalWrite(A2, HIGH); //set pullup on analog pin with address bus A2
delay(70); //
digitalWrite(A2, LOW); //set pullup on analog pin with address bus A2
delay(70); //
digitalWrite(A3, HIGH); //set pullup on analog pin with address bus A3
delay(80); //
digitalWrite(A3, LOW); //set pullup on analog pin with address bus A3
delay(60); //
digitalWrite(A4, HIGH); //set pullup on analog pin with address bus A0
delay(90); //
digitalWrite(A4, LOW); //set pullup on analog pin with address bus A0
delay(50); //
}
Melodic five light-emitting diodes
/*
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 NANO or UNO R3
*/
Void setup() {
Serial.begin(9600); //
Serial.available(); //
// put your setup code here, to run once:
pinMode(A0, OUTPUT); //
pinMode(A1, OUTPUT); //
pinMode(A2, OUTPUT); //
pinMode(A3, OUTPUT); //
pinMode(A4, OUTPUT); //
pinMode(A5, OUTPUT); //
//
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(A0, HIGH); //set pullup on analog pin with address bus A0
tone(A5, 1000); //
delay(50); //
digitalWrite(A0, LOW); //set pullup on analog pin with address bus A0
tone(A5, 900); //
delay(90); //
digitalWrite(A1, HIGH); //set pullup on analog pin with address bus A1
tone(A5, 900); //
delay(60); //
digitalWrite(A1, LOW); //set pullup on analog pin with address bus A1
tone(A5, 800); //
delay(80); //
digitalWrite(A2, HIGH); //set pullup on analog pin with address bus A2
tone(A5, 700); //
delay(70); //
digitalWrite(A2, LOW); //set pullup on analog pin with address bus A2
tone(A5, 600); //
delay(70); //
digitalWrite(A3, HIGH); //set pullup on analog pin with address bus A3
tone(A5, 500); //
delay(80); //
digitalWrite(A3, LOW); //set pullup on analog pin with address bus A3
tone(A5, 400); //
delay(60); //
digitalWrite(A4, HIGH); //set pullup on analog pin with address bus A0
tone(A5, 300); //
delay(90); //
digitalWrite(A4, LOW); //set pullup on analog pin with address bus A0
tone(A5, 200); //
delay(50); //
}
Programming shift registers:
As you can see from the schematic, we are picking up +5V and a Ground connection at the Arduino board, Digital IO pins 2,3,4 are being used for the Data, Latch and the Clock. The Shift Register also requires a couple of links to pull the Reset High and the Enable Low to make these examples work. You could, of course, control these pins using the Arduino, but for these simple examples, there is no requirement to do this. A more complex project might want to take full control of the IC, but that would be up to the circuit developer.
For the coding, we will use the started Arduino IDE available for the Arduino Homepage[^].
This project's code is no different from any other Arduino project and follows the same Initialisation, Setup and Loop Structure. There are no special libraries required to be included or initialised within the code, and standard methods are all that is required to make this work. The basic structure is as follows:
int dataPin = 2; //Define which pins will be used for the Shift Register control
int latchPin = 3;
int clockPin = 4;
//Add any other variables used by the main program loop here
