This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Simulating a hex display timer

I am helping a student with his assignment.

80C517A Microcontroller.
U-Vision Keil compiler and d-scope debugger.

The first task is to simulate a microcontroller based "egg timer" with which the user inputs the required time in seconds (range 0 to 99) via an input port by simulating a two pin shaft encoder.

The time is then displayed using the serial window.

The second task is to implement the program on the target hardware. In this case the time should be displayed using the hex display board JK6.

These tasks are to make use of the on board timer and interrupt facility of the microcontroller.

If anyone can help with the following questions, it would be greatly appreciated as the student needs to understand this before Monday 14th May 2001.

Thanks.

Andrew Pearse
ABPC Ltd
+44 1845 524222

Questions

Q1. What is a two pin shaft encoder and how could it be simulated with U-vision? (ie what port would it connect to and what addresses would need to be read by the C program?)

Q2. Can the interrupt facility of the microcontroller be simulated and how, using a C program?

Q3. How can the on-board timer of the microcontroller be set-up and used, with a C program?

Q4. Is there any information about the JK6 hex display board? How does it connect to the microcontroller? How does the C program set the display values of the JK5?

END OF MESSAGE

Parents
  • Q1. What is a two pin shaft encoder and how could it be simulated with U-vision? (ie what port would it connect to and what addresses would need to be read by the C program?)

    You can implement debug functions that can send the simulated shaft encoder data to the microcontroller's port. The port to use is up to you, you just need to consider the internal port construction and pin functions to choose it, each port has it own address.

    Q2. Can the interrupt facility of the microcontroller be simulated and how, using a C program?

    You can simulate interrupts with the interrupt function parameter.

    void dunno ( void ) interrupt N

    Consult the manuals for more information.

    Q3. How can the on-board timer of the microcontroller be set-up and used, with a C program?

    You can apply the same method that you used to do using assembly. ( the same idea )
    TMOD = 0x??;
    and so on...

    Consult your 80517 user's manual for delails about Timer/Counter operation modes.



Reply
  • Q1. What is a two pin shaft encoder and how could it be simulated with U-vision? (ie what port would it connect to and what addresses would need to be read by the C program?)

    You can implement debug functions that can send the simulated shaft encoder data to the microcontroller's port. The port to use is up to you, you just need to consider the internal port construction and pin functions to choose it, each port has it own address.

    Q2. Can the interrupt facility of the microcontroller be simulated and how, using a C program?

    You can simulate interrupts with the interrupt function parameter.

    void dunno ( void ) interrupt N

    Consult the manuals for more information.

    Q3. How can the on-board timer of the microcontroller be set-up and used, with a C program?

    You can apply the same method that you used to do using assembly. ( the same idea )
    TMOD = 0x??;
    and so on...

    Consult your 80517 user's manual for delails about Timer/Counter operation modes.



Children
  • Thanks.

    As an example of implmenting a debug function, might you set up a button in the toolbox so that when clicked it sets a pin value of a port, thus simulating the output from the shaft encoder? Am I on the right track?

  • As an example of implmenting a debug function, might you set up a button in the toolbox so that when clicked it sets a pin value of a port, thus simulating the output from the shaft encoder? Am I on the right track?

    Yeah! You got it!

    You can start a whole process with this button for example...

    There's a Example with the uVision 2 called TRAFFIC that shows debug functions implementations...

    Folder:

    \examples\traffic\

  • Thanks for your help. Much appreciated.

  • You can simulate interrupts with the interrupt function parameter.

    void dunno ( void ) interrupt N


    Incorrect: the interrupt keyword specifies that the function is an interrupt service routine, and tells the compiler the interrupt number (N) so that it can "plant" the vector; it does not simulate an interrupt.

    In uVision2, you'd just click on the appropriate flag, or use a Debug Function.
    Software can trigger interrupts by setting the appropriate flag; eg,
    RI = 1;

  • Yeah,

    This parameter alocate a vector.. blá bla bla... correct!

    Try to simulate a ISR that read a encoder without an implementation of the ISR. ;-)

    After the implementation you can set the flag and see your ISR working.