Open USB IO Hardware State machine custom essay

[meteor_slideshow slideshow=”fe1″]

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

[meteor_slideshow slideshow=”fe2″]

Focusessays.com has been offering academic support services to students since 2002 and more than 60% of our customers are return clients. We have skilled and experienced writers in all academic levels and subjects. Entrust us with your assignment and you will get a custom essay which is 100% original within its deadline. Get value for your money, confidentiality is guaranteed and customer support services/communication with your writer are available 24/7. Place your Order Now.

Focus Essays has been there for more than 10 years to offer students like you academic writing services.

Get our experience by placing an order with us and use the discount code PAPER15 to get 15% discount on all orders.

We deliver URGENT ORDERS within 6 hours. Get a quotation from the calculator below.

TRY OUR SERVICES TODAY.

[order_calculator]