Home
RMB-S / READS User`s Guide
Contents
1. 2 Tutor asmin the Filename box or click on the hand icon and select Tutor asm file from the list 3 In the Name box type a short description for the module 4 Select as the main module 5 Click OK Tutor asm has been added It appears as a branch of the project TUTORT RPJ The language box in the New Code Module window shows that the module will be in Assembly Currently READS51 only supports assembly language programming 4 3 Building the Project 1 Double click on the Tutor asm module A READS Editor box with the program opens up Reads Editor C RIGEL READS51 WORK HELLO WORLD HELLOWORLD DEMOT TUTORINTUT 2 Click kaki J Eile Edit View Navigate Window Help mouse button and gj aj select Build from Tutori asm Last Update 10 24 90 the sub menu items displayed Simple Push Button Example 3 The READS Status Bar says Congratulations No assembly org 8000h run using the monitor G8000 command errors found setb P1 1 prepare 1 1 for input 4 Now let s add an mov P1 1 read the state of PBD 2 and store in the Carry flag error Add mov P1 0 C transfer PBO status to LO at the end of the sjmp loop loop forever first mov statement so that it reads move 5 Right click and select Build in the READS editor box again line 1 1 6 The READS Error Dialog box opens up and reports an Illegal Op C
2. Fr fo o amp 6 543210 LOW DIGIT 765432107 6 5432105432103 2101 76543210004322 gfedcba gfedcba JP1 r a 85 015050 S 76543210 L3 10 Figure 7 1 UlODs User Input Output Devices There 16 switches as part of the UIODs to be used as digital input devices Each switch has one terminal connected to power ground and the other available at the 54 post terminal strip The 8 push button switches marked PBO to PB7 terminate at the set of posts marked PB Similarly the 8 toggle switches which are implemented by an 8 contact DIP switch marked SW DIP 8 are terminated at the posts marked DIP SW Care should be taken not to connect these output posts to the power posts VCC V1 or V2 since closing making contact the corresponding switch will short power to ground Output devices sink current and are therefore appropriate to drive the microcontrollers input ports No pull up resistors are used with the switches If required by the application pull up resistors may be added using the breadboard area In addition to the digital input devices the UIODs contain 4 potentiometers marked POTO to POT3 Each potentiometer has one fixed terminal connected to 5 Volts VCC the other 14 fixed terminal to 0 Volts the power ground GND and its wiper terminal available at the 54 post terminal strip marked POTs The RMB S contains a socket U1 to accommodate a Siemens SLR2016 four digit intelligent display
3. ksanaskif asa ind svlna bu a t kutaaniinkasBikanddsa indu snnntansp tkndannha iki ar 36 10 12 RUNNING IN THE USER sissa sasken asad sk odar ak kas a unda vlkundan ikonnasbikskas iknagaa undnanannu dandstndaarkllkukgar 37 11 8051 FAMILY CHIP 38 12 SOFTWARE VE ND OR S 39 13 IBIBEIOGRAPHY ERR 40 Neil EU 40 esc 40 HARDWARE 40 APPENDICES I tihe APPENDIX READS51 MAIN MENU COMMANDS Acta PROJECTS I 2 IMODBUBE t sederit ecc dto sc Atal weet tA LA a ers I nuwaeo lim I VIEW tiere Hte bep te at Mie cec P eco Page Rufe de I N S FOOL tare aie at ays ein hate ee tees ate alae ein Oe a alia tiie teak S iL ES at ee temm tte iii ROC END MCI iii AS Assembler teet ec tc iii UP EM iii A 5 5 Compile Error oiii tib nies nm paint M rtr Muri iii 67 OPTIONS k cated tee nae A M Does m De I NN ANDOW qp PEDE A
4. nena 8 4 2 ADDING A MODULE US pH des ns deed ed 8 4 9 BUILDING THE PROJEGT eode athe teda sr k ho eth f f r 9 4 4 DOWNLOADING THE PROJECT INTO MEMORY 10 4 5 RUNNING THE PROJECT IERI er Istic fede DA 10 TUTORIAL 2 DEBUGGING A 11 5 1 SINGLE STEPPING AND SETTING 11 5 2 WATCHING VARIABLES at 11 TUTORIAL ARCHIVE PROJECTS 13 6 1 ea e 13 6 2 IMPORTING EXPORTING MODULES 13 THE RMB S BOAR D p 14 7 1 USER INPUT OUTPUT DEVICES sessi nennen nennen nr enne nnns 14 7 2 MICROCONTROLLER PORTS ts ives Hare Den gas eeepc a 15 L helenae tue C Ier re died ce a 16 7 4 80515 80517 FAMILY 6 14 2 411 2 1 5 1 S Taa By a a ss sana s Haa Bea an 17 74 4 Pin assignment e
5. segments are to overlap remove this jumper Sockets U5 and U6 hold the 56256 64K of overlapped program and data memory When code is downloaded to the RMB S the program and external data memory segments must overlap so that code is placed in memory as data U5 U6 U7 U8 and read as instructions Place a static RAM in U6 and remove the jumper Seige SEP Pee Figure 7 5 Memory Jumper Selection EPROM RAM EPROM RAM EPROM RAM 7 6 System header All system signals are available on the 40 pin jumper header marked JP11 The pin assignments are given below Refer to the circuit diagram for additional information Signal Pin Pin Signal A15 1 2 VCC 14 3 4 GND A13 5 6 WR 20 12 RD 11 9 10 PSEN ATO 11 12 o NO 1 1 1 1 1 1 gt m D7 RO 35 36 HWPD 37 38 PE SWD 39 40 w NIN w NJOI NIN R oo o UVVU VU 7 7 The Daughter Boards 7 7 1 The DA84 Daughter Board The DA84 daughter board accommodates the 80517 family of microcontrollers in the 84 pin PLCC format It contains a reset button and 2 two post jumpers labeled EA and OWE Jumper EA when installed connects the External Enable input to GND thus allowing external program memory to be fetched This jumper must be removed when an 80517 with internal ROM is used The jumper OWE when inserted connects the Oscillator Watc
6. Journals Circuit Cellar Ink Circuit Cellar Incorporated 4 Park Street Suite 20 Vernon CT 06066 telephone 203 875 2751 Elector Electronics USA Audio Amateur Publications Inc 305 Union Street Peterborough NH 03458 Embedded Systems Programming Miller Freeman Publications 500 Howard Street San Francisco CA 94105 telephone 415 397 1881 Books MCS 51 Macro Assembler User s Guide for DOS Systems Intel Corp 19106 Intel Corp Literature Sales P O Box 7641 Mt Prospect IL 60056 7641 Order 122752 001 8 Bit Embedded Controllers Intel Corp 1990 Intel Corp Literature Sales P O Box 7641 Mt Prospect IL 60056 7641 Order 270645 002 Embedded Applications Intel Corp 1990 Intel Corp Literature Sales P O Box 7641 Mt Prospect IL 60056 7641 Order 2706410 002 Microcontrollers 1988 Data Book Handbook Advance Micro Devices Inc 901 Thompson Place P O Box 3453 Sunnyvale CA 9401010 3453 8 Bit Single Chip Microcontroller Handbook 1991 92 Siemens Components Inc Integrated Circuit Division 2191 Laurelwood Road Santa Clara CA 95054 Hardware Design The Art of Electronics by Paul Horowitz and Windfield Hill Cambridge University Press 19100 40 APPENDICES APPENDIX A READS51 MAIN MENU COMMANDS READS51 V3 X has a more modular look than the previous versions Although the functionality of the READS51 components remain fully integrated the user interface has been improv
7. The program SLR2016 ASM illustrates the intelligent display The SLR2016 has two address lines AO and A1 One of the four digits is selected by 1 0 There are 7 data lines DO to D6 that specifies the character to be displayed by its ASCII code The active low line WR executes a write command that displays the digit character specified by 00 07 at the location specified by AO A1 SLR2016 can be thought of a write only memory of 4 locations that accept ASCII characters 10 5 Running Lights The example RunLgts0 ASM uses the 8 LEDs as output devices connected to Port 1 Connect the 8 LEDs of the bar display to Port 1 bits The program starts with the LEDO connected to P1 0 lit and all other LEDs off After a short delay this LEDO is turned off and the LED1 connected to P1 1 is lit The lit LED shifts to the left until LED7 is lit The process then reverses as the lit LED shifts to the right The program RunLgts1 asm implements the running lights It also illustrates the use of system calls crlf delay inkey print prsphx and sndchr The subroutine rlights performs rotating the lights 10 6 Using Internal Timers The programs RunLgts0O asm and RunLgts1 asm shifts the LEDs at a constant rate determined by the delay routine RunLghts1 asm is similar to RunLghtsO asm except it uses Ports 4 and 5 together to control 16 LEDs Besides the Bar Display use LEDs marked LO to L5 and two segments from one of the seven segment displays While the de
8. getbyt waits to receive 2 characters 2 bytes from the serial port If the characters are valid hexadecimal digits 0 9 A F then the ASCll represented byte is converted to binary and placed in the accumulator a The accumulator a and the b register b are affected getchr and getchrx wait for a character to be received through the serial port The character is then returned in the accumulator a Routine getchr clears the most significant bit of the character byte whereas getchrx returns all 8 bits init invokes the initialization routine which initializes the interrupt vector table sets the stack to 4fh clears software flags and sets the serial communications to 9600 Baud 8 data bits 1 stop bit and no parity bits It affects the accumulator rO and dptr inkey peeks at the serial port to see if a character has been received If so the character is returned in the accumulator a If not a null 0 is returned in the accumulator a The accumulator a is affected mdelay and sdelay execute dummy loops for timing purposes The period from when mdelay is called to its return is exactly 1 millisecond Routine sdelay takes exactly one second from its call to its return These delay routines are exact only when a 12Mhz system clock is used and when there are no interrupt routines in the background os return turns control over to the monitor Since the monitor resets the stack to 4fh ei ther a call or a jump in
9. prthex and prsphx convert the binary value of the accumulator into 2 hexadecimal digits Prsphx and prthex then send these two ASCII digits high digit first out through the serial port Before termination prsphx sends a space ASCII 20h out through the serial port These routine use the accumulator a and register R2 during the binary to hexadecimal conversion setintvec modifies the interrupt vector table so that interrupt source from 0 to 5 indicated by the value of the accumulator a is directed to the interrupt service routine whose starting address is held in the data pointer dptr See Section 5 6 for a detailed description of the in terrupt vector table Except for the two registers a and dptr and the program status word psw setintvec does not affect any registers The 6 interrupt sources of the 8032 are listed below source number description 0 intO external interrupt 0 1 tintO timer 0 overflow interrupt 2 int1 external interrupt 1 3 tint1 timer 1 overflow interrupt 4 sint serial port interrupt 5 exint timer 2 overflow interrupt Notice that the source numbers follow the default priorities of the interrupts see the mi crocontroller manufacturer s data book for more information As an example let tOisr be the interrupt service routine for the timer 0 overflow interrupt in an application program The interrupt is directed to tOisr by the following instructions mov a 1 Select interrupt Source
10. sndchr equ 0148h a Then the application program simply calls say subroutine getchr as follows igati getchr The registers used by these routines appear in the header as comments If the application program uses these registers the registers should be pushed before the system call The source code of these general purpose routines are given on the distribution diskette A short description of the system calls is presented in Appendix A 1 9 5 System Variables The ROM resident firmware uses several internal registers for the system All of the monitor commands use register bank 0 The stack is initialized to 4Fh so that the first byte pushed is placed in internal location 50h Stack does not grow beyond 16 bytes 50h 5Fh when the monitor functions or the host mode debugging functions are used The bottom of stack may be set anywhere in internal ram by a user program The bit addressable internal RAM location 20h is used by the system to hold various software flags Notice that the individual bits of internal RAM 20h have addresses 0 to 7 0 being the least significant bit of 20h The use of each software flag is shown below bit flag name use 0 dash set if a dash was detected in the command line 29 1 equal set if an equal sign was detected in the command line 2 break set if a break point is in effect 3 error set when an error is encountered 4 interrupt saves the status of EA EAL during debug 5 host set when
11. 15 Volts Analog to digital conversion with 8 bits of resolution results in an accuracy of 0 0586 volts or 58 6 millivolts for the 0 15V range Since the voltage applied to the analog inputs of the 80535 or 80537 must be in the interval 0 5 Volts a two resistor voltage divider along with two diodes for over and under voltage protection is used The following simple circuit can be constructed on the breadboard With H1 10 Kilo Ohms and R2 5 Kilo Ohms the analog to digital converter input is 5 volts producing a digital value of 256 actually 255 when the input is at is 15 Volts Thus an input of 12 5 Volts will produce the digital value of 213 decimal or D5h The output is displayed on the 7 segment displays Connect DIGIT LOW to Port 4 segment a to P4 0 b to P4 1 segment g to P4 6 and DIGIT HIGH to Port 5 in the same manner as DIGIT LOW 10 9 A 0 5 Volt Voltmeter The program Vmeter2 asm defines a global single byte constant named range Range is an integer which is the value to be displayed when the analog to digital converter data register is 255 For example using a voltage divider circuit given above with R1 10K and R2 5K we wish the display to read 12 5 rather than D5 when the input is at 12 5 volts The program Vmeter2 asm first shows the integral part of the voltage in decimal 12 for 12 5 Volts followed by the fractional part 50 for 0 5 Volts also in decimal The system call percent is used to convert the binary
12. RAM 2 The program should not make a jump to the byte BP 1 or BP 2 where BP is the break point address Point 1 does not pose any restrictions It is advisable to first obtain a list file from the assembler and then pick appropriate break points Although very infrequently point 2 may require some additional care in placing break points just before labels Consider the following example address instruction mnemonic 8100 16 dec r0 begin 8101 7405 mov a 5 8110 80EF sjmp begin if a break point is set at 8100 the three bytes at 8100 8101 and 8102 will be modified to hold a long jump to the break point handler routine say at address xxxx That is the byte 16h at 8100 will be modified to 02 and the word 7405 will hold xxxx Once the break point is placed when the program execution comes to 8100 the program will branch to the break point handler However when the short jump instruction at 8110 is processed the address xxxx will be fetched and interpreted as an instruction The recommended way to avoid this is to place nop no operation instructions after the dec rO instruction xii address instruction mnemonic 8100 16 dec r0 8101 00 nop 8102 00 nop begin 8103 7405 mov a 5 8112 80EF sjmp begin Despite this inconvenience implementing break points by placing long jump instructions in code has the major advantage that it is not intrusive to the operation of the processor That is until the break point
13. block also erases the highlighting To explicitly erase the highlighting click the mouse one more time or press one of the arrow keys vii APPENDIX C GENERAL PURPOSE ROUTINES SYSTEM CALLS A short description of user accessible system calls is given below The source code for the system calls is given on diskette in the file syscalls src ascbin assumes that the contents of the accumulator is a hexadecimal digit that is in the interval 0 9 A F or a P Provided that the accumulator holds a valid hexadecimal character it is converted to binary and returned as the lower nibble of the accumulator The high nibble is cleared to 0000b If the accumulator does not hold a valid hexadecimal character the system error flag errorf is set autoexec checks the RROS system variable if a routine is to be executed after power up The presence of a start up routine is indicated by the routines start address other than 0000h or FFFFh placed after location 480h If an autoexec routine exists the message hit any key to abort is sent out the serial port If no characters are received from the serial port a long jump performed to the start up routine If no such routine is present or if a character is re ceived through the serial port within 2 seconds of the abort message control is turned over to the RROS command processor The program status word PSW may be affected binasc converts the low nibble of the accumula
14. desirable to develop and run programs independent of RROS The EPROM in U6 which holds the RROS occupies the low 32K block of memory when the slide switch 16 is in the MON ITOR position Upon reset RROS executes and allows downloading programs into RAM The program USERmode asm demonstrates how a program with its origin at 0 may be downloaded to RAM and run USERmode asm uses the TIMERO overflow interrupt to flash an LED connected to port P1 0 Note that the Timer 0 interrupt branches to OBh USERmode asm has an origin at 0 where a jump instruction is placed to branch to the main body of the program At origin OBh a jump instruction redirects the program flow to the interrupt service routine Connect P1 0 to an LED of the UIODs Assemble the program Download the program to RAM Note that although the program starts from 0 RROS stores the code starting at 8000h where the RAM is decoded When downloading RROS always sets the most significant bit of the specified address Now press and hold the RESET button While the RESET button is pressed move the slide switch S16 to its USER position Release the RESET button to start the program and observe that the LED flashes 37 11 8051 FAMILY CHIP MANUFACTURERS The following is a list of chip manufacturers There are over a 100 varieties of 8051 processors on the market today The 8051 family has about a 45 share of the 8 bit processor market We recommend you call and ask for data books if y
15. hardware This program will loop until the RESET button on the board is pressed The above program is superfluous since the same task can be accomplished by directly connecting LO and PBO Now consider a simple addition to the program org 8100h run using the monitor G8100 command setb 4 1 prepare P4 1 for input loop mov P4 1 read the state of PBO and store in the Carry flag cpl complement the carry flag mov P4 0 C transfer complemented PBO status to LO sjmp loop loop forever This program will light LED 0 when push button 0 is released and will turn LED 0 off when push button 0 is pressed Notice how trivial an addition this is to the software while no changes are made to the hardware the beauty of programmable control Moreover several inputs can be monitored to make a decision whether to light the LED Let DIP switch 0 DIP SWO be connected to Port 4 bit 2 The following program lights LO when PBO is pressed provided that DIP SWO is off If DIP SWO is on then P4 2 is pulled to ground and consequently LO is lit when PBO is released org 8100h run using the monitor G8100 command setb P4 1 prepare P4 1 for input setb P4 2 prepare P4 2 for input loop mov P4 1 read the state of PBO Store in the Carry flag to invert or not to 32 invert ask P4 2 jb P4 2 show cpl complement the carry flag show mov P4 0 transfer complemented PBO status to LO sjmp
16. highlighting text also referred to as selecting text B 4 1 Highlighting the Current Word Position the mouse cursor on the word to be highlighted and double click any mouse button B 4 2 Highlighting a Block of Characters Using the mouse Position the mouse cursor on the first character of the block and depress the left button While the left button is depressed drag the mouse to the last character of the block and release the mouse Using the Keyboard Position the caret on the first character of the block and depress the shift key Now use the arrow keys to position the caret on the last character of the block and release the shift key Normally you can use any position key in combination with the shift key to advance or shrink the highlighted area Normally a function that utilizes a character block also erases the highlighting To explicitly erase the highlighting click the mouse one more time or press any of the positioning keys B 4 3 Highlighting a Block of Lines Using the mouse Position the mouse cursor at any position on the first line of the block and depress the right button While the right button is depressed drag the mouse to the last line of the block and release the mouse vi Using the Keyboard Position the caret at any position on the first line of the block and hit the F8 function key Use the Up and Down arrow keys to position the caret on the last line and hit F8 again Normally a function that utilizes a line
17. host mode debugging is selected 6 trace used internally by the trace routine during debugging 7 reserved for future use Internal RAM locations 30h to 3Fh are used by the command line processor to save the com mand line The parameters extracted from the command line are stored in binary in internal RAM locations 42h to 47h Internal RAM locations 48h to 4Ch are used by the debug routine Specifically location 48h and 49h hold the break point address low and high bytes during debugging The debug routine returns command to the application program a long jump to the address stored in 49h 49h Internal memory use is now summarized address use 20h software flags 30h 3Fh command line buffer 42h 47h buffer for command parameters 48h 4Ch buffer for break parameters 5Oh stack RROS does not place more than 16 bytes on stack Some important system information is placed at low addresses of ROM The jump table associated with user accessible system calls is located starting at 100h ROM locations 400h to 47Fh are reserved for system constants For example the ROM version and date is coded as two words 2 bytes each at locations 400h and 402h respectively Below is the list of system constants available to the user address use 400h ROM program version e g 0103h refers to version 1 3 402h ROM program date e g 1091h refers to October 1991 404h Contains the end of ROM based program Application programs may be placed in EPROM a
18. interrupt service routine inspects the return address and inserts a break point only if the return address is in RAM 8000h FFFFh Thus tracing will not single step through ROM Since at each trace instruction the system returns to the break point handler the user interface is identical to using break points xiv APPENDIX F DEBUGGING WITH AN ASCII TERMINAL A break point is set from the monitor prompt using the Bxxxx command and the program run by the Gxxxx command using an ASCII terminal When the break point is encountered the registers followed by a submenu are displayed sent to the terminal by the ROM resident firmware RROS The submenu items are selected by single letter commands The following submenu items are available displays the contents of the 256 internal RAM locations R displays the 4 register banks along with the accumulator the b register the stack pointer the data pointer and the program counter F displays the Special Function Registers Notice that of the 128 special function registers displayed not all are used by the processor S shows the stack pointer C removes the break point and continues the program removes the break point and sets a new break point at the address which should follow the N command For example N8200 sets the new break point at address 8200h T branches to the trace utility Trace places a break point at the next instruction Thus by repeatedly issuing the T command
19. interrupt vector addresses in low ROM Source Vector Redirected to 8052 80535 80537 IEO 0003h FFOOh X X X TFO 000Bh FFO4h X X X IE1 0013h FF08h X X X TF1 001Bh FFOCh X X X RI 0 TI O 00238 FF10h X X X TF2 EXF2 002 FF14h X X X IADC 0043h FF18h X X IEX2 004Bh FF1Ch X X IEX3 0053h FF20h X X 4 005 FF24h X X IEX5 0063h FF28h X X IEX6 006Bh FF2Ch X X RIH TI 0083h FF30h X CTF 009B FF34h X The system ROM at location 0003h for example contains the instruction ljmp FFOOh Similarly the other interrupt vectors are redirected by long jump instructions RROS refers to the memory block FFOOh to FF18h as the interrupt vector table Notice that with the default configuration the interrupt vector table is in RAM The initialization routine init which is automatically invoked upon reset refreshes the interrupt vector table This rou tine is available as a system call Init also places long jump instructions at the interrupt vector table For example at location FFOOh corresponding to external interrupt 0 IEO init places the instruction 1jmp 500h where 500h is the address of the initialization routine invoked at reset All interrupt vector table entries are similarly initialized with ljmp 500h instructions by the routine init With the interrupt vector table so initialized any acknowledged interrupt jumps to start effectively performing a reset Since the interrupt vector table is in RAM its entries can be modified Say th
20. is encountered its presence has no effect on the rest of the program xiii APPENDIX E HOW TRACING IS HANDLED Tracing is one of the options once a break point is encountered It is implemented by activating external interrupt 0 IEO First the interrupt is chosen to be level activated by clearing 0 Then bit 2 of Port 3 P3 2 which receives the external signal for external interrupt 0 is cleared All interrupt priorities are set to the lowest priority by clearing interrupt priority registers IPO and IP1 By default IEO has the highest priority An interrupt service routine for IEO is linked by placing its address into the interrupt vector table Next the break point is removed by restoring the 3 bytes occupied by the call to the break point handler and the execution resumes from the break point address Since IEO is already active the program jumps to its interrupt service routine after executing one instruction The interrupt service routine pops the return address which points to the next instruction and places a new break point at the next instruction It then deactivates IEO restores the interrupt service routine and returns Of course now the instruction upon return is a long jump to the break point handler Effectively the processor has executed one instruction and has returned to the break point handler The following must be observed when using the trace option 1 IEO and P3 2 must not be used by the program 2 The
21. loop loop forever Suppose that several input bits need to be considered to make a decision whether to light LO For example let PB1 be connected to Port 4 bit 2 P4 2 The following program will light LO if both PBO and PB1 are pressed org 8100h run using the monitor G8100 command setb P4 1 prepare P4 1 for input seth P4 2 prepare P4 2 for input read the state of PBO store in the Carry flag the logic OR operator transfer complemented PRO or PRL to LO loop forever loop mov C P4 1 orl C P4 2 mov P4 0 C lt Ne Ne Ne Ne Ne gt sjmp loop Notice that in the above program both PBO and PB1 need to be pressed so that both P4 1 and P4 2 are at logic level 0 Only in this case will PBO or PB1 will be 0 lighting the LED 10 2 A Keyless Entry Digital Unlock System Suppose you wanted to implement a keyless entry system Let push buttons 0 to 3 be used If these buttons are pressed in the correct order the unlocking mechanism is activated If the buttons are pressed in the incorrect order an alarm is to be activated when 10 incorrect key presses accumulate Let LED 0 represent the unlocking mechanism and L1 the alarm Connect PBO PB1 PB2 PB3 to P4 0 P4 1 P4 2 and P4 3 respectively Connect LO and L1 to P4 4 and P4 5 respectively In addition let PB4 be the reset input connected to P4 6 The program KEYLESS1 ASM given on the distribution diskette is a brute force imple mentation of
22. may assume that MOVE is a label or a symbol for example 8 1 7 Operand s Out of Range This message is generated when the specified operand has a value too large or too small 23 8 1 8 Incorrect Operand Types Some instructions are limited to word byte or bit operands Moreover a word may be a memory location a Special Function Register address or a data byte of type data16 Sometimes this error is generated when a symbol is not properly defined 8 1 9 Incorrect Register Use An operand which is a constant or a memory type was expected but a register was found 8 1 10 Incorrect Constant A constant or an expression contains an error For example hexadecimal numbers must start with a numerical digit and end with the letter h or H Expressions involving incorrect constants also generate this message 8 1 11 Odd or Out of Range Address The specified address is either odd or beyond the reach of a branching instruction See the error message Operand s Out of Range 8 1 12 Undefined Symbol A symbol appears in the instruction but no definition of the symbol is found Sometimes this message is generated if an include file containing the symbol definitions was not found or when a misspelled operation code is mistaken for a symbol 24 9 RROS THE ROM RESIDENT OPERATING SYSTEM RROS manages the prototyping board and cooperates with READS RROS has a command processor which can be accessed by an ASCII terminal or by the PC
23. modules from one project to another or share modules in different projects For example you may copy a previously developed module from an archive project to an executable project by simply dragging its icon from one project window to the other You may set Module Properties Add Module Edit Module Save Save or Delete modules of the current project using the commands under the Module option The Add Module command allows you write and include new modules to a project or lets you select assembly programs which are already created Edit Module opens the current module in the editor saves the current module if it is open in the editor Save All saves all modified modules of the current project Finally Delete brings up a dialog box asking whether to delete the module from the project or from the disk also READS51 does not require the use of modules A 3 Compile The Compile menu commands include Build Build and Download Download Hex Toggle Breakpoint Program Reset Single Step and Run Build compiles the current project If no project is open and the editor contains a file this current file is compiled Build and Download compiles the highlighted project and downloads it to the target board Toggle Breakpoints allow you to turn on or off breakpoints The Single Step command allows you to step through the program statement by statement after it has been downloaded to the board Download Hex a
24. one may single step through the program At each step the programmer may examine the state of the processor Only instructions in RAM can be traced Thus T skips over any ROM resident subroutine or user accessible system call which it encounters M aborts the program and returns control to the monitor command processor XV APPENDIX G THE SOFTWARE DEVELOPMENT CYCLE A successful embedded controller application requires a careful blend of hardware and software There is still a considerable amount of art involved in developing an embedded controller system especially in dividing the system functions between hardware and software and in designing the global structure of the software system In this section we focus our attention on software development The objective of software engineering is to create software which meets the requirements minimizes cost maximizes reliability and maximizes the understandability and modifiability of code These objectives imply that a prerequisite to embedded system software development is a set of specific system requirements Cost should be minimized in the global sense That is cost should include not only software development costs but also hardware costs and hardware software maintenance costs System reliability considerations especially for real time embedded systems require writing code which is equipped to handle unexpected operating circumstances It is not uncommon that the majority of the cod
25. run on the target system Components of an executable project are the code modules containing subroutines or functions which make up the entire program 3 1 2 Archive Projects Archive projects are never compiled They are intended to facilitate code reusability by organizing and keeping code modules together An archive project acts as a repository which you may add modules to or copy modules from Executable projects can be quickly constructed using already written and debugged modules from an archive project 3 2 Module A module is a single file which belongs to a project Typically modules are assembly language subroutines You may copy modules from one project to another or share modules in different projects For example you may copy a previously developed module from an archive project to an executable project by simply dragging its icon from one project window to the other By using existing or previously developed and debugged modules you may significantly improve code reusability much in the same manner as libraries Reusing modules differs from using library functions of existing routines in that modules are kept in source form rather than object form 4 TUTORIAL 1 EXECUTABLE PROJECTS A project is a collection of code modules which are grouped together READS51 uses two different kinds of projects executable projects and archive projects An executable project is a collection of modules which are compiled together to form one
26. the keyless entry system designed to unlock if the buttons are pressed in the or der 0 2 3 1 It uses 2 internal RAM locations 7Eh stores the number of incorrect key presses left before an alarm is activated and location 7Fh stores a count number used in a delay loop The delay loop is to prevent push button switch bouncing Bouncing refers to the rapid con tact disengage sequence while the button is being released The program is in 4 segments each checking for the next right button to be pressed If the right button is pressed the next section follows If not the number of incorrect presses left is decremented If this count reaches 0 the alarm is activated 33 10 3 Using Subroutines The code making up program KEYLESS1 ASM can be reduced significantly by the use of subroutines to undertake the repetitive procedures of waiting for a button to be pressed and waiting for all buttons to be released Consider next the program KEYLESS2 ASM The program uses the system call delay for the wait periods for debouncing as well as the chk brk routine to see if the user has become bored and hit the break key Ctrl C or Alt F4 The program KEYLESS3 ASM further implements a programmable key sequence The constants labeled first second third and fourth hold the 4 keys of the sequence 10 4 Using the SLR2016 Intelligent Display Socket U1 accepts the Siemens SLR2016 Intelligent Display chip This chip has 4 digits that displays ASCII characters
27. the respective parties shall be governed by the laws of the State of Florida 1 Table of Contents toss soa E e as 1 1 41 gt OVERVIEW 1 1 2 PARTS retta 2 SOFTWARE SETUP ecc 3 2 1 SYSTEM REQUIREMENTS 32 2 ern i tte I eet PE hee I Ed ee eeu fe a h a 3 2 2 SOFTWARE INSTALLATION READS51 3 SOTAR TUPA rats 3 2 4 DAUGHTER BOARD JUMPERS eiu ur ave e per een e Sad rei en nee vie ov teens 4 2 6 VERIFYING THAT THE MONITOR IS 5 READS51 V300 CONCEPTS si 7 b T ask 7 3 1 Executable Priati blk ened 7 SEZ Archive ProJects mtt kkr 7 2 2 MODULE a a tose 7 TUTORIAL 1 EXECUTABLE 8 4 1 CREATING AN EXECUTABLE PROJECT 14022 01 111 41 entren
28. to stop at the first instruction Now repeatedly press F8 to observe the flow of the program READS is in the Debug state throughout single stepping You may toggle a breakpoint and execute until the new breakpoint or simply issue the Assemble Run command to continue execution with no further breakpoints 5 2 Watching Variables READS51 allows the user to watch the variables code memory data memory internal memory ports and SFRs as the programis sc enc ae eos 55 debugged Project Module Compile Options Window Help 5 1 S Vi 17 Code Memory Ctrl F Select View Data Memory Shift F7 DEMOI TUTORI TUTOR1 ES Watches 21 Internal Memory Ports Shift Ctrl F7 TUTOR1 RPJ SFRs Read all views from board Ctrl R Write all views to board 2 A Watch Setup box will appear Ctrl O Close all views 3 Press F8 to start single stepping 4 You can watch the program single step through the code by looking at the READS Editor window or you can select which variables to watch as the code runs r Watch Setup 8031 PF E3 ge Symbol Address Descipion Bytes E Memory 2 cru Central Processing Unit 0 2 140 Ports Input Output Ports 0 2 E interu Interrupt Handling 0 e Misc Miscellaneous 0 amp Seriali Serial Input Output Han 0 e amp Timer
29. 1 move dptr 6013 address of the Service routine lcall setintvec tOisr the interrupt Service routine Starts here various application Specific instruc lt Ne Ne gt tions reti the interrupt service routine ends here sndchr sends the contents of the accumulator out through the serial port This routine waits until the serial transmit operation has been completed The accumulator a is affected xi APPENDIX D HOW BREAKPOINTS ARE HANDLED A break point is set by replacing three bytes the byte at the break point and the following two bytes by a long jump instruction to the break point handler routine in the system ROM The break point address is stored in internal RAM locations labeled pbuffr and pbuffr 1 The three bytes removed from code are stored in pbuffr 2 pbuffr 3 and pbuffr 4 Actually there are two break point handlers one to be used in conjunction with READS and the other with an ASCII terminal Host mode debugging that is using the break point handler that works with READS is more powerful than the ASCII terminal mode Both modes let the user view the internal data RAM The host mode also allows viewing external memory and modifying internal or external memory The break point handler in either debugging mode invokes submenus The following must be observed when setting a break point 1 The break point must coincide with the first byte of an instruction in
30. 8 XD H hold the lower and higher halves of external data memory 0 7FFFh and 8000h FFFFh respectively The low and high 32K memory blocks labeled as PL PH XDL and XDH are valid when the slide switch 516 is in the MONITOR position In its USER position the high and low 32K memory blocks are swapped That is U5 is decoded to be the high code memory block U6 the low code memory block U7 the high data memory block and U8 the low data memory block The slide switch is used when downloaded programs need direct access to the interrupt vectors located in low memory Such a program with its origin at O is first downloaded a program into a RAM device placed in U6 During the download U6 occupies the high 32K memory block While holding the RESET button down 516 is moved to its USER position Now the program in U6 is in the low memory block starting at address O Releasing the RESET button executes the user program in U6 The user program may then have direct access to all interrupt vectors 7 5 3 Memory Jumper Selection There are two jumpers next to each of the sockets U6 U7 and U8 These jumpers select whether an EPROM or a static RAM is held Note that these jumpers must be set together i e both jumpers must either be in the EPROM position or in the RAM position There is a single two post jumper next to U5 labeled SEP Insert this jumper if separate program memory and external data memory is used If the two memory
31. 80C535 80C515A Number Pin Number 80C537 pum Available on Terminal 4 PE SWD PE SWD Yes 60 GND HWPD Yes 69 OWE OWE No 7 4 2 Jumper Selection The RMB S board contains 2 three post jumpers labeled SWD HWPD to accommodate the different pin assignments of the processors The center post of these jumpers are connected to the PEZ SWD and HWPD signals of the CPUs The two extreme posts are connected to VCC and GND as marked A single jumper from the center post to the VCC side selects a logic high signal and similarly to a single jumper on the GND side selects a logic low signal The signal will float high impedance state if the jumper is removed 9VAC PE SWD _ HWPD vec e R 0 0 Remove 0 H for HWPD Remove for VBB EA o 7 3 PESWD HWPD jumpers Note that these two signals are also available on the solderless terminal The PEZ SWD signal is internally set to logic 1 with a pull up resistor If the application circuit is to provide the signals the jumpers should be removed The table below shows the jumper configurations for various 535 and 537 microcontrollers 17 80 535 80 515 PE input SWD Select Signal Select Signal VCC HWPD input VCC or Float 80C537 80 517 SWD SWD Select Signal Select Signal GND HWPD input VCC or Float Jumper PD input SWD VCC or
32. CT To debug the executable project TUTOR 1 RPJ the Single Step or Toggle Breakpoint option must be selected after the project is built and downloaded to the board but before the RUN command is given 5 1 Single Stepping and Setting Breakpoints 1 To debug a project first make sure that the project is open If not select Project Open Executable and double click TUTOH 1 RPJ 2 Select the Compile Build and Download mode from the toolbar The program will be downloaded to your board 3 You may set a breakpoint by moving the cursor to the line in the READS Editor which contains the instruction and issuing the Compile Toggle Breakpoint command This command sets the breakpoint or removes the breakpoint if one was already set Now if you try to run the program the execution will stop once the breakpoint is reached This state the breakpoint is reached and the program suspended is called the Debug State If you set a new breakpoint in the Debug state program execution resumes The program runs until the new breakpoint is reached You may use this feature to debug the critical sections of your code and quickly execute over other sections which you know work well 4 Single stepping or tracing refers to executing one instruction at a time It may also be viewed as having a breakpoint at each instruction Use the Compile Single Step command READS asks for the address of the first instruction This is the first breakpoint Select 8000
33. Calls The ROM resident firmware contains many general purpose subroutines that can be called by user written programs Some of these subroutines are used by the system in carrying out the monitor functions The system calls are classified by their function below Function Subroutine Names Serial Communication chkbrk beep cret crif getbyt getchr getchrx inkey print prthex prsphx prtstr sndchr System break delay mdelay os return sdelay setintvec Miscellaneous ascbin binasc display percent Access to these routines is provided through a jump table located in low ROM memory The application program can call these routines by name if the following header of equate pseudo ops is included in the application program 28 system calls registers used ascbin equ 0100h a r2 error flag autoexec equ 0103h beep equ 0106h none binasc equ 0109h a break equ 010Ch a reads accumulator chkbrk equ 010 a reads serial port cret equ 0112h a crlf equ 0115h a delay 0118h display equ 011Bh a getbyt equ 011 b getchr equ 0121h getchrx equ 0124h init equ 0127h inkey equ 012 7 mdelay equ 012Dh 3 os_return equ 0130h percent equ 0133h a print equ 0136h dptr prsphx equ 0139h TZ prtstr equ 013Ch a prthex 013Fh ay EZ sdelay equ 0142h a setintvec equ 0145h 2 dptr
34. ER is a cross assembler for the Intel MCS 51 assembly language used by the 8031 8051 family of microcontrollers ASSEMBLER is a two pass assembler Forward references are resolved during the second pass 8 1 Assembly Errors 8 1 1 Attempt to Redefine Symbol or Label A label or symbol of the same name was previously defined 8 1 2 Incorrect Symbol or Label Symbols and labels may only include letters a z or A Z digits 0 9 or the underscore character 8 1 3 Incorrect Operand The operand type is not permitted in the instruction For example movb RO R1 is a byte oriented move where the operands are word operands 8 1 4 Attempt to Branch Out of Bounds The jump point of a branching instruction is beyond reach Relative jumps and calls are limited to the range of 127 to 128 words from the current address The current address is the address of the first byte of the following instruction 8 1 5 Unresolved Operand s Either a typographical error was made in naming the operand or the operand is not defined If the operand is an expression one or more of the terms is undefines 8 1 6 Undecodable Line This error is a catch all error Misspelled operation codes will generate this error As in for example move RO RI Note that the assembler continues to read tokens until a valid operation code is detected Therefore this error may be given after the instruction following the MOVE instruction That is the assembler
35. Float Jumper settings for the 80535 a Jumper settings for the 80C535 and the PE SWD __ HWPD vcc GND v r O Q 2 lt gt 80C515A PE _ HWPD V ND lt GI Jumper settings for the 80C517A The other pin assignment differences namely the VBB VCC pin 37 of the 80535 family and the OWE input of the 80537 family of microcontrollers are addressed by jumpers on the respective daughter boards 7 4 3 Analog to Digital Converter Reference Voltages The RMB S board contains 4 two post jumpers labeled VAREF VAGND TXD AUX and RXD AUX Jumpers VAREF and VAGND when installed provide 5 volt and 0 volt reference 18 voltages to the microcontrollers analog to digital converters When external reference voltages are to be used remove these jumpers and connect the reference voltages to the posts on the solderless terminal strip XD AUX XD AUX Cor n 8 SEPEII 7 4 A D and AUX Jumpers The jumpers TXD AUX and RXD AUX when installed connect the second serial port of the 80517 transmit and receive signals P6 2 and P6 1 to the auxiliary serial port driver If port bits P6 1 and P6 2 are to be used as general purpose input output ports these jumpers should be removed 7 5 Memory Configuration 7 5 1 8051 Memory Overview The 8051 family of microcontrollers address 64 kilobytes of program memory and 64 kilobyt
36. INTDSPY LED8 LM7805 LM7805 27256 27256 27256 27256 74LS00 74LS32 2 Header 2 Header DB 9 Female DB 9 Female 9 Gang Resistor 9 Gang Resistor Potentiometer Potentiometer Potentiometer Potentiometer 1 2 Watt 1 2 Watt 1 4 Watt DIP Switch 3 Header 3 Header 3 Header 3 Header 3 Header 3 Header Slide Switch DPDT Siemens SLR 2016 8 Bar Display Voltage Regulator Voltage Regulator SYSTEM EPROM or 62256 RAM or 62256 RAM or 62256 RAM xxiii SOCKET SOCKET PIO PIO PIO PIO SERIAL SERIAL PAD SERIAL SERIAL PAD PAD PAD PAD PAD PAD PAD PAD DECODE PAD PAD PAD PAD PAD PAD PAD PAD PAD MEMORY MEMORY MEMORY MEMORY MEMORY MEMORY MEMORY PAD PAD POWER POWER MEMORY MEMORY MEMORY MEMORY MEMORY DECODE BAAAAARANYMONNNNNNNNANNNNNNNN OO ON N U11 74HCT573 CPU U12 MAX232 SERIAL RMB S Board Layout Revised October 27 1993 Revision 1 2 DA40 DA44 DA68 DA84 Board Layouts Revised October 27 1993 Revision 1 2 APPENDIX K BOARD LAYOUT XXV APPENDIX L SYSTEM AND CIRCUIT DIAGRAMS
37. IX SAMPLE PROGRAM CIRCUIT DIAGRAMS nana XVIII APPENDIX I RMB S BOARD HEADER anneanne nunnan nnana XXI APPENDIX J BILL OE MATERIALS aaa aa aa r a adaa XXII APPENDIX K BOARD LAYOUT rente hoec itae XXV APPENDIX L SYSTEM AND CIRCUIT DIAGRAMS ua2aaaaanaaavannaa nunnanannnananunannunnnnunnunannnunannnannnnnannnan annan nnns XXVI 1 INTRODUCTION 1 1 Overview The RMB S prototyping board and READS Rigel s Embedded Applications Development System constitute a complete system for developing embedded control applications Efficient software development and rapid hardware prototyping are combined in a single integrated de velopment environment The prototyping board is designed to communicate with a PC IBM PC or compatible acting as a host The host to board communications are carried out through a serial port 1 or COMO The host based development system READS is a menu driven environment with an editor assembler debugger and PC to board communications software The ROM Resident Operating System RROS includes an operating system a monitor system and user accessible system calls for control and communication support The RROS monitor may be used to communicate with an ASCII terminal when the PC IBM PC or compatible host is unavailable R
38. MB S uses daughter boards to accommodate a wide variety of 8051 microcontrollers The daughter boards accommodate the following of pin configurations DA84 for Siemens 80517 family in 84 pin PLCC format DA68 for Siemens 80515 family in 68 pin PLCC format and DA44 for the 8052 family in 44 pin PLCC format including the new INTEL chip the 80C251 and the DA40 for the 8052 family in the 40 pin dip package The instruction set of these microcontrollers are supersets of the MCS 51 instruction set The RMB S uses external RAM during the development cycle Once an application program is developed it may be perma nently placed in EPROM With an application specific program installed the RMB S may be used to emulate an embedded controller Prototyping components consisting of push buttons dip switches light emitting diodes LED numerical displays potentiometers and a speaker are used for emulating control application inputs and outputs These components are referred to as the User Input Output Devices UIOD There are two solderless breadboard terminal strips one connected to the prototyping components and the other to the microcontroller ports and control lines plus a large solderless breadboard These provide flexibility for connecting prototyping components to the microcontroller lines and for developing and debugging user designed analog and digital application circuits The source code of the user accessible systems calls is provided These rou
39. NT BE LIABLE FOR DAMAGES CAUSED BY USE OR PERFORMANCE FOR LOSS PROFITS PERSONAL INJURY OR FOR ANY OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RIGEL CORPORATION S LIABILITY SHALL NOT EXCEED THE COST OF REPAIR OR REPLACEMENT OF DEFECTIVE ITEMS IF THE FOREGOING LIMITATIONS ON LIABILITY ARE UNACCEPTABLE TO YOU YOU SHOULD RETURN ALL ITEMS PURCHASED TO RIGEL CORPORATION Board Kit If you are purchasing a board kit you are assumed to have the skill and knowledge necessary to properly assemble same Please inspect all components and review accompanying instructions If instructions are unclear please return the kit un assembled for a full refund or if you prefer Rigel Corporation will assemble the kit for a fee of 100 00 You shall be responsible for shipping costs The foregoing shall apply only where the kit is un assembled In the event the kit is partially assembled a refund will not be available however Rigel Corporation can upon request complete assembly for a fee based on an hourly rate of 50 00 Although Rigel Corporation will replace any defective parts it shall not be responsible for malfunctions due to errors in assembly If you encounter problems with assembly please call Rigel Corporation at 904 373 4629 for advice and instruction In the event a problem cannot be resolved by telephone Rigel Corporation will perform repair work upon request at the foregoing rate of 50 00 per hour Governing Law This agreement and all rights of
40. PPENDIX B HEADS EDITOR 1 IV Bil READS51 EDITOR OVERVIEW salta ur dte p Heated E heeded a ed ae IV 2 DUETE AANE R ERS IV B 2 Edit Menuiserie qm the ee n Itti eerte tee iv B e eid lea V B 2 3 WIndOW iiie Ie ees Np s k iii f ition te V 2 4 Navigatore He deine V MISCELLANEOUS EDIT AND NAVIGATION 5 ATA S R R VI THIGHEIGHTING TEXT staa Et VI B 4 1 Highlighting the Current vi B 4 2 Highlighting a Block of Characters aaaaaaaaaaa asvaasnnnssnnnnnnasannsnnnsnnannnannnannnannaannaanaaansanaanaaannaanaaa vi 4 3 Highlighting a Block or Eines err ie ete vi APPENDIX C GENERAL PURPOSE ROUTINES SYSTEM CALLS Vill APPENDIX D HOW BREAKPOINTS ARE HANDLED XII APPENDIX E HOW TRACING IS HANDLED XIV APPENDIX F DEBUGGING WITH AN ASCII nnn XV APPENDIX G THE SOFTWARE DEVELOPMENT CYCLE XVI APPEND
41. RMB S READS User s Guide Version 1 2 July 1998 HiGEL CORPORATION PO Box 90040 Gainesville FL 32607 352 373 4629 FAX 352 373 17106 www rigelcorp com Copyright C 1998 by Rigel Corporation All rights reserved No part of this document may be reproduced stored in a retrieval system or transmitted in any form or by any means electronic mechanical photocopying recording or otherwise without the prior written permission of Rigel Corporation The abbreviation PC used throughout this guide refers to the IBM Personal Computer or its compatibles IBM PC is a trademark of International Business Machines Inc Warranty RIGEL CORPORATION CUSTOMER AGREEMENT 1 Return Policy If you are not satisfied with the items purchased prior to usage you may return them to Rigel Corporation within thirty 30 days of your receipt of same and receive a full refund from Rigel Corporation You will be responsible for shipping costs Please call 904 373 4629 prior to shipping A refund will not be given if the READS package has been opened READS License The READS being purchased is hereby licensed to you on a non exclusive basis for use in only one computer system and shall remain the property of Rigel Corporation for purposes of utilization and resale You acknowledge you may not duplicate the READS for use in additional computers nor may you modify disassemble translate sub license rent or transfer electronically the READS fr
42. SYSTEM 28 Serial Communication Chkbrk ee ect o ende ee iene ets 28 9 5 SYSTEM VARIABLES cc niter nei Lee LED lon devel PEL 29 9 6 THE INTERR PT VECTOR TABLE aene pic dyes aee eaae ace v ea eiu ee devil ao ne Tus 31 LUNES Baurecht 32 10 1 BASICS OF DIGITAL INPUTS AND OUTPUTS 2uaaaaaaaaaaaaaaaansanasaansaansaansaannaannaannnannannnnannnnnnnnnnnnnnnnnunnnnnnannnnisnaisaai 32 10 2 A KEYLESS ENTRY DIGITAL UNLOCK SYSTEM aaaaaaaaaaaaaasaaanaaananannnannnannnnnnnnannnannnnnnnnnnnnannnanaaanaaanaaanaaanaaanaanaa 33 10 3 USING SUBROUTINES rte eb ee ate hola auk Edna a cbe eeu aa dened aver eal 34 10 4 USING THE SLR2016 INTELLIGENT DISPLAY 34 10 5 RUNNING 34 10 6 USING INTERNAL TIMERS Gorni eaea lg 34 10 72 USING INTERRUPTS 34 10 81 5c ei eere eene V goce rae eg 35 10 92 A 0 5 VOET VOETMETER ey Sn nit b eet or n dir lae ivre here 35 10 10 WORKING WITH FRACTIONS AN IMPROVED VOLTMETER eene nenne ennemi nennen nnns 35 10 11 MEASURING REAGTI N TIMES sla dbask sdskva asss
43. T VPD input to the microcontroller is connected to the HWPD line Although the 8052 microcontrollers do not have the HWPD input this arrangement allows the RST VPD input to be selected by the 3 post jumper on the mother board or by external application circuitry Note that the HWPD input is available on the solderless terminal 7 7 4 The DA40 Daughter Board The DA40 daughter board accommodates the 8052 family of microcontrollers in the 40 pin DIP format It contains a reset button and a single two post jumper labeled EA Jumper EA when installed connects the External Enable input to GND thus allowing external program memory to be fetched This jumper must be removed when an 8052 with internal ROM such as the 83C51 or the 8052AH BASIC from INTEL is used 22 8 THE READSS1 ASSEMBLER When the assembly is successful three files are automatically created or rewritten in the default directory They are the hex file with extension HEX the error file with extension ERR and the map file with extension MAP All three files have the same file name as the source file These files are text files and can be viewed and modified in the editor The hex file contains the generated machine language code in the INTEL Hex format This file when downloaded will be converted into true machine language code by the RROS the ROM resident firmware READS calls ASSEMBLER to assemble source code in the editor The assembler may also be used off line ASSEMBL
44. The intelligent display control inputs CL BL A1 and WR are available on the terminal The data inputs to the intelligent display are shared with the seven segment display high digit U1 is not normally populated As asimple demonstration connect LO to PBO Observe that LED 0 lights when push button PB 0 is pressed 7 2 Microcontroller Ports All microcontroller ports except those used to access external data and program memory are available on the 54 post solderless terminal strip located above the breadboard The posts in the order they appear are listed below BREADBOARD Figure 7 2 JP12 Microcontroller Ports GND is the power ground 0 Volts RO is the Reset Out line of the microcontroller HWPD is the Hardware Power Down line of the microcontroller PE is the PE SWD Power saving modes Enable Start WatchDog timer line of the microcontroller PSEN is connected to the PSEN Program Segment Enable pin of the microcontroller This is an output signal requesting external program memory during an in struction fetch cycle ALE is connected to the microcontrollers ALE Address Latch Enable pin This is an output signal used while accessing external program or data memory When set it indicates that Port 0 contains the lower 8 bits of a valid address P3 2 P3 5 are connected to the corresponding bits of Port 3 Notice that other bits of Port 3 are used as control lines to access external memory or as serial communic
45. aannaannaa 23 8 1 2 Incorrect Symbol or 23 8 1 3 Incorrect Operand nati ite Ere drea po caddies ees 23 8 1 4 Attempt to Branch Out of 23 8 1 5 Unresolved Operand s eite sakta kall a aa uga vaj S e Bygt g ma Baa Tata SERRE acs 23 8 1 6 rere rre oe a RR RRR RRR A 23 8 1 7 Op rand s Out of Range 5 av fh le eei dere he fee dee ar d 23 8 1 8 x Incorrect Operand ceu echte er tee ect ghs e peser rg eit uer 24 8 1 9 Ineorrect Register USG ecu ede e eta ege ite t e E patera ete a ut eerta eee EUER 24 8 1 10 IrnicorreCE Constable ep eap ka ead rade p HERR l n aa 24 8 1 11 Odd or Out of Range Address essen ena tritani trenta tha tatnen tha 24 8 1 12 Undefined DO osa Ru 24 9 RROS THE ROM RESIDENT OPERATING SYSTEM 25 9 16 THE INITIALIZATION ROUTINE oth dee eda ar ae viii co dde ue bue d re dads 25 9 2 THE COMMAND PROCESSOR vi ag tede cpu dese aetna ea qu Reduce pet a ddr eee 25 9 3 DEBUG FUNCTIONS m E M 27 9 4 GENERAL PURPOSE ROUTINES
46. ad in your system Follow the standard install directions answering the questions with the appropriate answers This user s manual is for the WIN95 NT version of the software The DOS User s Manual can be found on the CD ROM 2 3 Start up If you purchased a built RMB S board it is already set up to run the demo programs The following are the factory settings Memory 1 The RROS EPROM in U5 Jumper SEP removed 2 A 32K RAM 62256 U6 The two jumpers configured as RAM right position U7 and U8 not used by the demo programs If populated place jumpers to specify either RAM or EPROM devices Slide switch S16 should be in the MON ITOR position USER MON aux aux J O R 27 256 ESET R vec 0 Remove for Figure 2 1 Default Jumper Settings with the 80C535 Processor Jumpers in VAREF and VAGND populated These are used for the analog to digital converters The settings of jumpers PE SWD and HWPD depend on the processor used For the demo programs use the following settings Jumper 800535 SWD GND HWPD Removed 2 4 Daughter Board Jumpers The jumper on the daughter boards depend on the processor used Always populate the EA jumper to enable fetching external code DA68 80C535 CMOS insert all jumpers 1 Run the READS51 host driver by selecting Start Programs READS51 You may also start READS51 by double click
47. alog window off and on A 6 Options There are three commands in the Options menu The PC Timeout Options allows you to select time outs and whether to terminate the compiler after use The Compile Options allows you to select the processor you are working with The TTY options allows you to select the COM port and Baud rate A 7 Window The Window command allows you to select how the READS51 windows will appear A 8 Help This command invokes the READS51 Help system APPENDIX B READS EDITOR B 1 READS51 Editor Overview The Reads Editor implements a standard text editor with menus and controls familiar to most Windows applications The menu items and the actions taken by them are described below The Reads Editor is a stand alone application It is a part of the Integrated Development Environment IDE In some cases the IDE automatically opens the editor for example to display a break point during a debug session The Reads Editor is more than just a text editor Its behavior depends on the current state of the IDE as listed below IDE State Reads Editor Tasks Writing code Text editor keyword help Compiling assembling Show errors Debugging Show current step In addition the Reads Editor supports a local popup menu activated by clicking the mouse right button within the editor All editor tasks and links such as building the current project or clearing all breakpoints during a debug session may be initia
48. am L G Debug B K Miscellaneous H 25 The list of monitor commands is displayed with the H command while the monitor program is in effect The H command displays the following table sets Break point at address xxxx displays Code memory displays internal Data ram xx nn modifies internal Data ram XX Xxx nn fills a block of internal Data ram XXXX Go starts executing at address xxxx Help displays monitor commands Kills removes break point down Loads Intel hex file into memory displays data on Port x x nn modifies data on Port x to nn displays the contents of the Registers displays Special function register addresses XX XX displays Special function registers xx nn modifies Special function registers XX Xxx nn fills Special function registers XXXX XXXX displays eXternal memory modifies eXternal memory fills eXternal memory VAND x A single letter command may be followed by up to 3 parameters The parameters must be entered as hexadecimal numbers Each x above represents a hexadecimal digit characters 0 9 A F Intermediate spaces are ignored Alphabetic characters are converted to upper case The length of the command string must be 16 characters or less The command syntax is Letter address address data
49. ands Toolbar Status Bar Status Ribbon Font 8 pt Font 10 pt Font 12 pt Tab Size 2 chars Tab Size 3 chars Tab Size 4 chars Tab Size 5 chars Tab Size 6 chars B 2 3 Window Cascade Tile Arrange Icons Next Window B 2 4 Navigate Displays a set of icons at the top of the editor window These are shortcuts to the more often used menu commands Currently the toolbar includes the following shortcuts File New File Open File Save Cut Copy Paste Print and Help Displays a bar at the bottom of the editor window which shows the current line and column It also displays the status of the following keys Overwrite CapsLock and NumLock The status ribbon is an alternative form of the status bar Selects the smallest fonts Selects the medium size fonts Selects the largest size fonts Selects smallest tab size Selects medium tab size Selects medium tab size Selects medium tab size Selects largest tab size Arranges all editor windows in a cascade fashion Tiles all editor windows This is especially usefult to view two files simultaneously You may arrange the minimized edit windows neatly by this command Navigation commands move the caret within the text file Although many of the navigation commands are available from the menu in most cases the hot key combinations are more convenient For example use Ctrl Home to bring the caret to the beginning of the file In addition to the menu commands listed belo
50. ation lines P3 0 and P3 1 are the receive and transmit lines for the RS 232 serial communications port linking RMB S to the host PC P3 6 and P3 7 are the read RD and write WRY lines 15 TXD is connected to the transmit line of the RS 232 port connected to the host RXD is connected to the receive line of the RS 232 port connected to the host P7 0 P7 7 are connected to the bits of Port 7 P4 0 P4 7 are connected to the bits of Port 4 P6 0 P6 7 are connected to the bits of Port 6 P5 0 P5 7 are connected to the bits of Port 5 P1 0 P1 7 are connected to the bits of Port 1 VAGND is connected to the microcontrollers VAGND pin It provides the lower reference voltage to the analog to digital converter A jumper labeled VAGND when in stalled connects VAGND to the power ground GND If a reference voltage other than 0 Volts is desired the jumper should be removed and the new reference voltage should be supplied at the VAGND post VAREF is connected to the microcontrollers VAREF pin It provides the higher reference voltage to the analog to digital converter A jumper labeled VAREF when in stalled connects VAREF to 5 Volts regulated by a separate voltage regulator If a reference voltage other than 5 Volts is desired the jumper should be removed and the new reference voltage should be supplied at the VAREF post P8 0 P8 3 are connected to the bits of Port 8 vcc is the 5 Volt supply V1 is the unregulated voltage from the
51. bove this address If the board is to emulate an autonomous embedded controller rather than branching to the monitor program at reset control is given to an application program In this case the starting address of the application program is placed at locations 480h and 481h 481h containing the high byte of the start address If this address is FFFFh the initialization routine branches to the monitor If this address is 0000h the next word at locations 402h and 403h is checked Similarly if this word contains an address other than FFFFh or 0000h a long jump is made to that address This convention allows an auto exec routine to be installed by placing its starting address at 401h 400h or removed by placing 0000 at 401h 400h Once zeros are burnt into the EPROM a new autoexec routine may be installed by placing its starting address at 403h 402h This allows for up to 64 such installations since ROM locations 480h to 4FFh are set aside for autoexec routine addresses 30 9 6 The Interrupt Vector Table The 8032 80535 and 80537 have 6 12 and 14 interrupt sources respectively Each inter rupt source when acknowledged causes a long jump to a fixed location in code memory The address of this location is referred to as an interrupt vector The interrupt sources and the corresponding vectors are listed below The interrupt vectors point to low ROM addresses The RMB S redirects these interrupts by placing long jump instructions at the
52. e interrupt ser vice routine isrIEO is written and placed in memory In order to direct IEO to its service routine the instruction 1jmp isrIEO is placed in the interrupt vector table starting at location FFOOh Although the interrupt service routine address may be placed in the vector table by move instructions it is more convenient to use the system call setintvec Setintvec is invoked after placing the interrupt service routine address in dptr and the interrupt source from 0 to 11 in the accumulator 31 10 SAMPLE PROGRAMS 10 1 Basics of Digital Inputs and Outputs It was mentioned in Section 3 1 that LED 0 can be lit or turned off by connecting LO to PBO and pressing or releasing push button 0 Now consider the following experiment Connect LO to P4 0 and PBO to P4 1 Assemble the following very short program org 8100h run using the monitor G8100 command setb P4 1 prepare P4 1 for input loop mov C P4 1 read the state of PBO and store in the Carry flag transfer PBO status to LEDO loop forever mov P4 0 C sjmp loop lt Ne Ne This program illustrates the Boolean bit oriented capabilities of the MCS 51 family of pro cessors Notice that all bit transfers use the carry flag The program also illustrates that digital inputs are sensed only when the port bit is set and the input signal sinks or pulls down the port bit see the microcontroller manufacturer s data book for details on internal port
53. e is concerned with monitoring the health of the system and error recovery Code understandability is enhanced with a clear programming style combined with the liberal use of comments nested in the code Code modifiability is usually achieved by structured programming practices Structured programming refers to the organization of software in a hierarchy of modules and subroutines The lowest level subroutines should be small and general purpose These sub routines will normally be used by higher level routines Each higher echelon of routines be comes more specific to the application The sample software and system calls constitute a good starting point for structured programming The software development cycle can be broken down into the following steps Establish software requirements There are two important questions to be answered in this step what will software do and how will it do it The answers provide the basis of subsequent software design Preliminary design A good approach to preliminary design is to partition the problem into relatively independent subproblems Such modularization leads to a reduction in code complexity to better code un derstandability to easier code modifiability to more efficient system testability Moreover such modularization yields the key data structures to be used A hierarchical chart should be developed which shows the place of each module in the system as well as the module calling conventions S
54. ed by placing many of the specific commands into sub menus The Main Menu contains the higher level options such as projects modules or tools The major tasks are delegated to the READS51 Tools which includes editors and host to board communications subsystems Tools are distinguished by their own environments including sub menus and accelerator keys Tools may be minimized when not used or simply closed until needed again Reads51 no project OL x Project Module Compile View Tools Options Window Help 2 Project Projects are collections of source code modules that are compiled as a whole Use the project menu to create New projects Open existing projects Close projects select project Options and save projects The Exit command is also under the menu Project option The use of projects is optional in READS51 It is meant to simplify the bookkeeping of the various components of larger code For short programs it is often more practical to simply write the code in the text editor and compile it without first creating a project The Project Window is the space just under the Main Menu If a project is currently open a list of modules of the project is displayed You may use the scroll bars to view the module list A 2 Module A module is a single file which belongs to a project Typically modules are assembly language subroutines You may copy
55. es of external data memory The microcontroller may read from both external data memory and external code memory using the movx and movc instructions The microcontroller may write to external data memory but may not write to external code memory It is possible therefore to have up to 128 kilobytes of external memory The microcontroller pin Program Segment Enable PSEN is activated made logic 0 when a byte is to be read from external program memory and pin Read RD when a byte is to be read from external data memory By combining these signals by an and gate PSEN AND RD the same physical 64 kilobyte memory block is made to appear as both external code and data memory The default RMB S configuration overlaps external data and code memory blocks by combining PSEN and RD in this manner That is code may be written to the single overlapping 64 kilobytes of external memory as data and then executed as code This allows down loading and running programs on the RMB S 7 5 2 RMB S Memory Options RMB S has four 28 pin sockets U5 U6 U7 and U8 labeled P L P H XD L and respectively Socket U5 accepts 27256 EPROMs The other three sockets may hold either 27256 EPROMs or 62256 static RAMs That is each socket holds 32 kilobytes of memory Socket U5 labeled P L is mapped as the lower half of program memory i e 0 7FFFh Socket U6 P H holds the higher half of program memory 8000h FFFFh Similarly sockets U7 XD L and U
56. executable program An archive project is a collection of modules that are grouped together to make retrieval from storage easier We will first create an executable project We will explain creating archive projects in a later section 4 1 Creating an Executable Project 1 Select Project New Executable 2 A New Project box wil SPSI M Project Hardware 3 In the Name Dir box Name Dir T utor a type You Type Executable Board 531 also browse the available selections by clicking on the hand icon and looking in the work directory 4 Select the processor and board you are using in the HW Configuration boxes 5 Click OK 6 Click Yes to A directory with that name exists Do you want to use it 7 A project window box will open which shows represented as the root of a tree Next we will add a module to it 4 2 Adding a Module A module is a block of code which is saved in a single source file To add a module to the executable project TUTOR1 RPJ make sure that the project window is open If the project window is not open select Project Open Executable and double click on TUTOH 1 RPJ Now you can add a module Properties Type Filename 77 Type 73 1 Select Module Add Language Module A New Code Name Assembly Module window will Main module Editor Code generator Text
57. fraction to its BCD binary coded decimal equivalent If the above circuit is to be used set the constant range to 15 decimal OFh The program Vmeter2 asm simply multiplies the range with the digital value The high byte of the 16 bit result is the integral part of the voltage and the low byte the fractional part 10 10 Working with Fractions An Improved Voltmeter The program Vmeter3 asm further elaborates the voltmeter to have a range which is not necessarily an integer For example if in the voltage divider given above R1 22 Kilo Ohms and R2 6 8 Kilo Ohms then the full range of the voltmeter is 5 R1 R2 R2 21 18 The two single byte constants Rint and Rfrc define the integral and fractional parts of the range For 21 18 Rint is 21 decimal or 15h and Rfrc 18 decimal or 2Eh 18 100 46 256 and 46 decimal 2Eh The program Vmeter3 asm needs to multiply the 8 bit digital value with a 16 bit range Let the range R and the voltage being measures V be broken down to their integral and fractional parts as R Rint Rfrc 256 V Vint Vfrc 256 where Rint Rfrc Vint and Vfrc are 8 bit numbers Let n be the 8 bit digital value of analog signal The voltage is then V R n 256 n Rint Rfrc 256 256 35 Let N n Rint Rfrc 256 the numerator of the above expression so that V N 256 Note that n Rint and n Hfrc are 16 bit numbers Then 256 N 256 n Rint n Rfrc is 24 bit number Suppose 256 N is
58. hdog Enable input to ground disabling the watchdog timer This jumper may be removed provided that the software updates prevents the watchdog timer from overflowing 7 7 2 DA68 Daughter Board The DA68 daughter board accommodates the 80515 family of microcontrollers in the 68 pin PLCC format It contains a reset button and two post jumpers labeled EA VBB and HWPD Jumper EA when installed connects the External Enable input to GND thus allowing external program memory to be fetched This jumper must be removed when an 80515 with internal ROM is used The jumper VBB when inserted connects pin 37 to VCC This is the setting used with the CMOS devices When the 80515 80535 is used remove jumper VBB to connect pin 37 to GND through a 47nF capacitor The last jumper labeled HWPD when installed inserts a by pass capacitor between pin 68 and GND Insert this jumper if pin 68 is used as a VCC input i e with the 80515 80535 80C515 80C535 and remove if a 80C515A is used and the HWPD input is provided by external application circuitry 7 7 3 The DA44 Daughter Board The DA44 daughter board accommodates the 8052 family of microcontrollers in the 44 pin PLCC format It contains a reset button and a single two post jumper labeled EA Jumper EA when installed connects the External Enable input to GND thus allowing external program memory to be fetched This jumper must be removed when an 8052 with internal ROM is used 21 The RS
59. ic erue ee terne eee ue eene e ene rn au eee ee eni aee 17 7 4 2 Jumper Selectiori uro ge Aw ne ite elo eae de ge Vague aeo sue eee pn reg een diane dcus 17 7 4 3 Analog to Digital Converter Reference Voltages sse enne 18 1 5 MEMORY CONFIGURATION s pite de Certo dn eco e Eee REY Ra e k ERE Tas 19 7 5 1 8051 Memory OVelVIGW c iiia cei eden adc crane d etre Hau re bdo ud eR ni debe 19 7 5 2 RMB S Memory 20 7 5 3 Memory Jumper 20 7362 SYSTEM Soi Deut DNA aa 20 77 THE DAUGHTER BOARDS aer edt eee ae 21 7 77 1 DA84 Daughter 21 77327 he dDAes Daughter Board dere ER EE ae ER e 21 7 7 3 The DA44 Daughter Board ite e ete mette es 21 7 7 4 The DA40 Daughter Board oic eerte Heat averse beseitigen 22 THE READS51 ASSEMBLER eric ada e ca Eae c Cedo Ra aS e raa 23 GASSEMBLY ERRORS IK 23 8 1 1 Attempt to Redefine Symbol or Label aaaiaaiaaaiaaasnaassaasnaassnasaansaannaannaannaannannnannnannnnannsanns
60. ing on the READS51 short cut icon if installed 2 5 Configuring READS51 and Initiating Host to Board Communications ar Reads51 no project Project Module Compile View Tools Options Window Help mona Sk 1 Press the Projects New Executable new project window will open where you select the board and processor you are using 2 Select the communication port parameters using the Options TTY Options menu command You will need to select the COM port you are using and the baud rate Project Hardware Name Dir Processor es wecutable v Board Ran 3 Open the TTY window using the Tools TTY menu command d Reads51 no project B x Project Module Compile View Tools Window Help E PC timeout options S hi E y Compile options A TTY options 4 You can confirm the board is working by pushing the reset button on the board The TTY Options x COH Port coma Baud Rate 9600 Cancel Help appropriate processor should show the TTY window 8031 8032 will show 8052 5 monitor program 80C535 will show 80515 monitor program itm TY Disconnected Iof X 80515 monitor program 2 6 Verifying that the Monitor is Loaded Make sure the TTY window is active clicking the mouse inside the TTY window to activate it if necessary Then type the letter H case i
61. ingle letter command may be followed by up to 3 parameters The parameters must be entered as hexadecimal numbers Each x above represents a hexadecimal digit characters 0 9 A F Intermediate spaces are ignored Alphabetic characters are converted to upper case The length of the command string must be 16 characters or less The command syntax is Letter address address data lt CR gt READS51 V 3 00 CONCEPTS READS51 introduces a project oriented code development and management system The new concepts are defined below 3 1 Project A project is a collection of files managed together Each file in a project corresponds to a code module All projects are kept in their individual subdirectories You may copy or save projects as a single entity When saved under a different name a new subdirectory is created and all components of the project are duplicated in the new subdirectory By using the long names provided by the 32 bit Windows operating systems you may use this feature to keep different versions of your software in a controlled manner For example the project Motor Control 07 20 1997 may be saved under the name Motor Control 07 25 1997 as new features are added This way if needed you may revert to an older version A project may either be an executable project or an archive project 3 1 1 Executable Projects Executable projects are meant to be compiled into code which is eventually
62. lay routine is running the CPU is otherwise unproductive It seems that spending the processors time on simple timing is somewhat of a waste of resources The program RunLgts2 asm introduces interrupt driven timing operations Timer 1 is initiated to operate as a free running timer inter rupting the processor each time it overflows RunLgts2 asm also uses the subroutine rlights 10 7 Using Interrupts As seen in the above example RunLgts2 asm interrupt driven subroutines are especially useful when hardware such as a timer or an analog to digital converter ADC runs independently of the processor and requests the processor s attention only after it has completed its task In such an arrangement the timer or the ADC may be viewed as undertaking a background process In fact since the timer or the ADC contains all necessary hardware the arrangement is really a simple form of parallel processing The program RunLgts3 asm implements the analog to digital converter to issue interrupts when the conver sion is completed The interrupt service routine places the digital output of the converter into an internal ram location This value is used to time the rotation of the lights In order to run RunLgts3 asm connect the potentiometer POTO to the port P6 0 of the 80535 or port P7 0 of the 80537 34 10 8 A Simple Voltmeter This example implements a simple voltmeter using the 80535 or 80537 analog to digital converter TLet the voltmeter have a range 0
63. ll 38 12 SOFTWARE VENDORS We have a list with approximatly 40 50 software vendors on it If you would like to receive the complete list please call us and we will FAX it to you We have worked with the following companies and their software and found that it works well with our boards FUZZY DEBUGGER SIMULATOR RTOS VENDOR LOGIC A M Research BSO Tasking X CMX Co E S P Franklin X Software Inc KEIL X M C C X Rigel Corp X Systronixs RTOS stands for Real Time Operating System A M Research 4600 Hidden Oaks Lane Loomis CA 95650 9479 Telephone 916 652 7472 www amresearch com BSO Tasking 333 Elm St Norfolk Pl Dedham MA 02026 Telephone 800 458 8276 www tasking com Co 19 Indian Head Heights Framingham MA 01701 Telephone 508 872 7675 www cmx com Embedded Systems Products 11501 Chimney Rock Houston TX 77035 Telephone 800 525 4302 www rtxc com Franklin Software Inc 888 Saratoga Ave 2 San Jose CA 95129 Telephone 408 296 8051 www fsinc com Keil Software 214 735 8052 www keil com Micro Computer Control P O Box 275 17 Model Ave Hopewell NJ 08525 Telephone 609 466 1751 www mcc us com Rigel Corporation P O Box 90040 Gainesville FL 32607 Telephone 352 373 4629 BBS 352 377 4435 www rigelcorp com Systronix Inc 754 E Roosevelt Ave Salt Lake City Utah 84105 Telephone 801 487 7412 www systronix com 39 13 BIBLIOGRAPHY
64. lt CR gt For example the monitor command X 9201 will display the contents of external memory location 92C1h The command X 92C1 92CF will display the contents of consecutive memory locations from 92C1h to 92CFh Similarly the command X 92C1 92CF 3F will modify the contents of the memory locations from 92C1h to 92CFh inclusively to 3Fh The contents of these memory locations may be verified to be 3Fh by the command 92 1 92 26 The C command is identical to the X command except that code memory is displayed not ex ternal data memory Also in the MCS 51 architecture writing to code memory is not allowed If code and external data memory banks are overlapping then code memory can effectively be modified by the X command Overlapping external data and code memory banks is the default architecture of the development boards The C command is only useful if the code and external memory banks are jumper selected to be non overlapping see Section 4 3 The D command is similar to the X command It displays or modifies internal RAM memory The 8031 contains 128 internal RAM locations and the 8032 256 internal RAM locations No tice that in this case the memory addresses are limited to 2 hexadecimal digits The P command allows viewing or modifying the current state of the processor ports Viewing the state of a port is equivalent to reading the port as an input port Modifying the port con tents outputs a byte to the por
65. m the user when READS is used The H command displays the help screen summarizing the available monitor commands 9 3 Debug Functions Debugging a program which has been loaded in RAM may be accomplished by the monitor functions B and K However the powerful debugging environment of READ is in most cases the preferred way to debug programs Debugging a program through the use of monitor commands is initiated by selecting a break point in the program The command B followed by the address of the break point sets the break point The break point should be placed at the first byte of an instruction The break point may only be placed at a RAM location The K command removes or kills the break point 27 RROS provides minimal debugging utilities through a submenu when an ASCII terminal is be ing used See Appendix A 4 for the RROS debugging submenu Debugging utilities constitute a major portion of RROS There are two basic modes of debugging setting break points and tracing sometimes referred to as single stepping Each of these modes have advantages and disadvantages Debugging is geared more toward software development In terms of hardware debugging although the debugger offers much help it cannot track real time operation issues such as external hardware interrupts Such situations call for an in circuit emulator See Appendices C and D for more information on how debugging is performed by RROS 9 4 General Purpose Routines System
66. main power supply about 12 Volts V2 is the unregulated negative supply from the MAX232 chip about 10 Volts GND is the power ground 0 Volts As ademonstration connect the posts TXD and RXD to LO and L1 Observe the state of LO and L1 while RMB S and the PC host communicate for example during issuing various monitor commands Recall that the LEDs will light when the TXD and RXD signals are low This arrangement is useful to verify that serial communications are operational 7 3 Chip Options The RMB S prototyping and evaluation board accommodates the 8051 family of microcontrollers The microcontrollers are placed in daughter boards which are plugged in to the RMB S This configuration allows the same motherboard to be used with a wide variety of 8051 family products The following is a partial list of microcontrollers which may be used with the RMB S 8031 80631 8032 80C32 83C51 83C52 87C51 87C52 8052AH BASIC and 80C251 from INTEL 80C320 from Dallas Semiconductor 80535 80515 80C535 80C515 80C515A from Siemens 80C537 80C517 80C517A also from Siemens 16 SAB C500 series from Siemens 7 4 80515 80517 Family Options 7 4 1 Pin assignment The following tables summarize the pin assignment differences among the 80515 and 80517 families of microcontrollers The sign indicates that the associated signal is active low Available on Terminal VPD PE PE SWD Yes 37 VBB VCC VCC No 68 VCC VCC HWPD Yes Pin 80535
67. nd Program Reset are basic features that implement the stated command The Run command runs the downloaded program on the target board A 4 View The View menu commands allow the user to watch the variables and breakpoints as the program is debugged The Watches menu command also allows you to select the variables that you wish to watch Code Memory Data Memory Internal Memory Ports and SFR let you view edit stated parts of the memory A 5 Tools Tools are the powerful subsystems that let you carry out complicated tasks Tools usually have their own menus and hot key combinations Currently the following tools are available Editor TTY Assembler Project Compile Errors A 5 1 Editor The Editor is a multi document interface which holds small text files The editor has its own menu with the standard File Edit and Navigate commands The user interface and hot key combinations are identical to the MS Windows Notepad program A 5 2 TTY The TTY Window encapsulates all host to board communications It has its own menu to set the communications parameters to bootstrap the board and to download compiled programs into the RAM of the board A 5 3 Assembler Opens up the assembler so that you can also assemble individual files A 5 4 Project The Project selection toggles the Project window open or closed A 5 5 Compile Errors Selecting the Compile Errors command toggles the READS Error Di
68. nsensitive to verify that the monitor program is responding The H command displays the available single letter commands the monitor will recognize The READS monitors use single letter commands to execute basic functions Port configurations and data as well as memory inspection and modifications may be accomplished by the monitor Most of the single letter commands are followed by 4 hexadecimal digit addresses or 2 hexadecimal digit data bytes The list of monitor commands is displayed with the H command while the monitor program is in effect The H command displays the following table sets Break point at address xxxx displays Code memory D displays internal Data ram D xx nn modifies internal Data ram D xx xx nn fills a block of internal Data ram G Go starts executing at address xxxx H Help displays monitor commands K Kills removes break point L down Loads Intel hex file into memory 5 P x displays data on Port x P x nn modifies data on Port x to nn R displays the contents of the Registers 5 displays Special function register addresses 5 XX XX displays Special function registers S xx nn modifies Special function registers S xx xx nn fills Special function registers displays eXternal memory X xxxx nn modifies eXternal memory X xxxx xxxx nn fills eXternal memory A s
69. ode in line 18 and Line 18 in the READS Editor will be highlighted 7 In the READS Editor correct line 18 by removing the e we added 8 Right click and select Build in the READS editor box again The project will build without errors TUTOR1 HEX has just been created and it is ready to download and run 4 4 Downloading the Project into Memory The Compile Download Hex F4 command places the assembled instructions into the code memory of the microcontroller model 1 Select the Compile Download HEX file Download Hex command A Look in 23 Tutorl v small window will appear 1 C RigelReadsb1 Sw ORKNTUTORT S asking the File name to be downloaded 2 Select the file and hit open or double click on the file you want to download 3 You may assemble and load in a single step provided that File name there are no assembly errors Files of type Hesties Ej Cancel using the Compile Build and Download F9 Open as read only 4 5 Running the Project Running the project TUTOR1 RPJ requires you to select the Compile Run Ctrl F8 option Make sure that one of the serial ports on your computer is connected the board and correct port parameters are entered in Options TTY options A small box asking for the program start address appears Enter 8000 and press OK The Run address program will now be running on your board 5 TUTORIAL 2 DEBUGGING A PROJE
70. om one computer to another or make it available through a timesharing service or network of computers Rigel Corporation maintains all proprietary rights in and to the READS for purposes of sale and resale or license and re license BY BREAKING THE SEAL AND OTHERWISE OPENING THE READS PACKAGE YOU INDICATE YOUR ACCEPTANCE OF THIS LICENSE AGREEMENT AS WELL AS ALL OTHER PROVISIONS CONTAINED HEREIN Limited Warranty Rigel Corporation warrants for a period of sixty 60 days from your receipt that READS disks hardware assembled boards and hardware unassembled components shall be free of substantial errors or defects in material and workmanship which will materially interfere with the proper operation of the items purchased If you believe such an error or defect exists please call Rigel Corporation at 904 373 4629 to see whether such error or defect may be corrected prior to returning items to Rigel Corporation Rigel Corporation will repair or replace at its sole discretion any defective items at no cost to you and the foregoing shall constitute your sole and exclusive remedy in the event of any defects in material or workmanship THE LIMITED WARRANTIES SET FORTH HEREIN ARE IN LIEU OF ALL OTHER WARRANTIES EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE YOU ASSUME ALL RISKS AND LIABILITY FROM OPERATION OF ITEMS PURCHASED AND RIGEL CORPORATION SHALL IN NO EVE
71. ou are interest in any of the chips we ve mentioned in this document Atmel Corporation 2125 O Nel Dr San Jose CA 95131 Telephone 800 365 3375 www atmel com Dallas Semiconductor 4350 S Beltwood Pkwy Dallas TX 75244 3292 Telephone 800 336 6933 www dalsemi com Intel Corporation 2200 Mission College Blvd Santa Clara CA 95052 8119 Telephone 800 468 8118 www intel com OKI Semiconductor Inc 785 N Mary Ave Sunnyvale CA 94086 Telephone 800 654 6388 www okisemi com Philips Semiconductors Signetics 811 E Arques Ave Box 3409 Sunnyvale CA 94088 3409 Telephone 800 447 1500 BBS 800 451 6644 www philipsmcu com Siemens Components Inc Integrated Circuits Division 10950 N Tantau Ave Cupertino 95014 Telephone 800 777 4363 ext 149 www sci siemens com Standard Microsystems Corporation 80 Arkay Dr Hauppauge NY 11788 Telephone 516 435 6000 Silicon Systems 14351 Myford Rd Tustin CA 92680 7022 Telephone 714 573 6000 Silicon Systems offers one chip at present the 73D2910 This is a 8052 compatible that has been optimized for low power portable modem or communication applications Please check out our WEB site at www rigelcorp com for the latest software updates Other WEB sites you should check out are www sci siemens com www intel com www tasking com www keil com www fsinc com All of these sites provide free software Intel and Siemens provide app notes and data sheets as we
72. prints as they appear on the RMB S board The sheet number and the sheet name refer to the circuit diagrams given in the previous section The board location coordinates refer to the board layout which follows the cross reference list in this section RMB S System Block Diagram Revised October 27 1993 Revision 1 2 Reference Part Value Sheetname Sheet BB1 BREADBOARD ROOT 1 C1 22uF 25Volts PAD 2 C2 47uF 25Volts PAD 2 C3 2200uf 35Volts POWER 3 C4 100uf 25Volts POWER 3 C5 10nF 25Volts POWER 3 C6 10nF 25Volts POWER 3 C7 10nF 25Volts POWER 3 C8 10nF 25Volts POWER 3 C9 10nF 25Volts POWER 3 C10 100uf 25Volts POWER d C11 470uF 25Volts POWER 3 C12 22uF 25Volts SERIAL 9 C13 22uF 25Volts SERIAL 9 C14 22uF 25Volts SERIAL 9 C15 22uF 25Volts SERIAL 9 D1 ON LED PAD 2 D2 DISPLAY Seven Segment PAD 2 D3 DISPLAY Seven Segment PAD 2 D4 L5 LED PAD 2 D5 L4 LED PAD 2 D6 L3 LED PAD 2 D7 L2 LED PAD 2 D8 L1 LED PAD 2 D9 LO LED PAD 2 D10 BRIDGE POWER 3 D11 1N4001 POWER 3 JP1 Input Output PAD 2 JP2 9VAC POWER 3 JP3 9VAC POWER 3 JP4 SEP 2 Header DECODE 5 JP5 VAGND 2 Header CPU 6 JP6 VAREF 2 Header CPU 6 JP7 HWPD 3 Header CPU 6 JP8 PE SWD 3 Header CPU 6 xxii U2 U4 95 U6 U7 U8 U10 I O SYSTEM SYSTEM BUS Input Output BB4 BB4 DO2 012 SPEAKER AUX RS232 HOST RS232 470 470 ANO 1 AN2 220 220 1K PBO 1 2 4 5 6 PB7 SW DIP 8 E R E R E R E R E R E R MON USER
73. running a terminal emulator The READS is an intelligent interface with the board which has hot keys that invoke several RROS commands to accomplish higher level tasks Many of the RROS routines are available as user accessible system calls The ROM resident firmware consists of 6 major components An initialization routine A command processor Debug utilities User accessible system calls System variables Interrupt Vectors e e Fe eon Ies Each of these components is explained below 9 1 The Initialization Routine This is a short routine that is invoked at power up or when the reset button on the board is pressed The following actions are taken disable interrupts set stack pointer to 4Fh stack will start at 50h initialize hardware select register bank 0 set the interrupt vector table at FFOOh initialize system software flags initialize the serial port to run at 9600 Baud with parameters 8 bits no parity and 1 stop bit 9 2 The Command Processor The system will branch to the command processor if no auto exec routine is present The monitor commands are grouped under 12 single letter commands One or more of these commands are issued by READS while interacting with the board These commands may also be given by an ASCII terminal The monitor commands are grouped according to their function and listed below Function Monitor Commands Read Modify Data X C D R Read Modify Special Function Registers P Load Execute Progr
74. s All Timers 0 Aee 2 Symbol Alas Value 12 6 TUTORIAL ARCHIVE PROJECTS Archive projects are intended to facilitate code reusability by organizing and keeping code modules together An archive project acts as a repository that you may add modules to or copy modules from Executable projects can be quickly constructed using already written and debugged modules from an archive project 6 1 Creating an Archive Project An archive project is used to store source code that may then be used for other projects To create an archive project 1 Type Archive in the Name Dir box 2 Select Project New Archive 3 Click OK Now you will see the project window ARCHIVE RAR represented as the root of a tree 6 2 Importing Exporting Modules 1 Open the executable project TUTOR1 RPJ by selecting Project Open Executable and double clicking TUTOR1 RPJ 2 Open the archive project ARCHIVE RAR by selecting Project Open Archive and double clicking ARCHIVE RAR 3 Click on the module Tutor asm and hold the left mouse button down while you are dragging toward ARCHIVE RAR When the archive project name is highlighted release the mouse button 4 Click OK meaning that you want to make duplicate of Tutor asm under the archive directory You ve created your own archive file containing the module Tutor asm You may add as many modules to an archive project as you want Usually the modules yo
75. stored bytes labeled 0 1 2 being the least significant byte Bytes B 1 and B 2 give the integral part of N and therefore byte B 2 is the integral part of V and byte B 1 the fractional We will refer to 2 and B 1 as Vint and Vfrc The following procedure is used to compute V where HI and LO represent the high and low bytes of the 16 bit arguments Vint Hl n Rint Vfrc 2 LO n Rint Vfrc Hl n Rfrc and increment Vint if a carry results 0 LO n Rfrc The third step means increase the value of by HI n Rfrc If the result is more that 256 then keep the lower 8 bits of the sum in Vfrc and increment Vint The last step is not required since only one byte of the fraction will be displayed The program Vmeter3 asm first shows the integral part of the voltage in decimal 12 for 12 5 Volts followed by the fractional part 50 for 0 5 Volts also in decimal The system call percent is used to convert the binary fraction to its decimal equivalent 10 11 Measuring Reaction Times The time from the reception of a stimulus until a response is called the reaction time The program described here implements a reaction timer which measures the reaction time in mil liseconds The two digital displays and push button 0 PBO are used The push button is connected to bit O of Port 1 Ports 4 and 5 are connected to the LOW DIGIT and HIGH DIGIT respectively The push button PBO is the only input
76. struction may be used to branch to the monitor percent converts the binary fraction in the accumulator to the binary coded decimal BCD fraction in the interval 0 99 For example the binary value 80h is converted to 50 BCD The BCD value is returned in the accumulator This routine uses a look up table for speedy execu tion rather than computing the BCD value print and prtstr send a string of characters out through the serial port Print and prtstr use the accumulator a and the data pointer dptr The string to be sent can be of arbitrary length provided that it terminates with the null character 0 Prtstr sends a null terminated string pointed to by dptr Prtstr is useful if a string in a table of strings such as error messages is to be printed The routine print assumes that the string immediately follows the call to print It is appropriate when the message is embedded in code An example is given below 1 11 print db Hello Everybody ODh OAh O0 The define byte db pseudo op allocates 18 bytes the code memory immediately following the long call instruction The first 15 bytes are filled with the ASCII codes of the letters of Hello Everybody The following 3 bytes contain the ASCII codes for carriage return ODh line feed 0Ah and the null character 0 which indicates the end of the string The carriage return and line feed will start a new line after the string Hello Everybody has been displayed ix
77. t The 8031 and 8032 have 4 ports Notice that ports 0 and 2 are used by the processor for memory address and data busses In addition 4 bits of Port 3 are used by the system Bits of Port 3 P3 0 and P3 1 are used by the serial port as the re ceive data and transmit data lines P3 6 and P3 7 are used in accessing memory as the write and read control lines Modifying bits P3 0 and P3 1 may affect the current data being trans ferred between the host and the board Application programs should not write to ports O or 2 or bits P3 6 or P3 7 of Port 3 The G and L commands are used to down load a program into RAM and run this program The L command puts the board into a receive mode The program should then be sent to the board in the Intel Hex format Once downloading is complete the program may be run by the G command The parameter that follows the G command is the starting point of the program Notice that several programs may be loaded into RAM each one run by a G command fol lowed by its starting address The details of the down load and run process are hidden from the user when READS is used The R command displays the contents of the 4 register banks and the accumulator a the b register b the program status word psw the data pointer dptr the stack pointer sp and the program counter pc The commands B and K are used in debugging Their use is described in the following sec tions Again the details of their use are hidden fro
78. ted by selecting the corresponding popup menu item B 2 File Menu This menu groups the operations which deal with storing retrieving or printing files It also keeps a history list of the last few files opened so that they may quickly be reopened New Ctrl N Opens a new file Open Ctrl 0 Opens an existing file Close Closes the current file Save Ctrl S Saves the current file to disk Save As Saves the current file under a different file name Print Ctrl P Prints the current file Print Preview Displays the page as it will be printed Printer Setup Selects printer options Exit Terminates the editor B 2 1 Edit Menu The editor uses the clipboard to facilitate copying segments of text from one place to another Such text is first tagged by highlighting it You may highlight text by dragging the mouse while keeping the left button down or from the keyboard by using the arrow keys while holding the shift key down Cut Ctrl X Removes the highlighted text from the file and places it into the clipboard Copy Ctrl C Copies the highlighted text into the clipboard without removing it from the file Paste Ctrl V Places the contents of the clipboard into the file at the current caret position IV Undo Ctrl Z Select All Ctrl A B 2 2 View Restores the document to its state immediately before the last edit command Selects the contents of the entire file You may change the appearance of the editor by the following comm
79. tines as well as all examples in the User s Guide and in the distribution diskettes may be used or incorporated into applications by the registered buyer without any royalties fees or limitations Rigel Corporation is not responsible for the suitability or correctness of the example software Refer to the warranty for additional information 1 2 Parts List Your RMB S READS package includes the following RMB S Board 1 RMB S motherboard 2 RMB S READS User s Guide 3 A 32K EPROM with RROS ROM Resident Operating System 32K RAM 4 Four daughter boards DA40 DA44 DA68 and DA84 the DA68 populated with the 80C535 5 Assembly Instructions for unassembled kits only 6 serial modem cable and adapter 7 9 Volt 500mA power source for US sales only READS Software 1 The Integrated Development System Package including an editor a cross assembler and PC to board communications software 2 R Host ASCII terminal emulator 3 8031 chip simulator 3 Sample software 4 Source code for user accessible system calls 2 SOFTWARE SETUP 2 1 System Requirements READS51 is designed to work with an IBM PC or compatible 386 or better running Windows 95 or Windows NT 2 2 Software Installation READS51 Place the CD ROM in your drive Go to the Rigel Products 8051 Software READS51 and select whether you wish to use the DOS or the WIN95 NT version of the software Click on the exe file and the program will begin to lo
80. to the system When the program runs it displays the letters r and d rd indicating that the reaction timer is ready Once PBO is pressed all segments of the display are turned off At a certain point in time all display segments are turned on This is the stimulus also starting the timer When PBO is pressed again the dis play shows the reaction time in milliseconds If PBO is pressed before the stimulus or if PBO is not pressed within 1000 milliseconds 1 second the display shows indicating an error The three digits of the reaction time are displayed on two digits as the number rolls from left to right Program RTime1 asm gives the implementation RTime2 asm performs the same timer function using external interrupt 3 which is also received through the same pin as bit 0 of Port 1 Using the interrupt reduces some repeti tiveness in coding but introduces additional complexity since the interrupt must abort the remaining count and return to the main program in subroutines count and showtime The return address of the subroutine is first placed in a designated internal ram location The interrupt service routine finds the return address pushes it on stack and then returns Notice that stack is initialized before the return This arrangement is only valid if the return address is in the main program 36 10 12 Running in the USER mode Although RROS provides many useful facilities that complement user programs it is sometimes
81. tor to a hexadecimal character in the range 0 9 or A F The high nibble is ignored The program status word PSW be affected beep sends a bell character ASCII 7 to the host through the serial port No registers are affected break compares the contents of the accumulator to the break character ASCII 3 Ctrl C If the accumulator holds the break character control is passed back to the RROS command processor The program status word PSW may be affected chkbrk reads a character from the serial port and compares it to the break character ASCII If equal control is passed back to the monitor command processor The program status word PSW may be affected cret outputs a carriage return ASCII ODh through the serial port The accumulator a is affected crif outputs a carriage return ASCII ODh followed by a line feed character ASCII OAh through the serial port The accumulator a is affected delay executes a dummy loop to suspend the execution nn milliseconds where nn is the contents of the accumulator display converts the low nibble of the accumulator to the corresponding seven segment display pattern Upon return the accumulator holds the 7 bits acc 0 corresponding to segment a and acc 6 segment g The bits are cleared if the corresponding segment is to be lit Thus the pattern will drive a common anode seven segment display which can be connected to a port of the microcontroller viii
82. u will want to add are tested and debugged modules that you may want to use for other projects READS51 includes many of the more common modules in for the A D routines timers counters and so on 7 THE RMB S BOARD 7 1 UIOD User Input Output Devices The development of application specific microcontroller based prototype circuits is significantly simplified with the RMB S breadboard area the two terminal strips and the user input output devices UIOD UIODs include 14 light emitting diodes LED marked LO to L5 and Bar Display 0 to 7 2 seven segment numeric displays marked DISPLAY LOW and DISPLAY HIGH and a speaker as output devices The 54 post solderless terminal strip located just above the UIODs contains 14 posts marked LEDs 0 to 5 and Bar Display 0 to 7 for the LEDs Also 14 posts grouped into 2 sets marked HIGH DIGIT and LOW DIGIT are connected to the seven segment displays Each display has segments with the standard designations a to g The output devices are in a common anode configuration meaning that their anodes are connected to 5 Volts Vcc by current limiting resistors An output device say segment d of DISPLAY LOW may be turned on by linking the corresponding post on the solderless terminal strip to power ground 0 Volts The power ground is available on the 54 post solderless terminal strip placed above the breadboard at two positions both marked GND DIP SWITCH BARDISPLAY LEDS POTS SPEAKER PUSHBUTTONS
83. uch a hierarchical structure is the basis of modular programming and structured programming The interface between modules which communicate must be specified At the conclusion of the preliminary design step each module is a black box with a logical purpose Detailed design Now that every module of the system is identified the step of detailed design develops the detailed description of the inputs and of the outputs for each module The detailed design step should also include a summary of all processes xvi Coding If a good detailed design was done coding is the easiest step Debugging Debugging is first concerned with producing an executable code All syntax errors should be resolved Once executable code is developed it should be run with realistic inputs to see if each module produces the desired outputs Single stepping or tracing through the code is a good tool to microscopically evaluate the behavior of code Testing Testing may be broken down to the following three activities Module testing does each module perform as specified Integration testing do modules interact with each other as specified System testing does the system meet specifications Maintenance and Modification Software maintenance refers to repairing the errors in code Note that programs do not break down All errors were already in the program when it was created These errors may be due to coding errors specification errors or information passing misass
84. umptions Software modification adds value to the software by introducing new features The above steps should be regarded as minimal guidelines Depending on the specific application additional steps should be added as necessary xvii APPENDIX H Sample Program Circuit Diagrams high runs eed lat VEC D1 1N400 M1 MOTOR VCC Size Document Number SEV Date Augus 7 xviii Driving an LED as ar LED lights when the output Ort bit is xix Reading a First make the port bit 1 Port bit XX APPENDIX I RMB S BOARD HEADER PINS All system signals are available on the 40 pin jumper header JP11 The pin assignments are given below Refer to the circuit diagram for additional information Signal Pin Pin Signal A11 10 5 A10 11 12 RO 35 36 az U gt gt gt gt gt Oo O N N NIO O M a Kigla N P 9520 SWD 39 40 XX APPENDIX J BILL OF MATERIALS The components used in the RMB S are listed below The bill of materials is organized in terms of the part types The cross reference list pertains to the component foot
85. w several keys see Miscellaneous Edit and Navigation Keys move the caret sometimes while performing another operation For example the backspace key moves the caret backwards one character while erasing that character Search Search Forward Search Backward Replace Beginning of Line Ctrl F Moves the caret to the next occurrence of the given string F3 Repeats the last search in the forward direction Ctrl F3 Repeats the last search in the backward direction Ctrl H Replaces the next occurrence of the search string with another string Home Moves the caret to the beginning of the line V End of Line End Moves the caret to the end of the line Beginning of File Ctrl Home Moves the caret to the beginning of the file End of File Ctrl End Moves the caret to the end of the file Next Word Ctrl Right Moves the caret to the next word Previous Word Ctrl Left Moves the caret to the previous word Jump Jumps to a given line number B 3 Miscellaneous Edit and Navigation Keys Up Arrow Moves caret to the previous line Down Arrow Moves caret to the next line Right Arrow Moves caret to the next character Left Arrow Moves caret to the previous character PgUp Moves caret to the previous page PgDn Moves caret to the next page Del Deletes the next character Backspace Deletes the previous character B 4 Highlighting Text Highlighting text is the most fundamental operation in using the edit commands There are various shortcuts to
Download Pdf Manuals
Related Search
Related Contents
Phonix HU610GPW mobile phone case Targus Prospect 15.6" Olympus VN-731PC Rexel 2103799 writing notebook Modal Testing Excitation Guidelines PowerDsine PD-3504G/AC network switch カタログ CAJA FUERTE PARA HOTELES CISA eSIGNO Dale Tiffany STW13016 Installation Guide ピュアハンド II ピュアハンド Copyright © All rights reserved.
Failed to retrieve file