Λ 1 1 1 1 1 1 1 电子技术余新拴等: C51 与汇编语言混合编程在单片机 IAP 中的应用 C51 与汇编语言混合编程在单片机 IAP 中的应用 余新拴, 李建忠 (陕西理工学院陕西汉中 723003) 摘要: 单片机在应用中编程 IAP ( In A pp lication P rogramm ing) 是单片机应用的新技术, 可以实现用户应用程序对 FLA SH 存储器编程、擦除和读存储器等功能, 但是, 使用单片机高级语言 C51 编程开发应用程序时不容易直接调用 IAP 功 能。介绍了 P89C51RD 2 单片机闪存的操作特点及其 IAP 功能实现原理。结合 C51 调用汇编语言子程序时的参数传递规律, 分析应用 C51 与汇编语言混合编程向特定寄存器中写入相应参数调用 IAP 功能子程序的方法。通过实例, 给出了向 IAP 子 程序传递参数的 C51 程序及相应的汇编程序, 实现了 IAP 功能。在 Keil V ision2 下仿真和实验, 该方法切实可行。 关键词: IAP; C51; P89C51RD 2 单片机; 汇编程序 中图分类号: T P313 文献标识码: B 文章编号: 1004 373X (2005) 23 106 03 Application of C51 and A ssembler′s Program in IAP for M icrocon troller YU X inshuan,L I J ianzhong (ShaanxiU niversity of Techno logy, H anzhong, 723003, China) Abs tra c t: In A pp lication P rogramm ing ( IAP) is developed as the new est technique in design o r developm ent fo r m icrocontro ller app lication system U ser p rogram can erase F lash p rogram m emo ry block, p rogram byte and verify byte How ever, it is difficult to call the IAP routines directly in app lication developed w ith m icrocontro ller′s h igh level language C51 T he basic p rinciple of IAP in P89C51RD 2 m icrocontro ller is introduced, as w ell as the characteristics of F lash p rogram m emo ry w ith IAP T he m ethod fo r IAP by C51 and assem bler p rogram is analysed,w h ich ach ieves the aim fo m unicating w ith the IAP