SDCC 学习
2024-10-21 17:33:40
单个led.c文件
#include <stdbool.h> __sfr __at(0xb0) P3; __sfr __at(0x88) TCON;
__sfr __at(0x89) TMOD;
__sfr __at(0x8a) TL0;
__sfr __at(0x8c) TH0; __sfr __at(0xa8) IE; volatile unsigned long int clocktime;
volatile _Bool clockupdate; void clockinc(void) __interrupt(1)
{
TH0 = (65536 - 922) / 256;
TL0 = (65536 - 922) % 256;
clocktime++;
clockupdate = true;
} unsigned long int clock(void)
{
unsigned long int ctmp; do
{
clockupdate = false;
ctmp = clocktime;
} while (clockupdate); return(ctmp);
} void main(void)
{
// Configure timer for 11.0592 Mhz default SYSCLK
// 1000 ticks per second
TH0 = (65536 - 922) / 256;
TL0 = (65536 - 922) % 256;
TMOD = 0x01;
IE |= 0x82;
TCON |= 0x10; // Start timer for(;;)
P3 = ~(clock() / 1000) & 0x03;
}
编译:
sdcc-sdcc led.c
生成的文件
led.asm led.c led.ihx led.lk led.lst led.map led.mem led.rel led.rst led.sym
生成的led.ihx转位led.hex
sdcc-packihx led.ihx > led.hex
最新文章
- Freeswitch 添加可转码的G729编码
- Heartbeat使用梳理
- gulp 安装 使用 和删除
- 基于Mono.Cecil的静态注入
- Java命名约定
- qq2440启动linux后插入u盘出现usb 1-1: device descriptor read/64, error -110,usb 1-1: device not accepting address 8, error -110
- sql,插入最大值加1
- python学习小结2:if和while控制语句
- C#中的OLEDB连接2
- QuerryRunner Tools
- PHP - 数组去重,(折中:符串去重)
- Swift 实现俄罗斯方块详细思路解析(附完整项目)
- Python学习笔记(九)
- 系列博文-LowPoly风格的图像生成器
- JavaScriptCore全面解析
- java基础 易忘易混点复习1
- centos7.2重新安装yum
- Linux的nmon监控结果分析文件中网络分析NET
- ecmall 的一些方法说明
- SELECT INTO 和 INSERT INTO SELECT比较