1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

wemosでアセンブラ その2

Posted at

#概要

wemos d1でアセンブラやってみた。
Lチカ、やってみた。

#サンプルコード

int v = 0;

void led_off(void) {
	asm volatile (
		"movi	a2, 0x60000304;"
		"movi	a3, 0x60000308;"
		"movi	a4, 0x00000004;"
		"s32i	a4, a3, 0;"
		"memw;"
		:
		:
		: "a2", "a3", "a4", "memory"
	);
}
void led_on(void) {
	asm volatile (
		"movi	a2, 0x60000304;"
		"movi	a3, 0x60000308;"
		"movi	a4, 0x00000004;"
		"s32i	a4, a2, 0;"
		"memw;"
		:
		:
		: "a2", "a3", "a4", "memory"
	);
}


void setup() {
	int i;
	Serial.begin(9600);
	while (!Serial)
	{
		;
	}
	Serial.println("start");
	pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
	if (v == 0)
	{
		led_off();
		v = 1;
	}
	else
	{
		led_on();
		v = 0;
	}
	delay(800);
}





以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?