Pit assembly programming (1)

Source: Internet
Author: User

Aeriskar single chip microcomputer (xs128 series) Single Chip Microcomputer assembly programming (1)

I am a cainiao. I learned assembly programming from cainiao. Compilation is not as complicated and difficult as I imagined. It is quite interesting to have a good taste. Let's get started with the compilation (this has always been my biggest heart disease). Learn it slowly, but I have a wish. As my first assembler, I carefully wrote the process. Now, let's get started.

Materials on hand: flykar single chip microcomputer, debugger and manual (ou, these three), by the way, the assembly instruction set of the next flykar single chip microcomputer.

Start the following tasks:

First, we should be familiar with the interrupt mechanism, determine which part of the programming we want, and the effect we will play after the programming, so that we can better program. For details, refer:


Programming part: refer to the Manual to find the pit part. Based on the previous C language programming experience, the timer is mainly implemented by configuring the corresponding registers. For this reason, we configure the required registers, there are too many registers in it (right ),

In fact, each single-chip microcomputer has a functional block diagram of the corresponding module. As shown in:

In this section, the manual provides a routine:

The reason why the arrow at mark 1 is yellow is that this is wrong (I am also very miserable ). In the attached program, how can I modify the table (last)? In fact, you can just think about it and find out that the interrupt vector table is in the read-only storage area, how can movw use it ).

The movb #$01 and pittf statements at the third part of the label must exist in order to clear the corresponding mark (there is a difference between this and 51, which has been entangled For A Long Time ).

The following is an attachment to my program:

; **************************************** **********************; * This stationery serves as the framework for a *; * user application. for a more comprehensive program that *; * demonstrates the more advanced functionality of this *; * processor, please see the demonstration Applications *; * located in the examples subdirectory of *; * Freescale codewarrior for the hc12 program directory *; **************************************** **********************; include derivative-specific definitions include 'derivative. INC '; export symbols xdef entry, _ startup, main; we use export 'entry' as symbol. this allows us to; reference 'entry 'either in the linker. PRM file; or from C/C ++ later on xref _ seg_end_sstack; symbol defined by the linker for the end of the stack; variable/Data sectionmy_extended_ram: Section; insert here your data definition .; code sectionmycode: sectionmain: _ startup: entry: lDs #__ seg_end_sstack; initialize the stack pointer Pu SEI; ********** shut down the watchdog CLR copctl; * ******* set movb # $ ff, ddrb movb # $55, portb BCLR pitcflmt, #128 bset pitce, #1 BCLR pitmux, #1 ldab #244 stab pitmtld0 LDD #65535 STD pitld0 bset pitcflmt, #128 bset pittf, #1 bset pitinte, #1 clrx CLI; Enable interruptsmainloop: bra mainloopch0_isr: com portb bset pittf, #1 rrorg $ ff7a FDB ch0_isr



Pit assembly programming (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.