VOOZH about

URL: https://qiita.com/ohisama@github/items/d2882a01ab72451c2272

⇱ wemosでアセンブラ その2 #Lチカ - Qiita


👁 Image
1

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 3 years have passed since last update.

@ohisama@github

wemosでアセンブラ その2

1
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

Go to list of users who liked

0
0

Go to list of comments

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

Go to list of users who liked

0