Question: Write a C program to do the followings: You program should define three arrays such that Array1 has eight values: $01, $02, $03, $04, $05,
Write a C program to do the followings:
You program should define three arrays such that Array1 has eight values: $01, $02, $03, $04, $05, $06, $07, $08 and Array2 has eight values: $11, $12, $13, $14, $15, $16, $17, $18, and Array3 has eight bytes reserved. The program reads DIP switches, then, does the followings:
If the readings are exactly %00001001 = $09, then, it will turn on LED3 and LED0, and copy the data from Array1 to Array3; after copying data, your program is done.
If the readings are exactly %10010000 = $90, then, it will turn on LED7 and LED4, and copy the data from Array2 to Array3; after copying data, your program is done.
If the readings are neither $09 nor $90, then, turn on all LEDs, and go back to read DIP switches repeatedly until one of the two correct readings above is available.
Requirements:
Your program must use loop so that your program can be easily modified to work for arrays with 30, 50 or even more elements instead of just 8 elements as they are now.
It is preferred but not required that a single function does the data transfer (or data copying) for both cases.
Note: The DIP switches on Dragon12-light boards are numbered 12345678 for bits 76543210.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
