1 / 14

The PSoC is Controlled by the CPU Core

What does M8C ASM Code look like?. include "m8c.inc" ; part specific constants and macrosinclude "memory.inc" ; Constants

skyla
Download Presentation

The PSoC is Controlled by the CPU Core

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. The PSoC is Controlled by the CPU Core The M8C CPU Core is the master of the PSoC Provides basic CPU functions Interfaces with peripherals The M8C Core can be programmed in Assembly Language or C Assembly Language best for getting started ASM language requires little configuration ASM language good for small or medium projects Embedded C may be preferred later on Makes larger projects easier Requires more configuration More difficult to control resources

    2. What does M8C ASM Code look like? include "m8c.inc" ; part specific constants and macros include "memory.inc" ; Constants & macros for SMM/LMM and Compiler include "PSoCAPI.inc" ; PSoC API definitions for all User Modules export _main area bss (RAM) outputV: blk 1 area text (ROM, REL) _main: mov [outputV],0 //clear output value Loop1: inc [outputV] //increment output value cmp [outputV],200 //check if = 200 jnz Loop1 // not equal, loop mov [outputV],0 // reset to 0 jmp Loop1 // loop again .terminate: jmp .terminate

    4. PSoC Operands Instructions all need operands (source, destination) Operands may be in accumulators, memory, or the instruction itself Addressing modes determine how to to find the operands

    5. Addressing Modes An operand may be in: Accumulator (register) A Memory Device control registers

    6. Addressing Mode: Source Immediate The simplest addressing mode is Source Immediate The value for the operand is specified in the instruction itself

    7. Addressing Mode: Source Direct To read memory, use Source Direct Specify the memory location to read from in square brackets

    8. Addressing Mode: Destination Direct To write memory, use Destination Direct Specify the memory location to read from in square brackets

    9. Addressing Mode: Source/Dest Indexed To use pointers, use Indexed Mode Use the X register as a pointer May add an offset to it Use square brackets and a ‘+’ sign

    10. Addressing Mode: Dest Direct Source Immediate To use immediate data as a source and write the result into memory Specify the memory location to read from in square brackets

    11. Addressing Mode: Dest Indexed Source Imm. To use immediate data as a source and write the result into memory in indexed mode Specify the memory location to read from in square brackets

    12. Addressing Mode: Dest Direct Source Direct To copy data from one memory location to another Specify both memory locations in square brackets

    13. Addressing Mode: Source Indirect Post Increment To copy memory pointed to by another memory location into a register and increment the pointer Use the special MVI instruction Specify the pointer in square brackets

    14. Addressing Mode: Dest Indirect Post Increment To copy a register to memory pointed to by another memory location and increment the pointer Use the special MVI instruction Specify the pointer in square brackets

    15. Addressing Mode Summary To specify immediate data, write it normally MOV A, 13 To specify memory, put it in square brackets MOV A, [22] MOV [13],A MOV A,[X+12] To specify control registers, use REG[ ] MOV A,REG[19] MOV REG[13],A Post-increment mode only works with MVI MVI A,[14] MVI [32],A

More Related