<<Previous |
DEBUGIN
{Timeout,Label,}[Item{,Item...}]DEBUGIN
Receive one or more
Items from a predefined pin at a predefined baud rate in standard asynchronous format using 8 data bits, no parity and 1 stop bit (8N1). The pin is automatically made an input.An optional Timeout and Label may be included to allow the program to continue if a character is not received within a certain amount of time. Timeout is specified in 1 millisecond units. If the serial input pin stays idle during the Timeout time, the program will exit the DEBUGIN command and jump to Label.
DEBUGIN
(on all devices except the 12-bit core) supports the same data modifiers as SERIN2. Refer to the section on SERIN2 for this information.
Modifier |
Operation |
BIN{1..16} |
Receive binary digits |
DEC{1..5} |
Receive decimal digits |
HEX{1..4} |
Receive hexadecimal digits |
SKIP n |
Skip n received characters |
STR ArrayVar\n{\c} |
Receive string of n characters optionally ended in character c |
WAIT ( ) |
Wait for sequence of characters |
WAITSTR ArrayVar{\n} |
Wait for character string |
DEBUGIN
is one of several built-in asynchronous serial functions. It is the smallest of the software generated serial routines. It can be used to receive debugging information from a terminal program like Hyperterm. It can also be used anytime serial input is desired on a fixed pin at a fixed baud rate.The serial pin and baud rate are specified using
DEFINEs' Set Debugin pin port DEFINE DEBUGIN_REG PORTB ' Set Debugin pin bit DEFINE DEBUGIN_BIT 0 ' Set Debugin baud rate (same as Debug baud) DEFINE DEBUG_BAUD 2400 ' Set Debugin mode: 0 = true, 1 = inverted DEFINE DEBUGIN_MODE 1
If any of these
DEFINEs are not included in a program, the DEBUGIN port, pin or mode is set to the same values as they are for DEBUG. The DEBUGIN baud rate is always the same as DEBUG=s. It cannot be DEFINEd differently.DEBUGIN
assumes a 4MHz oscillator when generating its bit timing. To maintain the proper baud rate timing with other oscillator values, be sure to DEFINE the OSC setting to any different oscillator value.While single-chip RS-232 level converters are common and inexpensive, thanks to current RS-232 implementation and the excellent I/O specifications of the PICmicro, most applications don't require level converters. Rather, inverted TTL (
DEBUGIN_MODE = 1) can be used. A current limiting resistor is necessary to dissipate the higher and sometimes negative RS-232 voltage.' Wait until the character “A” is received serially and put next character into B0 DEBUGIN [wait (“A”),B0] ' Skip 2 chars and grab a 4 digit decimal number DEBUGIN [skip 2,dec4 B0]
DISABLE
DISABLE
both debug and interrupt processing following this instruction. Interrupts can still occur but the BASIC interrupt handler in the PICBASIC PRO™ program and the debug monitor will not be executed until an ENABLE is encountered.DISABLE
and ENABLE are more like pseudo-ops in that they give the compiler directions, rather than actually generate code. See ON DEBUG and ON INTERRUPT for more information.DISABLE ' Disable interrupts in handler myint: led = 1 ' Turn on LED when interrupted Resume ' Return to main program Enable ' Enable interrupts after handler
DISABLE DEBUG
DISABLE DEBUG
processing following this instruction. The debug monitor will not be called between instructions until an ENABLE or ENABLE DEBUG is encountered.DISABLE DEBUG
and ENABLE DEBUG are more like pseudo-ops in that they give the compiler directions, rather than actually generate code. See ON DEBUG for more information.> Disable debug monitor callsDISABLE DEBUG
DISABLE INTERRUPT
DISABLE INTERRUPT
processing following this instruction. Interrupts can still occur but the BASIC interrupt handler in the PICBASIC PRO™ program will not be executed until an ENABLE or ENABLE INTERRUPT is encountered.DISABLE INTERRUPT
and ENABLE INTERRUPT are more like pseudo-ops in that they give the compiler directions, rather than actually generate code. See ON INTERRUPT for more information.DISABLE INTERRUPT ' Disable interrupts in handler myint: led = 1 ' Turn on LED when interrupted Resume ' Return to main program Enable Interrupt ' Enable interrupts after handler
<<Previous |