MVMEG6 V6.47 SPECIFICATION FEATURES -------- - High-performance, Low-power 8-bit Microcontroller - Advanced RISC Architecture - 130 Powerful Instructions - Most Single-clock Cycle Execution - 32 x 8 General Purpose Working Registers - Fully Static Operation - Up to 16 MIPS Throughput at 16 MHz - On-chip 2-cycle Multiplier - Nonvolatile Program and Data Memories - 64kbit In-System Self-Programmable Flash - 4kbit EEPROM - 8kbit Internal SRAM - Endurance: 100,000 Write/Erase Cycles - Optional Boot Code Section with Independent Lock Bits - In-System Programming by On-chip Boot Program - True Read-While-Write Operation - Programming Lock for Software Security - Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode - One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture - Real Time Counter with Separate Oscillator - Three PWM Channels - 8-channel ADC in TQFP and MLF package (6-channel ADC in PDIP package) - 6 Channels 10-bit Accuracy - 2 Channels 8-bit Accuracy - Byte-oriented Two-wire Serial Interface - Programmable Serial USART - Master/Slave SPI Serial Interface - Programmable Watchdog Timer with Separate On-chip Oscillator - On-chip Analog Comparator - Power-on Reset and Programmable Brown-out Detection - Internal Calibrated RC Oscillator - External and Internal Interrupt Sources - Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby - 23 Programmable I/O Lines - 28-lead PDIP, 32-lead TQFP, and 32-pad MLF - Power Consumption at 4 Mhz 3V Active: 3.6 mA Idle: 1.0 mA Power down: .5 æA INTRODUCTION ------------ The MV1200/MV8515/MVMEG6 advanced RISC architecture has significant advantages over other micro-controllers. These include lower cost, higher performance, and easier programming. MV1200/MVMEG6 are the only chips of their type capable of running with ZERO external components. No crystal, caps, or external memory needed. A crystal version is available however at the same price (MV1200a/MVMEG6a). Because of longer instruction word and because the clock is not divided down internally it runs about 10 times faster than PIC, 8051, or Z80 type controllers at the same clock frequency. Another advantage is built-in BASIC like "Stamp" type circuit board modules except CPU, memory, and oscillator components are in a single IC and more ports are available. The MV8515 stores over 46x more BASIC than the original chip, the MVMEG6 300x more. BASIC and Assembly are downloaded from a PC over an RS232 port. Special development tools are not required. The MVMEG6 has eight serial input/output bits, 15 bidirectional parallel port bits, and up to eight channel high speed Analog-to-Digital Converter (8 and 10 bit) supported by the BASIC interpreter. Up to 23 DAC (Digital to Analog) channels are also available in addition to a RTCC (Real Time Calendar Clock). This chip can be programmed in Assembly too (using RS232). In this case with 23 general I/O bits, 3 high speed timer/counters, 3 UARTS, a precision analog comparator, multi-channel high speed 10 bit ADCs, and a low power "watch crystal" type oscillator for running a battery backed calendar clock. These products are intended for low end applications and education in the area of embedded controllers. For "Plug-N-Go" ability a MEG6 version of the Credit Card Computer (CCC3a) plugs into a PC for download and power. It includes a NTSC video interface circuit, Single-wire Multi-drop Long-distance Network (SMPLNET), and ISA bus for PC adapter cards (modem, video, PCMCIA, etc.). For high end applications MVS has a line of PC compatible 8088 and 386 Single Board Computers with up to 64 Mbyte memory capacity and DOS. See PRICELST.TXT or the website for info. BASIC INTERPRETER ----------------- v=x[#x#x..] assign expression,# is +,-,&(and),|(or),*{^(xor),*(mult),/(div)} adc *get analog value from ADC channel g into a/h,0=min...255=max baud x set baud rate,@7.3728mhz 253=9.6k 122=19.2k 18=115.2k etc. clear set variables to default: a=0,b=32,c=0,d=56(PORTB) SYSCON=6 data k,k... define data,3 byte header,access via read/write,default b=32 defio x set i/o pointer (d) for inp/out,default=56(PORTB),see i/o map defmem x set nvmem byte pointer (b) for read/write,default b=32 end power down til interrupt or reset,re-starts from beginning erase (CCC2 only) erase flash block,block number set by pc0-2 for c=0 to k for/next part 1,sets loop point and counter,see "next" gosub k unconditional subroutine call to line,use ret to return (+-8K) goto k unconditional jmp to line (pushes ret adr,really gosub w/o ret) if v#x then k conditional goto line,# is =,>,<,! (jmp range +-1K) inp v get port pointed to by defio (d) to variable,use PINB not PORTB input v get 3 digit decimal number from active serial into var next c for/next part 2,c=c+1 if c15 bytes between gosub and ret) serin v get serial byte from active com port (default=1) into var serin1 v get serial byte from rx1 and make this the active port serin2 v get serial byte from rx2 and make this the active port serin3 v get serial byte from rx3 and make this the active port serin4 v get serial byte from rx4 (port direction must be changed) serout x send serial byte out active com port (default=1) serout1 x send serial byte out tx1 and make this the active port serout2 x send serial byte out tx2 and make this the active port serout3 x send serial byte out tx3 and make this the active port serout4 x *send serial byte out tx4 and make this the active port sleep x pause for 1-256 tics (16ms-4sec),picks up where it left off sound x make 256 cycle tone on tx1 (o.c.),0=40khz 1=20khz...255=156hz ssin v *get synchronous serial byte into var (SPI/I2C,clk=pd7 dat=pb1) ssout x *send synchronous serial byte (SPI/I2C,clk=pd7 dat=pb1) sstart *send I2C start signal (clk hi,dat lo,clk lo),use w/ssin-ssout sstop *send I2C stop signal (clk hi,dat hi,clk lo),use w/ssin-ssout syscon k *set config (bit4-3=print format,2-0=Active Par Bit),default=06 test bit k if bit (pd0/2/*4/*6) not 0 jmp to line (+-16) toggle bit make bit (pd7-0) change its state write x write to nv memory,auto-inc bptr (b),reset default b=32 k=constant: decimal (0-255), ASCII (' '-'z'), or hex (0x0-0xff) v=variable (a-h) 8 bit x=variable or constant *MVMEG6/MV8515 only I/O MAP ------- dec(hex)asm name bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 8 (08) BAUD 7.3728mhz: 9.6k=253 19.2=125 38.4=61 57.6=40 115.2=18 9 (09) BPTRH free RAM register in 1200, buffer pointer hi in 8515 11 (0B) free RAM register in 1200 26 (14) SYSCON free RAM in 1200 PRNFMT PRNFMT PWMBIT PWMBIT PWMBIT 27 (1B) SERBIT active serial port (0x01=com1 04=com2 10=com3 40=com4) 29 (1D) free RAM register in 1200 31 (1F) free RAM register in 1200 **33 (21) 01 TWSR TWS7 TWS6 TWS5 TWS4 TWS3 - TWPS1 TWPS0 **34 (22) 02 TWAR TWA6 TWA5 TWA4 TWA3 TWA2 TWA1 TWA0 TWGCE **35 (23) 03 TWDR Two-wire Serial Interface Data Register **36 (24) 04 ADCL ADC Data Register Low Byte **37 (25) 05 ADCH ADC Data Register High Byte **38 (26) 06 ADCSR ADEN ADSC ADFR ADIF ADIE ADPS2 ADPS1 ADPS0 **39 (27) 07 ADMUX REFS1 REFS0 ADLAR - MUX3 MUX2 MUX1 MUX0 **40 (28) 08 ACSR ACD ACBG ACO ACI ACIE ACIC ACIS1 ACIS0 *41 (29) 09 UBRR UART Baud Rate Register **42 (2A) 0A UCSRB RXCIE TXCIE UDRIE RXEN TXEN UCSZ2 RXB8 TXB8 **43 (2B) 0B UCSRA RXC TXC UDRE FE DOR PE U2X MPCM *44 (2C) 0C UDR UART I/O Data Register *45 (2D) 0D SPCR SPIE SPE DORD MSTR CPOL CPHA SPR1 SPR0 **46 (2E) 0E SPSR SPIF WCOL - - - - - SPI2X *47 (2F) 0F SPDR SPI Data Register *48 (30) 10 PIND PIND7 PIND6 PIND5 PIND4 PIND3 PIND2 PIND1 PIND0 49 (31) 11 DDRD DDD7 DDD6 DDD5 DDD4 DDD3 DDD2 DDD1 DDD0 *50 (32) 12 PORTD PORTD7 PORTD6 PORTD5 PORTD4 PORTD3 PORTD2 PORTD1 PORTD0 *51 (33) 13 PINC PINC7 PINC6 PINC5 PINC4 PINC3 PINC2 PINC1 PINC0 *52 (34) 14 DDRC DDC7 DDC6 DDC5 DDC4 DDC3 DDC2 DDC1 DDC0 *53 (35) 15 PORTC PORTC7 PORTC6 PORTC5 PORTC4 PORTC3 PORTC2 PORTC1 PORTC0 54 (36) 16 PINB PINB7 PINB6 PINB5 PINB4 PINB3 PINB2 PINB1 PINB0 55 (37) 17 DDRB DDB7 DDB6 DDB5 DDB4 DDB3 DDB2 DDB1 DDB0 56 (38) 18 PORTB PORTB7 PORTB6 PORTB5 PORTB4 PORTB3 PORTB2 PORTB1 PORTB0 **60 (3C) 1C EECR - - - - EERIE EEMWE EEWE EERE *61 (3D) 1D EEDR EEPROM Data Register *62 (3E) 1E EEARL EEPROM Address Register Lo *63 (3F) 1F EEARH EEPROM Address Register Hi *65 (41) 21 WDTCR - - - WDTOE WDE WDP2 WDP1 WDP0 **66 (42) 22 ASSR - - - - AS2 TCN2UB OCR2UB TCR2UB **67 (43) 23 OCR2 Timer/Counter2 Output Compare Register *68 (44) 24 TCNT2 Timer/Counter2 (8 Bits) *69 (45) 25 TCCR2 FOC2 WGM20 COM21 COM20 WGM21 CS22 CS21 CS20 **70 (46) 26 ICR1L Timer/Counter1 Input Capture Register Low Byte **71 (47) 27 ICR1H Timer/Counter1 Input Capture Register High Byte *72 (48) 28 OCR1BL Timer/Counter1 Output Compare Register B Low Byte *73 (49) 29 OCR1BH Timer/Counter1 Output Compare Register B High Byte *74 (4A) 2A OCR1AL Timer/Counter1 Output Compare Register A Low Byte *75 (4B) 2B OCR1AH Timer/Counter1 Output Compare Register A High Byte *76 (4C) 2C TCNT1L Timer/Counter1 Counter Register Low Byte *77 (4D) 2D TCNT1H Timer/Counter1 Counter Register High Byte **78 (4E) 2E TCCR1B ICNC1 ICES1 - WGM13 WGM12 CS12 CS11 CS10 **79 (4F) 2F TCCR1A COM1A1 COM1A0 COM1B1 COM1B0 FOC1A FOC1B WGM11 WGM10 **80 (50) 30 SFIOR - - - ADHSM ACME PUD PSR2 PSR10 **81 (51) 31 OSCCAL Oscillator Calibration Register 82 (52) 32 TCNT0 Timer/Counter0 8 Bit *83 (53) 33 TCCR0 - - - - - CS02 CS01 CS00 **84 (54) 34 MCUCSR - - - - WDRF BORF EXTRF PORF **85 (55) 35 MCUCR SE SM2 SM1 SM0 ISC11 ISC10 ISC01 ISC00 **86 (56) 36 TWCR TWINT TWEA TWSTA TWSTO TWWC TWEN - TWIE **87 (57) 37 SPMCR SPMIE RWWSB - RWWSRE BLBSET PGWRT PGERS SPMEN **88 (58) 38 TIFR OCF2 TOV2 ICF1 OCF1A OCF1B TOV1 - TOV0 **89 (59) 39 TIMSK OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 - TOIE0 *90 (5A) 3A GIFR INTF1 INTF0 *91 (5B) 3B GICR INT1 INT0 - - - - IVSEL IVCE *93 (5D) 3D SPL SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 *94 (5E) 3E SPH SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 *95 (5F) 3F SREG I T H S V N Z C *96-101 (60-65) SEC,MIN,HR,DAY,MO,YR RTCC (Real-Time-Calendar-Clock) *105-255 (69-ff) USER NVRAM, contents preserved in power down mode ("end") **MVMEG6 *MV8515 PINOUT ------ MVMEG6 RESETL/PC6 1 pin 28 PC5/ADC5 RX1/PD0 2 27 PC4/ADC4 TX1/PD1 3 26 PC3/ADC3 RX2/PD2 4 25 PC2/ADC2 TX2/PD3 5 24 PC1/ADC1 RX3/PD4 6 23 PC0/ADC0 VCC 7 22 GND GND 8 21 AREF XI/PB6 9 20 AVCC XO/PB7 10 19 PB5 TX3/PD5 11 18 PB4 PWM/PD6 12 17 PB3 TX4/PD7 13 16 PB2 PB0 14 15 PB1 ABSOLUTE MAXIMUM RATINGS Operating Temperature ........................ -40C to +105C NOTICE: Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. Storage Temperature...................................... -65C to +150C Voltage on any Pin except RESET with respect to Ground .. -1.0V to +7.0V Maximum Operating Voltage................................ 6.6VDC Current per I/O Pin...................................... 40.0 mA DC Current VCC and GND Pins................................. 140.0 mA DC CHARACTERISTICS TA = -40C to 85C, VCC = 2.7V to 6.6V (unless otherwise noted) Under steady state (non-transient) conditions, IOL must be externally limited: Maximum IOL per port pin: Port A: 26 mA Ports B, C, D: 15 mA Maximum total IOL for all output pins: 80mA If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test conditions. Minimum VCC for Power Down is 2V. Value tested to 45C Symbol Parameter Conditions Min Typ Max Units VIL Input Low Voltage -0.2 .2 VCC-0.1 V VIH Input High Voltage (Except XTLI, RESET) .2VCC .9 VCC+.5 V VIH1 Input High Voltage (XTLI, RESET) 0.7VCC VCC+.5 V VOL Output Low Voltage IIL=25mA VCC=5V 0.5 V VOH Output High Voltage IOH=3mA VCC=5V VCC-.5 V IOH Output Source Current VCC=5V VOH=4.5V 4 mA IIL Output Sink Current VCC=5V VOL=0.5V 28 mA RRST Reset Pull-Up Resistor 100 500 kohm RI/O Pin Pull-Up Resistor 35 120 kohm ICC Supply Current Active Mode 5V 4MHz 3.5 mA Idle Mode 3V 4MHz 500 uA Power Down WDT enabled 3V 10 15 uA Power Down WDT disabled 3V 0.15 1 uA VACIO Analog Comparator Offset Voltage VCC=5V 20 mV IACLK Analog Comparator Leakage Current VIN=1V 10 nA tACPD Analog Comparator Propagation Delay VCC=4V 500 ns External Clock Drive Symbol Parameter VCC=2.7V VCC=5.0V Units Min Max Min Max 1/tCLCL Oscillator Frequency 0 4 0 16 MHz tCLCL Clock Period 250 62.5 ns tCHCX High Time 40 16.7 ns tCLCX Low Time 40 16.7 ns tCLCH Rise Time 10 4.15 ns tCHCL Fall Time 10 4.15 ns LIMITED WARRANTY MVS will repair free of charge product suffering from manufacturing defects for a period of 5 years after shipping. This will be done only if it has been determined by MVS that the product has not been misused (improper voltages, physical alteration, etc.). Otherwise a minimum service charge is required. In either case it is necessary to contact MVS for a Returned Merchandise Authorization (RMA) number before shipping the unit.