SBC In-System Programming: Information | VisISP-52 ISP Application
SBCMON Monitor/Operating System: Main Page | Manual
SBCMON-based Software: SBCMON Monitor | Keypad Demo | LCD Echo Demo | Hardware Clock | Software Clock
SBCMON-based PS/2 Software: PS/2 Comm Monitor | PS/2 Keyboard | PS/2 Mouse
ORDER 8052.com SBC: PCB, KIT OR BUILT SBC AVAILABLE FOR PURCHASE
Powering up SBCMON
When power is applied to the SBC loaded with SBCMON, the yellow LED (D6) will flash on and off three times. This serves two purposes:
- It confirms that the SBCMON program is loaded correctly on the SBC and that the SBC is executing the monitor. This is useful since if there doesn't seem to be any communication between the PC and SBCMON, the flashing yellow LED will confirm that SBCMON is, in fact, executing. If the yellow LED flashes when the SBC is powered-up but nothing appears in the PC terminal program, the problem is almost certainly something to do with communications—either the wrong type of cable or the PC's terminal configuration is incorrect.
- It provides a delay of approximately 600 milliseconds. This is useful because the Atmel AT89S8252 has a published errata which indicates that problems may occur if a program accesses the SPI pins (P1.5, P1.6, and P1.7) during the first 500 milliseconds following an ISP process. The 600ms delay eliminates any possibility that these pins will be manipulated within this period.
Once power has been applied and the yellow LED has flashed on and off three times, SBCMON will send the message:
SBCMON v1.3.0 Initialized. (Detected 32k of XRAM at 8000h)
This informs the user that the SBC has powered-up or has been reset. It also indicates whether or not SBCMON found XRAM that can be used to load programs. The monitor then enters the main menu mode.
SBCMON Main Menu
When SBCMON is ready to receive a command from the user it will display the following message:
SBC Ready>
At this point the user may enter any valid command. A command consists of a single letter and zero or more additional parameters. The command is executed when the user presses ENTER.
When commands include a parameter, the first parameter is always entered immediately after the command letter with no space between them. For example:
X8000 - Correct X 8000 - Incorrect, there should not be a space between the 'X' and '2000'
The previously executed instruction may be executed again by hitting the ESCAPE key alone on a line. Commands are case-sensitive. This means the 'X' command is not the same as 'x'. All commands are upper-case except for one (the lower-case "w" command).
The following table lists all the commands that may be executed in SBCMON. Click on the link for each command for detailed syntax and additional information.
Command | Description |
A[xxxx] | Assembler. Invokes mini-assembler to allow quick assembly of small programs. If address 'xxxx' is provided in hex, assembly occurs starting at that address. If no address is provided, assembly occurs starting at the next address. |
C[ss nn hh w dd mm yy] | Read/Set DS1307 RTC. Reads the current date/time from the RTC, or sets it to the date/time specified in the parameters. |
E[text] | Read/Write Serial EEPROM. If 'E' command is issued alone, display the current contents of the AT25010A serial EEPROM. If the 'text' parameter is given, writes that text to the serial EEPROM. |
Ixx[,yy][=zz[,zz,etc]] | Read/Write IRAM. Displays or sets internal RAM. |
K[D] | Keypad Test. Echos keypresses from the 4x4 keypad to the terminal. Keypad debounce is disabled if the 'D' parameter is given. |
L | Load Hex File. Allows SBCMON to receive a HEX file and load it into XRAM, normally at 8000h. |
M[0|1|2][I] | Mode for LCD. Configures whether 16x2 LCD is attached as direct connect in 4-bit or 8-bit mode, or attached in memory-mapped mode. The "I" parameter will send initialization commands to the LCD. |
Q | Quick Load & Run. Receives a program in HEX format and immediately executes code at 8000h. |
Rxxxx | Run Code. Causes SBCMON to execute code at the specified hex address 'xxxx'. The code that is executed should end with a final RET instruction to return to SBCMON. |
V[F] | Verify XRAM. Executes a test of XRAM to verify that it is functioning reliably. The 'F' command will execute a much more thorough test that will take significantly longer to complete. |
Wtext | Write text to LCD. Writes the specified text to the LCD. |
w[aa bb cc] | Write commands to LCD. Writes the specified hex commands to the LCD. |
Xxxxx[,yyyy][=zz[,zz,etc]] | Read/Write XRAM. Displays or sets external RAM. |
SBCMON Library Routines
Programs which are run from within SBCMON by loading them with the "L" command and executing them with the "R" command may make calls to a number of library routines that are contained within SBCMON itself. Using these routines saves the developer from having to rewrite the routines and avoid using code memory for a routine that is already contained within SBCMON.
For example, a simple program to send the digits "45" to the serial port could be:
SendSerialHexByte EQU 0044h ;Define SendSerialHexByte to address in SBCMON libraries MOV A,#45h ;Load the accumulator with the byte that'll be sent to serial port LCALL SendSerialHexByte ;Call the SBCMON library routine
The program may define each routine that it uses with an EQU definition and subsequently make calls to that routine. Click on each routine below for the parameters that must be set or which are returned by each routine.
Address | Routine | Description |
0041 | SendSerial | Sends null-terminated string in code memory to serial port |
0044 | SendSerialHexByte | Sends value in ACC to serial port as two hexadecimal digits |
0047 | SendSerialByte | Sends character in ACC to the serial port |
004A | GetSerialByte | Waits for character on serial port, returns it in ACC |
004D | GetSerialLine | Receives an enter-terminated line of input from serial port |
0050 | SendLCDText | Sends a character to the LCD as text |
0053 | SendLCDCommand | Sends byte to the LCD as an LCD command |
0056 | I2C_ReadByte | Reads one byte from the I2C bus |
0059 | I2C_SendByte | Sends one byte to the I2C bus |
005C | I2C_Reset | Resets the I2C bus |
005F | I2C_Start | Starts an I2C conversation |
0062 | I2C_Stop | Ends an I2C conversation |
0065 | SPI_ReadByte | Reads one byte from the SPI bus |
0068 | SPI_SendByte | Sends one byte to the SPI bus |
006B | ByteTo2Ascii | Converts accumulator to two ASCII digits |
006E | HexToNibble | Converts ASCII value in accumulator to value 00h and 0Fh |
0071 | GetHexValue | Converts hex digits in input buffer to values |
0074 | GetSerialHex | Reads 2 hex digits from serial port, converts to value in ACC |
0077 | ToUpper | Converts the character in ACC to upper-case |
007A | SendDecimalR4567 | Sends value in R4-R7 as decimal value |
007D | DivideBy10 | Divides 32-bit value by 10 |
0080 | Check4BytesForZero | Verifies that a 32-bit value is zero |
0083 | ShiftR765Left | Shifts registers R5 (MSB) through R7 (LSB) left1 bit |
0086 | AddR67to23 | Adds 16-bit value in R6 and R7 to 16-bit value in R2 and R3 |
0089 | AddR4567to0123 | Adds 32-bit value R4 through R7 to R0 through R3 |
008C | InitializeLCD | Sends necessary commands to initialize LCD |
008F | ReadLCDStatus | Reads the LCD status (cursor position and busy flag) |
0092 | ReadLCDText | Reads the LCD text/memory at current cursor position |
0095 | SetDptrMMKey1 | Set DPTR to memory-mapped address for read keypad row 1 |
0098 | SetDptrMMKey2 | Set DPTR to memory-mapped address for read keypad row 2 |
009B | SetDptrMMKey3 | Set DPTR to memory-mapped address for read keypad row 3 |
009E | SetDptrMMKey4 | Set DPTR to memory-mapped address for read keypad row 4 |
00A1 | SetDptrMMLCdWC | Set DPTR to memory-mapped address for write LCD cmd |
00A4 | SetDptrMMLcdWT | Set DPTR to memory-mapped address for write LCD text |
00A7 | SetDptrMMLcdRC | Set DPTR to memory-mapped address for read LCD cmd |
00AA | SetDptrMMLcdRT | Set DPTR to memory-mapped address for read LCD text |
00AD | GetSBCMONVersion | Returns the version of SBCMON |
00B0 | GetKeyDebounced | Return keypad key with debounce |
00B3 | WaitKeyReleased | Wait for keypad key to be released |