Android‎ > ‎

AndMCU




  Available at Google Play Market (FREE!):
 
         

* The Documentation page is  >>here.<<


INTRODUCTION:

The MCU simulator for Android OS runs Assembly language code similar to the  68705 MCU on a simulated on-screen prototype board.
Great for embedded applications hobbyists, students, teachers or anyone who likes to experiment with electronic Micro-controller prototype boards.

AndMCU simulates both software and hardware. As on a real prototype board, your ASM code must properly configure the 
MCU I/O ports to control the hardware connected to it, such as lighting up segments on the digits, or reading keystrokes from 
the keypad or dip-switches.

You can use the simple built-in text editor or any Android text editor of your choice to write your assembly code and then load it into AndMCU to run it.
 
The built-in assembler has many useful directives such as step-by-step trace mode, break-points, dumping memory contents
 to an HTML file, adjusting the CPU speed and auto-running the loaded code.

It supports the following opcodes (subset of the 68705 MCU instruction set):


NOP,CLC,CLI,SEC,SEI,STOP,SWI,TAX,TXA,
LDA,LDX,STA,STX,
 
ADD,ADC,CLR,CLRA,CLRX,DEC,DECA,DECX,
INC,INCA,INCX,SUB,SBC,
AND,CMP,COM,COMA,COMX,CPX,EOR,LSL,LSLA,LSLX,LSR,LSRA,LSRX,NEG,NEGA,
ORA,ROL,ROLA,ROR,RORA,TST,TSTA,
BRA,BSR,BCC,BCS,BEQ,BNE,BHI,BLO,BLS,JMP,JSR,RTS,RTI, 
BCLR,BSET.


The AndMCU board simulates the following hardware components:

 
 1) 8-Bit CPU with 3x 8-bit bi-directional ports.
 2) 6 Digits display
 3) 16-character LCD display
 4) 2x 8-bit DIP Switches
 5) 2x8 LED Bargraph displays
 6) 12-key keypad
 7) 1 piezo buzzer
 8) External Interrupt push-button
 9) Timer interrupt
10) 1 Analog input (light sensor).


SCREEN-SHOTS:
 
 
 
 
 
 


SCHEMATIC OF SIMULATED HARDWARE:






SAMPLE ASM CODE:


; Comment line  

.autorun ; Auto-run file at startup

.speed 100 ; set CPU speed


PORTA   equ 0x0
PORTB   equ 0x1
PORTC   equ 0x2
DDRA    equ 0x3
DDRB    equ 0x4
DDRC    equ 0x5


key equ 20 ; key register

segreg equ 30           ; segments registry


.lcd "Press keys" ; Startup message on LCD


; --------------
;   Initialize
; --------------

init:    
        lda #255
        sta DDRA ; port A output
        lda #0
        sta DDRB ; port B input    
        lda #15
        sta DDRC
 
loop:
        jsr scan ; handle both key and display
        lda key
        cmp #255
        beq loop ; no pressed key
 
        tax
        lda digdef,x ; convert for segment 
        ldx #2
        sta segreg,x    ; register pressed key on first digit 
 
        jmp loop


; ------------------
;   Scan routine
; ------------------

scan:
        ldx #2
        lda #255
        sta key ; clear key register
 
lp1:    
        lda #15
        sta PORTC ; disable 7442
 
        lda segreg,x   ; read segment registry
        sta PORTA ; send to digit
        stx PORTC ; select current column
 
        lda PORTB ; read keypad
        cmp #255
        beq next        ; no key pressed 
 
        cmp #254 ; top row key
        bne cn1
        lda keytab1,x
        sta key
        rts
 
cn1:    
        cmp #127 ; bottom row key
        bne next
        lda keytab2,x 
        sta key
        rts
 
next:   
        incx
        cpx #8
        bne lp1
        rts


digdef:
        .db 63,3,109,103,83,118,126,35,127,119,123,94,60,79,124,120,0 
 
keytab1:
        .db 0,0,1,2,3,4,5,10,0
 
keytab2: 
        .db 0,0,6,7,8,9,0,11,0


Subpages (1): AndMCU Documentation