51单片机keil 库函数说明

NOTE

The Keil C51 library includes a number of helper routines for the C51 compiler. These routines perform mundane tasks like loading and storing objects. The code to perform these operations is not included in-line but is implemented via a function call.

These routines are named using the following convention: ?C?tffmmm

where:

  • t is the type field,
  • ff is the function field,
  • and mmm is the memory type field.
TYPE FIELD

The type field is a character that indicates the data type used:

  • C indicates a character that is passed in A.
  • I indicates an int that is passed in A/B.
  • P indicates a 3-byte pointer that is passed in R1/R2/R3.
  • L indicates a long that is passed in R4/R5/R6/R7.
  • L0 indicates a long that is passed in R0/R1/R2/R3.
FUNCTION FIELD

The function field indicates the operation that is performed:

  • LD indicates a read (load) operation.
  • ILD indicates an increment and load operation (pre-increment load). The increment value is passed in A/B.
  • LDI indicates a load and increment operation (post-increment load). The increment value is passed in A/B.
  • ST indicates a write (store) operation.
  • STK indicates writing of constant data encoded as DB statements immediately following the library function call.
MEMORY TYPE FIELD

The memory type field indicates that memory area that is accessed:

  • XDATA represents XDATA memory.
  • PDATA represents PDATA memory.
  • IDATA represents IDATA memory.
  • DATA represents DATA memory.
  • CODE represents CODE memory.
  • PTR represents a 3-byte pointer in R1/R2/R3.
  • OPTR represents a 3-byte pointer plus an offset in R1/R2/R3 + DPTR.
EXAMPLE

The library routine ?C?PLDIPTR is passed a generic pointer in R1/R2/R3 (P). This pointer points to a pointer which is returned in R1/R2/R3 (PTR). A/B contain the MSB and LSB of a value to add to the pointer (LDI). The pointer returned is the pointer value before the increment is added.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值