These products are sold by SGS-THOMSON's representatives, if not stated otherwise.
- ST62 The Cost Effective MCU BRST62ST/1094 1993 - ST62 family overview BRST62ST/0293 Available
- Shortform, includes all SGS-THOMSON products, but has a nice overview of all microcontroller families.
- ST6210/ST6215/ST6220/ST6225 D.B. DBST6ST/1 1991 - ST621X, 2X + info on 6X DBST6ST/4 Available - ST62 General Purpose AMST62APPLST/1 1995
- ST624X Data book; info on 8x DBST624XFST/1 Available - ST62 tools user manual (AST6,LST6,SIMST6 1994) DBST6SOFTOST/2 Available - Video Products Databook, Volume 1. AMVIDEOST/1 1991 ST62-TRAIN/DOC Available
The 'ST62 MCU Family' CD-ROM offers a full set of data sheets and application notes on all ST62 family products.
The 'DATA on DISC' CD-ROM contains information on all SGS-Thomson products and can be purchased from most distributors of SGS-Thomson components. Ofcourse a vast number of printed data books are widely available.
- ST62 Application manual AMST62APPLST/1 Available
- ST62 Microcontroller - Anwenderhandbuch - XY500
AN1014 | ST7 | How to minimize the ST7 Power Consumption AN1017 | ST7 | Using the ST727 Universal Bus Interface AN1047 | ST7 | Managing reception errors with the ST7 SCI | | peripherals AN392 | ST6 | Microcontroller(MCU) and triacs on the mains | | (100/220V) AN414 | ST6 | Controlling a brush DC motor with an ST6265 AN416 | ST6 | Sensorless motordrive with the ST62 MCU and triac AN417 | ST6 | From nickel-cadmium to nickel-hydride | | fast battery charger AN419 | ST6 | An approach to motor control with fuzzy logic AN420 | ST6 | Expanding A/D resolution of the ST6 A/D conversion AN422 | ST6 | Improved Universal Motor Drive AN431 | ST6 | Using ST6 analog inputs for multiple key decoding AN432 | ST6 | Using ST62XX I/O Ports safely AN433 | ST6 | Fast NICD battery charging using ST6210 MCU AN434 | ST6 | Movement detector concepts for noisy environments AN435 | ST6 | Designing with Microcontrollers in noisy environments AN590 | ST6 | PWM generation with the ST62 auto re-load timer AN591 | ST6 | Input Capture with ST62 Auto reload capture AN592 | ST6 | PLL Generation with ST62 Auto-reload timer AN593 | ST6 | ST62 in-circuit programming AN594 | ST6 | Direct software LCD Drive with ST621X and ST626X AN595 | ST6 | Fuzzy vacuum cleaner using ST6220 and FuzzyTech | | ST6 explorer AN597 | ST6 | Temperature Control using Fuzzy Logic AN598 | ST6 | Cascading fuzzy modules with ST6 fuzzy tech AN669 | ST6 | Simple reset circuits for the ST62 AN670 | ST6 | Oscillator selection for the ST62 AN671 | ST6 | Prevention of data corruption in ST6 on-Chip EEPROM AN672 | ST6 | Optimizing the ST6 A/D converter accurancy AN673 | ST6 | Reducing current consumption at 32KHz with ST62 AN674 | ST6 | Microcontrollers in home appliance, a soft revolution AN675 | ST6 | A rapid charger for batteries with fuzzy logic AN676 | ST6 | Battery charger using the ST6-Realizer AN677 | ST6 | Painless Microcontroller code by graphical | | application description AN678 | ST6 | LCD Driving with ST6240 AN638 | ST6 | STXX - Microcontrollers (MCU's) application note | | abstracts AN839 | ST6 | Analog multiple key decoding using the ST6-Realizer AN840 | ST6 | Coded Lock using the ST6-realizer AN841 | ST6 | A cock design using the ST6-realizer AN842 | ST6 | 7 segment display drive using the st6-realizer AN843 | ST6 | Bankswitch and GNU C example AN859 | ST6 | An intelligent one hour multicharger for Li-Ion, | | NiMH and NiCd batteries AN863 | ST6 | Improved sensorless control with the ST62 MCU | | for universal motor AN865 | ST6 | ST6X86 and pentium Bus differences AN866 | ST6 | ST6X86 Thermal Design Considerations AN867 | ST6 | ST6X86 Bios Writers Guide AN883 | | A mini guide to the applicaton note index in | | the 8-Bit MCU's bulletin board system AN4884 | ST6 | ST62XX apllication notes abstracts by topic AN885 | ST6 | Microcontrollers drive home appliance motor | | technology AN886 | | MCU's - selecting between ROM and OTP for | | a microcontroller AN887 | | MCU's making it easy with Microcontrollers AN898 | | MCU's EMC general information AN899 | | MCU's Soldering recommendations and packaging | | information AN900 | | MCU's Introduction to semiconductor technology AN901 | | EMC guide lines for microcontroller-based | | applications AN902 | | MCU's Quality and reliability information AN912 | | MCU's a simple guide to development tools
Note: Some of the above Application Notes are those published in the ST62 Application Manual.
**** PROBABLY NOT ACCESSIBLE ANYMORE: ****
MCU Application Notes ACROREAD.EXE1,438,059 11/29/95 | Acrobat Reader file viewer - |Necessary to view/print .pdf files Dwnlds: 4 DL Time 00:16:49 | AN392_A4.PDF 353,654 11/29/95 | Microcontroller and Triac on the Dwnlds: 3 DL Time 00:04:08 | 110/240V Mains AN412_A4.PDF 497,332 11/29/95 | Digital Power Factor Correction with Dwnlds: 0 DL Time 00:05:49 | Non-Sinewave Current AN414_A4.PDF 246,191 11/29/95 | Controlling a brush DC motor with an Dwnlds: 0 DL Time 00:02:52 | ST6265 MCU AN415_A4.PDF 715,256 11/29/95 | Using the I2C BUS Protocol (Acroread Dwnlds: 2 DL Time 00:08:21 | format) AN416_A4.PDF 364,560 11/29/95 | Sensorless Motor Drive with the ST62 Dwnlds: 0 DL Time 00:04:15 | MCU + Triac AN417_A4.PDF 946,387 11/29/95 | From NICD to NIHM Fast Battery Charging Dwnlds: 1 DL Time 00:11:04 | (Acroread format) AN419_A4.PDF 484,892 11/29/95 | An approach to Motor Control with FUZZI Dwnlds: 0 DL Time 00:05:40 | Logic - ST6 MCU AN420_A4.PDF 138,289 11/29/95 | Expanding ADC Resolution of the ST6 A/D Dwnlds: 3 DL Time 00:01:37 | Converter AN422_A4.PDF 317,481 11/29/95 | Improves universal Motor Drive Dwnlds: 0 DL Time 00:03:42 | (Acroread format) AN423_A4.PDF 550,073 11/29/95 | ISO Smart Card Interface (Acroread Dwnlds: 2 DL Time 00:06:26 | format) AN424_A4.PDF 632,796 11/29/95 | Versatile and Cost Effective Induction Dwnlds: 0 DL Time 00:07:24 | Motor Drive / 3 phase AN426_A4.PDF 443,469 11/29/95 | Frequency Doubler Demonstration System Dwnlds: 1 DL Time 00:05:11 | (Acroread format) AN431_A4.PDF 208,579 11/29/95 | Using ST6 Analog Inputs for Multiple Dwnlds: 2 DL Time 00:02:26 | Key Decoding AN432_A4.PDF 264,115 11/29/95 | Using ST62xx Ports Safely Dwnlds: 0 DL Time 00:03:05 | AN433_A4.PDF 515,633 11/29/95 | Ultra Fast Battery Charger using ST6210 Dwnlds: 2 DL Time 00:06:01 | Microcontroller AN434_A4.PDF 119,982 11/29/95 | Movement Detector Concepts for Noisy Dwnlds: 2 DL Time 00:01:24 | Environments AN435_A4.PDF 419,205 11/29/95 | Designing with Microcontrollers in Dwnlds: 2 DL Time 00:04:54 | Noisy Environment AN490_A4.PDF 325,104 11/29/95 | Programming Flash Memory of the Dwnlds: 0 DL Time 00:03:48 | ST10F166 AN590_A4.PDF 113,247 11/29/95 | PWM Generation with ST62 Auto-reload Dwnlds: 1 DL Time 00:01:19 | Timer AN591_A4.PDF 82,638 11/29/95 | Input Capture with ST62 Auto-reload Dwnlds: 1 DL Time 00:00:57 | Timer AN592_A4.PDF 98,794 11/29/95 | PLL Generation using the ST62 Dwnlds: 1 DL Time 00:01:09 | Auto-reload Timer AN593_A4.PDF 100,787 11/29/95 | ST62 IN-Circuit Programming Dwnlds: 1 DL Time 00:01:10 | AN594_A4.PDF 533,308 11/29/95 | Direct Software LCD drive with ST621x & Dwnlds: 1 DL Time 00:06:14 | ST626x AN595_A4.PDF 846,814 11/29/95 | Application of FUZZI Vacuum Cleaner Dwnlds: 0 DL Time 00:09:54 | using ST6220 & FUZZITECH AN597_A4.PDF 625,180 11/29/95 | Temperature Control with FUZZY Logic Dwnlds: 2 DL Time 00:07:18 | AN598_A4.PDF 199,146 11/29/95 | Cascading FUZZY Modules with ST6 Dwnlds: 1 DL Time 00:02:19 | FUZZYTECH AN669_A4.PDF 54,420 11/29/95 | Simple Reset Circuits for the ST62 Dwnlds: 3 DL Time 00:00:38 | AN670_A4.PDF 130,687 11/29/95 | Oscillator Selection for ST62 Dwnlds: 4 DL Time 00:01:31 | AN671_A4.PDF 59,286 11/29/95 | Prevention of Data Corruption on ST6 Dwnlds: 3 DL Time 00:00:41 | on-chip EEPROM AN672_A4.PDF 36,610 11/29/95 | Optimizing the ST6 A/D Converter Dwnlds: 4 DL Time 00:00:25 | Accuracy AN673_A4.PDF 41,723 11/29/95 | Reducing Current Comsumption at 32KHz Dwnlds: 1 DL Time 00:00:29 | with ST62 AN674.PDF 317,480 11/29/95 | Microcontrollers in Home Appliance Dwnlds: 1 DL Time 00:03:42 | Software Solution AN675.PDF 82,711 11/29/95 | A rapid Charger for Batteries with Dwnlds: 2 DL Time 00:00:58 | FUZZY Logic AN676.PDF 148,533 11/29/95 | Battery Charger using the ST6-REALIZER Dwnlds: 3 DL Time 00:01:44 | AN677.PDF 202,252 11/29/95 | Painless "MCU" Code by Graphical Dwnlds: 1 DL Time 00:02:21 | Application Description AN678.PDF 191,417 11/29/95 | LCD Driving with ST6240 Dwnlds: 0 DL Time 00:02:14 | ANABSMCU.PDF 171,113 11/29/95 | MCU Application Notes Abstract Dwnlds: 1 DL Time 00:02:00 | (Acroread format)
Note: Some of the above Application Notes are those published in the ST62 Application Manual.
The following is a list of Italian magazines that generally publish articles and circuits with ST6 microcontrollers:
FARE ELETTRONICA Via Gorki 69 20092 CINISELLO BALSAMO (MI) Phone 2 66034401 Fax 2 66034482 NUOVA ELETTRONICA Via Cracovia 19 40139 BOLOGNA Phone 542 641490 Fax 542 641919 PROGETTO ELECTOR Via Ferri 6 20092 CINISELLO BALSAMO (MI) Phone 2 660251 Email: Progetto@jce.it
We hope to receive informations and contributions from the readers of this FAQ in order to integrate this list with periodicals publishing articles on ST6 microcontrollers.
Le ST62XX : mise en oeuvre progressive d'un microcontroleur by Jean-Marc Delaplace and Jean-Luc Gregoriades published by DUNOD Tech, Paris: DUNOND/TECH BP 20 92122 MONTROUGE CEDEX FRANCE ISBN 2-10-0011982-1
I have noticed that many people have problems with running the SGS Thomson ST6 Starter Kits programming software under Windows 95. Most people that have tried to do this have had problems. Fortunately there is a simple solution. Include the line "switches=/c" in the config.sys file, and the problem disappears.
On the ST62T60/65 devices there is 128 bytes of EEPROM and it is normally used for storing calibration data etc. for use in the application. A common problem with many designs in the apparent corruption of this on board EEPROM. The main reason for the corruption is due to poor management of the RESET pin on the ST6 device. In cost sensitive designs the hardware designer will use only a small reset capacitor, 100nF or so, connected between the RESET pin and ground. During power up the voltage on the reset pin will lag behind slightly the power supply voltage, so during the power up phase the microcontroller will be held in reset until the voltage on the reset pin is sufficiently high enough to release the micro. This works well during power up. However on power down, the voltage on the RESET pin will collapse at the samerate as the power supply voltage. At about 3 volts or so the microcontrollercan not guarantee reliable operation and device integrity is lost. At this point the microcontroller can start to write garbage into its register spaceand hence corrupt the EEPROM. Also the I/O pins on the micrcontroller can be corrupted and hence spurious LED operation, if connected to the I/O pins,can be observed. Hence corruption of the EEPROM is possible during the power down phase. This can be confirmed in your application by following the sequence below:
Solving the problem is easy. You will need to add a brownout detector onto the power supply lines, and connect the output to the reset pin. Methods of doing this are described in Apps Notes AN669 Simple Reset Circuit For The ST6, and AN671 Prevention Of Data Corruption In ST6 On Chip EEPROM.
Always connect the TEST pin to ground; in the manual an on-chip pull-down resistor is mentioned, but in fact it is not there or it simply does not function correctly.
From SGS-THOMSON BBS (see item #3.3 and #4.2) it is possible to read the following Application tip n. 34:Agnes Cacciaguerra, Rousset Thibault Brunet, Rousset:
EPROM members of the ST62 MCU family use the pin labelled TEST on the equivalent ROM-based ST62, but with the additional function as the input for the programming voltage, VPP, for the EPROM. Normally for the ROM devices the TEST input has an internal pull-down resistor allowing the device to have this pin not-connected in the circuit, while preventing unauthorized access to the TEST functions.
Several members of the ST62 EPROM based devices have been found to NOT have this pull-down resistor on the VPP/TEST input of the devices. This may cause a malfunction of the system or high current consumption of the device if the TEST input is allowed to float high.
For this reason VPP/TEST pin must not be left open. It is advised to connect this input to Ground via a resistor of 50k to 100kOhm.
This applies to the devices shown in the following table for devices currently available. All future devices will have this pull-down resistor.
Table of ST62 Devices with/without Pull down resistor on the VDD/TEST pin:
PULL DOWN Technology AT VPP ST621X/2X 1.5 Yes (see note) ST62E1X 1.5 No ST62E2X 1.5 No ST6225 1.2 Yes ST62E25 1.2 Yes ST6240 1.5 Yes ST62E40 1.5 Yes ST62E94 1.5 No ST6294 1.2 Yes ST62E94 1.2 Yes ST628X 1.5 Yes ST62E8X 1.5 Yes All New ST62 1.2 Yes
Note: All ROM Codes dating after July 1992 have used the revised mask set, unless otherwise specified by the customer. In detail this applies to devices with the SGS-THOMSON specified ROM code identifier greater than SP, (excepting PK, SL and SN).
ST6 ROM code identifiers are used to replace the /XX part of the sales type to specify the customer ROM code used. The sequence has been for two alphabetic letters incrementing in alpha order (i.e. AA-AZ, BA-BZ etc). From code YS however, ROM code identifiers have been restarting in an alpha/number sequence (i.e. A0-A9, B0 to B9 and so on). Check your part number (specified on the order, as, if custom marking has been requested, the part number may not appear on the package itself) if you wish to be sure. In case of doubt, contact the local SGS-THOMSON marketing person.
Table of ST62 Devices with/without Pull down resistor on the VDD/TEST pin:
PULL DOWN Technology AT VPP ----------------------------------------------- ST620X 0.8 Yes ST621X/2X 0.8 Yes (see note) ST62E1X 0.8 Yes ST62E2X 0.8 Yes ST6225 0.8 Yes ST62E25 0.8 Yes ST6240 1.0 Yes ST62E40 1.2 Yes ST6294 0.9 Yes ST62E94 1.2 Yes ST628X 1.0 Yes ST62E8X 1.2 Yes
The ST62EXX microcontroller type is the EPROM version of this family. They are intended for use during the development of an application or for pre-prodution and small volume prodution.
The ST62TXX OTP type (One Time Programmable) have the same characteristics of the EPROM except that they cannot be erased. From the user's point of view, once programmed, the OTP and EPROM types have exactly the same software and hardware features as the ROM version, except for the following parts:
But also see article "ST624X ROM BANKING ALERT" in chapter "Software Hints and Tips"
The EPROM may be erased by esposure to the Ultra violet light. The erasure of the EPROM begins when the memory is exposed to light with a wave lengths shorter than approximately 2700 A. The SGS-Thomsom recommmends an exposure to short wave ultraviolet light which have a wave-lenght of 2537 A. The integrated dose (UV intensity by exposure time) for erasure should be a minimum of 15 W sec/cm2. The erasure time with this dosage is approximately 15 to 20 minutes using an ultraviolet lamp with 1200 microW/cm2 power rating. The life of the EPROM is reduced if the exposure is over 50 minutes The devices should be placed within 2.5 cm of the lamp tubes during erasure.
The application notes AN432 by J.Stockinger on the SGS-THOMSON Application Manual (1^ FREE Edition-January 1995) is very clear for understanding the architecture of the I/O bit associated with these port functions and provide additional indications on the correct use of these features for functions as keybord scanning and analog inputs.
After reset is a good time to start the timer, configure the I/O lines, and set up the data rom window register. Start your reset routine by reloading the watchdog timer, and finish it with:
The stack is a hardware stack. This means that you are quite limited in the number of calls that can be nested, as you have to save some stack space for the interrupts.
Disable the A/D conversion interrupt as soon as you enter the interrupt routines. The end of conversion state is still valid after the interrupt routine ends and can generate another interrupt request.
It seems that you would have to do the same with all other interrupts, but I'm not quite sure, since I haven't had any problems with them.
This is useful. I have used it when converting an A/D result into a value to be compared with another A/D result. The required calculation (multiply by 0.62) was a bit beyond the ST6, so I used a 256 byte look-up table of the result.
You can set it up like this:
.w_on ; enable data rom window .org 80h .block 64-$%64 ; Force page boundary. table .byte 000h,004h,008h,00bh,00fh,013h,017h,01ah .byte 01eh,022h,026h,029h,02dh,031h,035h,038h .byte 0.............. ; etc... ldi drwr,table.w ; The data rom window register is initialzed.
And to use it:
ld x, a2dresult ld a, (x)
An A/D conversion takes about 70 microseconds for a 8 MHz crystal, not 70 milliseconds as printed in some databooks. Only ONE I/O line can be programmed as an analog input line!
The best accuracy is obtained by putting the ST6 to sleep, and making sure that there has been no processor activity during the conversion. Hence the use of two flags. All other interrupts except the A/D interrupt set the ad_bad_flag. The A/D interrupt sets the ad_good_flag if the ad_bad_flag has not been set.
a2d1: clr adbadflag clr adgoodflag ldi adcr,a2don ; turn on set up and start a2d wait nop ; A TO D INTERRUPT HERE ld a,adgoodflag jrz a2d1 ; if not marked as good, do it again ; an untroubled conversion...
Note the nop after the wait. It is *important*.
Without wanting to go into any theory, you may increase the reliability of your A/D conversions by sampling a few times and averaging. This would present something of a computational challenge to the ST6, unless you use a couple of tricks. Set up three locations thus:
ldi adbsum,00 ; bottom byte of result ldi adtsum,00 ; top byte of result. ldi adcount,16 ; NB this is a power of two
( code snipped as above )
ld a,adbsum add a,adr ; add result to sum ld adbsum,a jrnc a2d2 ; if carry, then add 1 to top byte inc adtsum a2d2: dec adcount jrz a2dend ; if adcount has rolled around, then quit jp a2d1
After doing the conversion 16 times you have a total value that you wish to divide by 16. This would be most easily accomplished by a shift right [#:-} so instead we shift left into our adtsum thus:
a2dene: jrz a2dfin ; z flag from ld above or dec below ld a,adbsum rlc a ; shift top bit into c flag ld adbsum,a ld a,adtsum rlc a ; shift c flag into bottom bit ld adtsum,a dec v ; v loaded with number of shifts jp a2dene
Here's an alternative method that I believe is significantly faster.
clr a jrr 1,adtsum,a3s1 ; construct in accumulatoir using bit ; tests ldi a,80h ; this is a 'divide by four' operation. a3s1: jrr 0,adtsum,a3s2 addi a,40h a3s2: jrr 7,adbsum,a3s3 addi a,20h a3s3: jrr 6,adbsum,a3s4 addi a,10h
If you like a good argument, find an appropriate Usenet newsgroup, and suggest that this technique will allow you greater than eight bits of accuracy... Only a few people on the net understand the subject. And they can't be bothered to discuss it anymore, so the whole argument is conducted by people who don't know what they're talking about. Actually, that's just like every other thread.
This must be done in the right order. At startup, I load them thus:
ldi dra,drabits ; set up I/O pins ldi ddra,ddrabits ldi ora,orabits
I have used copy registers for the data registers and option registers. This is the sequence I settled on for changing an input to an output:
; SET PIN TO OUTPUT ldi a,ddrabits set a_databit,a ld ddra,a set a_databit,ora_out ld a,ora_out ld ora,a set a_databit,prta_out ld a,prta_out ld dra,a ; END SET PIN
Reliable periodic timer interrupt interval. [under construction]
You can use the following piece of code inside your timer interrupt routine:
jrr dout,tscr,lo_hi hi_lo res dout,tscr jp end_tim lo_hi set dout,tscr end_tim reti
The TIMER pin will switch value if a timer interrupt occurs. Be aware that the value you set in the tscr register is provided to the TIMER pin the *next* time the timer interrupt is generated.
The watchdog timer generates a general reset as soon as it has counted down to zero from its starting value. Be aware and reload the watchdog register periodically to prevent this. Do this within your main code loop rather than from within a timer interrupt; as otherwise you may have the ST6 crash without ever being reset, as the timer interrupt / routine continue to work although the main code has stopped working.
;long jump for jrnz instruction; use jumpnz instead of jrnz .macro jumpnz jpadress,?lbl jrz lbl jp jpadress lbl .endm ;long jump for jrnc instruction; use jumpnc instead of jrnc .macro jumpnc jpadress,?lbl jrc lbl jp jpadress lbl .endm ;long jump for jrz instruction; use jumpz instead of jrz .macro jumpz jpadress,?lbl jrnz lbl jp jpadress lbl .endm ;long jump for jrc instruction; use jumpc instead of jrc .macro jumpc jpadress,?lbl jrnc lbl jp jpadress lbl .endm
The programming mode of the EPROM and OTP types is configured by setting a voltage of 12.5 V to the Test/Vpp pin.
On the EPROM/OTP devices it is possible to emulate the option mask of
the ROM devices by an "Option Byte" that can be programmed with the
This "Option byte" is automatically read and the selected options is switched on.
Setting high the bit D7 of the option byte it is possible to prevent (by hardware) the readout of the software contents.
From SGS-THOMSON BBS (see item #3.3 and #4.2) it is possible to read the following Application tip n. 4: Hans Reichmeyer, Grafing:
The ROM Bank switch Register RBSR of the ST6 family members with 8k of ROM space has a difference in functionality between EPROM and ROM devices.
The ROM bank switch register in ROM devices is NOT initialised during reset and contains arbitrary information after power up. To addressa page in the program address range from 0 to 7FF, the ROM bank switch register must be loaded first.
The ROM bank switch register in EPROM devices IS cleared during reset and addresses page 0 after power up.
A problem can arise if a user forgets to load RSBR in his software.When the program accesses page 0 in an EPROM device, the device will behave correctly (as RBSR is cleared at reset), whereas a ROM device will have an undefined function... and will probably cause a program failure.
Thus it is mandatory to load RSBR before accessing the paged program address region.
The family members affected are ST6240/E40.
Users of these devices should be made aware of this to prevent any problem in the use of the ROM device after successful debugging with the EPROM device.
From SGS-THOMSON BBS (see item #3.3 and #4.2) it is possible to read the following Application note
XOR.ASM - Release 1.00 / June 1994 By Guy DELACHANAL - Dev.Tools & Application Department GRENOBLE - FRANCE PURPOSE: perform XOR logic operation between two bytes (This operation is not provided in the ST6 instruction set) INPUT VARIABLES: V0 and V1 OUTPUT: ACCUMULATOR A WORK REGISTER: MASK Note: This routine may be used with any ST6 family MCU Note: do not forget to define the V0, V1, MASK labels !
xor LD a,V0 ; First operand AND a,V1 ; Only the bits that are "1" in both V0 and V1 are still ; "1" in accumulator A NEGA ; These bits are now "0" (and the others "1") LD MASK,A ; Let's save this "mask" into MASK register ANDA V0 ; Resets the V0 bits that where "1" in both V0 and V1 ; Other bits are left to their initial value ADDA V1 ; Sets all the bits that where "1" in V1 ; Other bits are left to their initial value ANDA MASK ; Resets the bits that where "1" in both V0 and V1 ; Other bits are left to their initial value ; ACCUMULTOR A is now the result
PURPOSE: perform OR logic operation on a byte (This operation is not provided in the ST6 instruction set) The Morgan law can help: OR = not(not A AND not B) so if we want to set the bit 0 of a byte the routine is:
load a,byte com a andi a,11111110b com a ld byte,a
ld a,v com a and a,x add a,v
ld v,a com a and a,x add a,vWhich seems to work.
From the SGS-THOMSON BBS (see item #3.3 and #4.2 EXAMPLES DIRECTORY \Application tips\Atip.txt #22) it is possible to read the following Programming Techniques:
ST6 GOOD PROGRAMMING TECHNIQUES 1.1
The ST6 Applications Team
Return to ToC of ST6FAQ
Return to ST6 Home Page