IFI Loader - Advanced Console Debugging getch()

With the IFI Terminal/Console window it is possible to read output from the robot. Is there anyway to accept keyboard input and display specific debugging output?

For example, I would like to construct the following menu:

Key Debug Info
J - Joystick Ports
R - Relays
D - Digital I/O
A - Analog

then have a one-shot debug screen displayed and then wait for the next key. Trying squeeze everything into one printf("") and make sense out of it is tough.

Thanks!
Team #1711
Teaser Pics of our Week #3 Prototype

all you need to do read from the serial port, ifi terminal can send characters
look at kevin watsons camera code from 07 for a terminal example

kevin.org/frc

Kevin did this in the terminal window for the camera menu settings. Look in Kevin.org’s 2007 programs. The bells-and-whistles version, not the streamlined one. I tracked it down to this line:

terminal_char = Read_Terminal_Serial_Port();

But a quick search I couldn’t find the Read_Terminal_Serial_Port function, but I didn’t dig too deeply.

Be forwarned, his code there is readable but there is lots of it. Duplicating it successfully isn’t for the light-hearted.

Kevin also suggests TeraTerm, another terminal emulator (it’s under miscellanea). I’ve never tried it, but if he suggests it it is probably better than the current terminal window.

(And on preview, someone snuck ahead of me again! Darn these slow fingers! But great minds think alike.)

Thanks… I found the code. Just 9-easy steps to an interactive terminal window.

[INDENT]Nine things must be done before this software will work
correctly:

1a) FRC-RC: As this software is intended to replace IFI’s
serial port driver, the call to Serial_Driver_Initialize()
in user_routines.c / User_Initialization() should be
removed or commented out. In addition, all references to
“user_Serialdrv.c” and “user_Serialdrv.h” must be removed
from the project and all project source files.

1b) EDU-RC: As this software is intended to replace IFI’s
serial port driver, the call to Initialize_Serial_Comms()
in user_routines.c / User_Initialization() should be
removed or commented out. In addition, all references to
“printf_lib.c” and “printf_lib.h” must be removed from
the project and all project source files.

  1. You must add the serial_ports.c/.h source files to
    your MPLAB project.

  2. A #include statement for the serial_ports.h header
    file must be included at the beginning of each source
    file that uses the serial ports. The statement should
    look like this: #include “serial_ports.h”.

  3. If you intend to use the C18 output stream functions,
    a #include statement for the stdio.h header file must be
    included at the beginning of each source file that calls
    any of these functions. The statement should look like
    this: #include <serial_ports.h>.

  4. Init_Serial_Port_One() and/or Init_Serial_Port_Two()
    must be called from the User_Initialization() function
    located in the user_routines.c source file.

  5. The interrupt handler(s) must be installed in the
    InterruptHandlerLow() function located in the
    user_routines_fast.c source file. See the accompanying
    copy of user_routines_fast.c to see how this is done.

  6. Decide what functionality you need and comment out the
    #define ENABLE_SERIAL_PORT_xxx_yy entries in serial_ports.h
    as necessary. As an example, if you only need to send data
    using serial port one and would like to reclaim the resources
    used by serial port two and serial port one’s receiver
    source code, the top of the serial_ports.h file would look
    like this:

// comment out the next line to disable all serial port one
// receive functionality
// #define ENABLE_SERIAL_PORT_ONE_RX

// comment out the next line to disable all serial port one
// transmit functionality
#define ENABLE_SERIAL_PORT_ONE_TX

// comment out the next line to disable all serial port two
// receive functionality
// #define ENABLE_SERIAL_PORT_TWO_RX

// comment out the next line to disable all serial port two
// transmit functionality
// #define ENABLE_SERIAL_PORT_TWO_TX

By default, both serial ports and their respective receive
and transmit sections are enabled.

  1. As the default output device for C18’s output stream
    functions is the null device, you’ll presumably want to
    change the value of stdout_serial_port to “SERIAL_PORT_ONE”
    or “SERIAL_PORT_TWO” if you want to see printf()'s output.
    User_Initialization() is a good place to do this.

  2. To support terminal emulation software,
    should
    be used instead of just
    in the printf() format string.
    [/INDENT]