10.07.2015 Views

MPLAB® C30 C 编译器用户指南

MPLAB® C30 C 编译器用户指南

MPLAB® C30 C 编译器用户指南

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MPLAB C18 与 MPLAB <strong>C30</strong> C 编 译 器 比 较C.6 存 储 限 定 符MPLAB C18 使 用 非 ANSI 的 far、 near、 rom 和 ram 类 型 限 定 符 。MPLAB <strong>C30</strong> 使 用 非 ANSI 的 far、 near 和 space 属 性 。例 C-1:定 义 NEAR 变 量C18: near int gVariable;<strong>C30</strong>: __attribute__((near)) int gVariable;例 C-2:定 义 FAR 变 量C18: far int gVariable;<strong>C30</strong>: __attribute__((far)) int gVariable;例 C-3:生 成 在 程 序 存 储 器 中 的 变 量C18: rom int gArray[6] = {0,1,2,3,4,5};<strong>C30</strong>: __attribute__((section(".romdata"), space(prog) ))int gArray[6] = {0,1,2,3,4,5};C.7 预 定 义 宏 名MPLAB C18 定 义 了 __18CXX, __18F242,…… ( 所 有 其 他 以 __ 为 前 缀 的 处 理器 ), 以 及 __SMALL__ 或 __LARGE__, 这 取 决 于 所 选 择 的 存 储 模 型 。MPLAB <strong>C30</strong> 定 义 了 __dsPI<strong>C30</strong>。C.8 整 型 的 提 升MPLAB C18 按 照 最 大 操 作 数 的 大 小 执 行 整 型 的 提 升 , 即 使 两 个 操 作 数 长 度 都 小 于int。 MPLAB C18 提 供 了 -Oi+ 选 项 来 与 标 准 符 合 。MPLAB <strong>C30</strong> 按 照 ISO 的 要 求 , 以 int 精 度 或 更 高 精 度 执 行 整 型 的 提 升 。C.9 字 符 串 常 量MPLAB C18 将 字 符 串 常 量 保 存 在 程 序 存 储 器 中 的 .stringtable 段 中 。MPLAB C18支 持 字 符 串 函 数 的 几 种 形 式 。 例 如 , strcpy 函 数 有 四 种 形 式 , 允 许 将 字 符 串 从 数 据存 储 器 和 程 序 存 储 器 拷 贝 到 数 据 存 储 器 和 程 序 存 储 器 。MPLAB <strong>C30</strong> 通 过 PSV 窗 口 来 访 问 数 据 存 储 器 或 程 序 存 储 器 中 的 字 符 串 常 量 , 允 许 像 访问 任 何 其 他 数 据 一 样 访 问 常 量 。© 2005 Microchip Technology Inc. DS51284C_CN 第 155 页

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!