ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 12.06.2025
Просмотров: 8162
Скачиваний: 1
© MCS Electronics, 1995-2007
button again to disable the Real hardware simulation.
When the program hangs it probably means that something went wrong with the serial
communication. The only way to escape is to press the Real hardware Simulation button again.
The Real Hardware Simulation is a cost effective way to test attached hardware.
The refresh variables button will refresh all variables during a run(F5). When you use the hardware simulator, the LEDS will only update their state when you have enabled this option. Note that using this option will slow down the simulation.
Watchdog Simulation
Most AVR chips have an internal Watchdog. This Watchdog timer is clocked from an internal oscillator. The frequency is approximately 1 MHz. Voltage and temperature variations can have an impact on the WD timer. It is not a very precise timer. So some tolerance is needed when you refresh/reset the WD-timer. The Simulator will warn you when a WD overflow will occur. But only when you have enabled the WD timer.
The status bar
The status bar shows the PC (program counter) and the number of cycles. You can reset the cycles by positioning the mouse cursor on the status bar and then right click. You will then get a pop up menu with the option to reset the cycles.
You can use this to determine how much time a program statement takes.
Do not jump to a conclusion too quick, the time shown might also depend on the value of a variable.
For example, with WAITMS var this might be obvious, but with the division of a value the time might vary too.
Program Send to Chip
Program send to chip shortcut , F4
This option will bring up the selected programmer window, or will program the chip directly if the 'Auto Flash' option is selected in the Programmer options section.
The following section applies to the Programmer window (programchip directly NOT selected) otherwise this is not shown to the user.
“Buffer” below refers to the buffer memory that holds data to be programmed to, or read from the chip.
Menu item |
Description |
File Exit |
Return to editor |
File, Test |
With this option you can set the logic level to the LPT pins. This is |
only intended for the Sample Electronics programmer. |
|
Buffer Clear |
Clears buffer |
Buffer Load from file |
Loads a file into the buffer |
Buffer Save to file |
Saves the buffer content to a file |
Chip Identify |
Identifies the chip |
page -52-
© MCS Electronics, 1995-2007 |
||
Write buffer into chip |
Programs the buffer into the chip ROM or EEPROM |
|
Read chipcode into |
Reads the code or data from the chips code memory or data |
|
buffer |
memory |
|
Chip blank check |
Checks if the chip is blank or erased |
|
Chip erase |
Erase the content of both the program memory and the data |
|
memory |
||
Chip verify |
Verifies if the buffer is the same as the chip programor data |
|
memory |
||
Chip Set lock bits |
Writes the selected lock bits LB1 and/or LB2. Only an erase will |
|
reset the lock bits |
||
Chip auto program |
Erases the chip and programs the chip. After the programming is |
|
completed, verification is performed. |
||
The following window will be shown for most programmers:
Note that a chip must be ERASED before it can be programmed.
By default the FlashROM TAB is shown and the binary data is displayed.
When you have an EEPROM in your project, the EEPROM TAB will show this data too.
The most important TAB is in many cases the Lock & Fuse Bits TAB.
When you select it , the lock and fusebits will be read.
page -53-
© MCS Electronics, 1995-2007
These Lock and Fuse bits are different in almost every chip !
You can select new settings and write them to the chip. But be careful ! When you select a wrong oscillator option , you can not program the chip anymore without applying an external clock signal.
This is also the solution to communicate with the chip again : connect a clock pulse to the oscillator input. You could use an output from a working micro, or a clock generator or simple 555 chip circuit.
When you found the right settings, you can use$PROG to write the proper settings to new, unprogrammed chips. To get this setting you press the 'Write PRG' button.
After a new chip is programmed with $PROG, you should remark the line for safety and quicker programming.
Notice that the Write xxx buttons are disabled by default. Only after you have changed a lock or fusebit value, the corresponding button will be enabled. You must click this button in order to apply the new Lock or Fuse bit settings.
Many new chips have an internal oscillator. The default value is in most cases 8 MHz. But since in most cases the 'Divide by 8' option is also enabled, the oscillator value will be 1 Mhz. We suggest to change the 'Divide by 8' fusebit so you will have a speed of 8 Mhz.
In your program you can use $crystal = 8000000 then.
$crystal will only inform the compiler which oscillator speed you have selected. This is needed for a number of statements. $crystal will NOT set the speed of the oscillator itself.
Do not change the fusebit that will change the RESET to a port pin. Some chips have this option so you can use the reset pin as a normal port pin. While this is a great option it
page -54-
© MCS Electronics, 1995-2007
also means you can not program the chip anymore using the ISP.
Tools Terminal Emulator
With this option you can communicate via the RS-232 interface to the microcomputer. The following window will appear:
Information you type and information that the computer board sends are displayed in the same window.
Note that you must use the same baud rate on both sides of the transmission. If you compiled your program with the Compiler Settings at 4800 baud, you must also set the Communication Settings to 4800 baud.
The setting for the baud rate is also reported in the report file.
NOTE: The focus MUST be on this window in order to see any data (text, etc) sent from the processor. You will NOT see any data sent by the processor right after a reset. You must use an external hardware reset AFTER the terminal Emulator window is given focus in order
to see the data. Using the Reset shortcut, you will not be able to see any data because pressing the shortcut causes the Terminal emulator to lose focus. This is different than “HyperTerminal” which always receives data even when the Hyperterminal window does not have focus. Use Hyperterminal if you need to see the program output immediately after programming or reset.
File Upload
Uploads the current program from the processor chip in HEX format. This option is meant for loading the program into a monitor program for example. It will send the current compiled program HEX file to the serial port.
File Escape
page -55-
© MCS Electronics, 1995-2007
Aborts the upload to the monitor program.
File Exit
Closes terminal emulator.
Terminal Clear
Clears the terminal window.
Terminal Open Log
Opens or closes the LOG file. When there is no LOG file selected you will be asked to enter a filename or to select a filename. All info that is printed to the terminal window is captured into the log file. The menu caption will change into 'Close Log' and when you choose this option the file will be closed.
Terminal Send ASCII
This option allows you to send any ASCII character you need to send. Values from000 to 255 may be entered.
Terminal Send Magic number
This option will send 4 bytes to the terminal emulator. The intention is to use it together with the boot loader examples. Some of the boot loader samples check for a number of characters when the chip resets. When they receive 4 'magic' characters after each other, they will start the boot load procedure. This menu options send these 4 magic characters.
Terminal Setting
This options will show the terminal settings so you can change them quickly. It is the same as Options, Communication.
Tools LCD Designer
With this option you can design special characters for LCD-text displays.
The following window will appear:
page -56-
© MCS Electronics, 1995-2007
The LCD-matrix has 7x5 points. The bottom row is reserved for the cursor but can be used. You can select a point by clicking the left mouse button. If a cell was selected it will be unselected.
Clicking the Set All button will set all points.
Clicking the Clear All button will clear all points.
When you are finished you can press the Ok button : a statement will be inserted in your active program-editor window at the current cursor position. The statement looks like this :
Deflcdchar ?,1,2,3,4,5,6,7,8
You must replace the ?-sign with a character number ranging from0-7.
The eight bytes define how the character will appear. So they will be different depending on the character you have drawn.
See Also
Font Editor
Tools LIB Manager
With this option the following window will appear:
page -57-
© MCS Electronics, 1995-2007
The Libraries are shown in the left pane. When you select a library, the routines that are in the library will be shown in the right pane.
After selecting a routine in the left pane, you can DELETE it with the DELETE button..
Clicking the ADD button allows you to add an ASM routine to the library.
The COMPILE button will compile the lib into an LBX file. When an error occurs you wil get an error. By watching the content of the generated lbx file you can determine the error.
A compiled LBX file does not contain comments and a huge amount of mnemonics are compiled into object code. This object code is inserted at compile time of the main BASIC program. This results in faster compilation time.
The DEMO version comes with the compiled MCS.LIB file which is named MCS.LBX. The ASM source (MCS.LIB) is included only with the commercial edition.
With the ability to create LBX files you can create add on packages for BASCOM and sell them. For example, the LBX files could be distributed for free, and the ASM source could be sold.
Some library examples :
MODBUS crc routine for the modbus slave program.
Glcd.lib contains the graphical LCD asm code
Commercial packages available from MCS:
I2CSLAVE library
BCCARD for communication with www.basiccard.com chipcards
page -58-
© MCS Electronics, 1995-2007
See Also
$LIB for writing your own libraries
Tools Graphic Converter
The Graphic converter is intended to convert BMP files into BASCOM Graphic Files (.BGF) that can be used with Graphic LCD displays.
The following dialog box will be shown:
To load a picture click the Load button.
The picture can be maximum 128 pixels high and 240 pixels width.
When the picture is larger it will be adjusted.
You can use your favorite graphic tool to create the bitmaps and use the Graphic converter to convert them into black and white images.
When you click the Save-button the picture will be converted into black and white. Any non-white color will be converted into black.
The resulting file will have the BGF extension.
You can also paste a picture from the clipboard by clicking the Paste button.
Press the Ok-button to return to the editor.
The picture can be shown with the ShowPic statement or the ShowpicE statement.
The BGF files are RLE encoded to save space.
page -59-