PRACTICE PROBLEMS

(Note: Problem solutions are available at http://sites.google.com/site/automatedmanufacturingsystems/)

1. Describe what the bits would be when an A (ASCII 65) is transmitted in an RS-232 interface with 8 data bits, even parity and 1 stop bit.

2. Divide the string in ’str_a’ by the string in ’str_b’ and store the results in ’str_c’. Check for a divide by zero error.

3. How long would it take to transmit an ASCII file over a serial line with 8 data bits, no parity, 1 stop bit? What if the data were 7 bits long?

4. Write a number guessing program that will allow a user to enter a number on a terminal that transmits it to a PLC where it is compared to a value in target. If the guess is above "Hi" will be returned. If below "Lo" will be returned. When it matches "ON" will be returned.

5. Write a structured text program that reads inputs from ‘channel 0’. An input string of ‘CLEAR’ will clear a storage array. Up to 100 real values with the format ‘XXX.XX’ will arrive on ‘channel 0’ and are to be stored in the array. If the string ‘AVG’ is received, the average of the array contents will be calculated and written out ‘Channel 0’.