Home » Open USB IO Hardware State machine

Open USB IO Hardware State machine

C++ programming for atmega32

SPECIFICATIONS: OVERVIEW

KEY SPECIFICATIONS
Your code should:

The first thing your code should do is: Read the current status of the LEDs at portb.
Then increment the value read from portb by the increment number found
in the second argument of the console command line i.e. argv[1].
The number to increment should be specified on the command line and can be positive
or negative.
Eg.: lab3_s312345.exe 13
In the example above the increment value is ’13’.
The program should then exit with code zero (‘0′), unless a valid third command line agument is present.

If a valid third command line argument is found then the increment operation is performed
for the number of times indicated by the value of the third command line argument i.e. argv[2].
Example:
Eg.: lab3_s312345.exe 13 3
In the example above the increment value is ’13’ and the number of times to increment is ‘3’
The program should then exit with code zero (‘0’).

Note:
Eg.: lab3_s312345.exe -13 1
In the example above the increment value is ‘-13’ and the number of times to increment is once ‘1’
This is effectively the same as:
Eg.: lab3_s312345.exe -13
In other words: the number of increment repetitions is assumed to be one unless stated otherwise by
the third command line argmument.

FOR EACH INDIVIDUAL INCREMENT OPERATION: “Wrapping around”
If after addition of the increment value the value calculated for portb is greater than 255,
then the modulus of 256 is to be written to portb.
Eg.: 256 modulus 256 is 0
513 modulus 256 is 1

If AFTER addition of the increment value the value calculated for portb is less than zero
then 256 is to be added to the calculated value and this new value written to portb
Example: if the increment value is -10 and the current value of portb is 8
then the result after addition the calculated value is -2.
Therefore -2 plus 256 gives 254 which the new value to write to portb.
This is also sometimes referred to as ‘wrapping around’.

——————————

Your code should run continuously until ESCAPE is pressed or the specified number of
successful read and increment cycles of the USB-IO board have taken place.

OUTPUT FORMATS: AS FOR A COMMAND SHELL WINDOW.

The Open USB IO board outputs commands sent to it in a default format.
You will be required to change the default settting.
example: if the command given is: “ousb.exe io portb 128”
The DEFAULT response from the OUSB board is: PORTB = 128 this is NOT what you should produce.
Repeat: this is NOT what you should produce.
Your code should display ONLY the numbers 128
The method of how to make the OUSB board respond with just the number as output
can easily be found out by:
1) opening a command window in Windows: START -> RUN -> “cmd”
2) typing ‘ousb’ on the command line. This will bring up a help menu
3) see the option for ‘raw (decimal)’ output.

If you use _popen and a file pipeline do not add EXTRA linefeeds, do not add extra blank
spaces or any other characters. Output must be as it would be for a standard command line
window.

The only text in the command shell window should be:
– text returned from the OUSB board in response to your code or an error condition
– NO debug code should appear in the command shell window. This means: any of your
debug comments must be turned off for the final submitted copy.
EXAMPLES

Assuming that the Open USB board portb LED’s display 11 in binary then:
The command line “lab3_s312345.exe 1 3” should produce the values
12
13
14
i.e. increment of one, three times.

Assuming that the Open USB board portb LED’s display 100 in binary then:
The command line “lab3_s312345.exe -2 4” should produce the values
98
96
94
92
i.e. decrement of two, four times.

Assuming that the Open USB board portb LED’s display 252 in binary then:
The command line “lab3_s312345.exe 3 3” should produce the values
255
2
5
make sure you understand how this is derived. See the section on “wrapping around”.

Assuming that the Open USB board portb LED’s display 13 in binary then:
The command line “lab3_s312345.exe -10 3” should produce the values
3
249
239
make sure you understand how this is derived. See the section on “wrapping around”.

Access to the Open USB io board is via the executable binary file: ousb.exe .
In particular note the different responses ousb.exe gives to
ousb.exe -r io portb 1
ousb.exe io portb 1
For this laboratory you are required to only use: ousb.exe -r io portb
without the other possible modes of: -h -b

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more