Page 270 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 270

PROBLEMS                                                            247


        void getV3{char *s, char *v), void getV4(char *s, char *v), void
        getV5(char *s, *v), void putVl(char *s, char *v), void putV2(char *s,
        char *v), void putV3(char *s, char *v), void putV4(char *s, char *v),
        void putvs (char *s, *v), in which get... will copy the element from the struct
        to the vector and put... will copy the vector into the struct; e.g., getV2(s, v)
        copies element V2 into v, and putvs (s, v) copies v into element V5.


        7. Write a shortest C procedure void main() and procedures it calls, without any
        assembly language, which will first input up to 32 characters from the keyboard to the
        6812 (using getchar () ) and will then jump to one of the procedures, given below,
        whose name is typed in (the names can be entered in either upper or lower case, or a
        combination of both, but a space is represented as an underbar). The procedures: void
        start(), void step_up(), void step_dovm(), void recalibrate(), and void
        shut_down(), just type out a message; for instance, start ( ) will type out "Start
        Entered" on the host monitor. The main ( ) procedure should generate the least number
        of bytes of object code possible and should ran on the host. Although you do not have to
        use a compiler and target machine to answer this problem, you can use it without
        penalty, and it may help you get error-free results faster.

        8. Suppose a string such as "SEE THE MEAT," "MEET A MAN," or "THESE NEAT
        TEAS MEET MATES" is stored in char string[40];. Using one dimensional
        vector rather than linked list data structures to store the coding/decoding information:
































                     a. Chain                     b. Uniform Tree
                              Figure 8.5. Other Huffman Codes
   265   266   267   268   269   270   271   272   273   274   275