Steward
分享是一種喜悅、更是一種幸福
微處理器 - Lattice GAL22V10 - C/C++ - LED
參考資訊:
https://www.stcmicro.com/datasheet/STC15F204EA-cn.pdf
https://www.stcmicro.com/datasheet/STC15F2K60S2-en.pdf
Register


main.c
#include <mcs51/8051.h>
#define LED P1_2
void delay(unsigned long ms)
{
while (ms--);
}
int main(void)
{
while (1) {
LED ^= 1;
delay(100000);
}
return 0;
}
Makefile
all: /usr/bin/sdcc main.c packihx main.ihx > main.hex flash: timeout 30 stcgal -P stc15 -p /dev/ttyUSB0 -l 9600 -b 9600 -t 11059 main.hex clean: rm -rf main.ihx main.lst main.mem main.rst main.lk main.map main.rel main.sym main.hex main.asm
編譯、燒錄
$ make $ make flash
P.S. 執行make flash後, 再上電STC15即可進入燒錄模式
完成
