esp32微型计算机,ESP32 ROM console

ESP32 ROM console¶

When an ESP32 is unable to boot from flash ROM (and the fuse disabling it hasn’t been blown), it boots into a rom console. The console

is based on TinyBasic, and statements entered should be in the form of BASIC statements. As is common in the BASIC language, without a

preceeding line number, commands entered are executed immediately; lines with a prefixed line number are stored as part of a program.

Full list of supported statements and functions¶

System¶

BYE - exits Basic, reboots ESP32, retries booting from flash

END - stops execution from the program, also “STOP”

MEM - displays memory usage statistics

NEW - clears the current program

RUN - executes the current program

IO, Documentation¶

PEEK( address ) - get a 32-bit value from a memory address

POKE - write a 32-bit value to memory

USR(addr, arg1, ..) - Execute a machine language function

PRINT expression - print out the expression, also “?”

PHEX expression - print expression as a hex number

REM stuff - remark/comment, also “’”

Expressions, Math¶

A=V, LET A=V - assign value to a variable

+, -, *, / - Math

,!=,>=,> - Comparisons

ABS( expression ) - returns the absolute value of the expression

RSEED( v ) - sets the random seed to v

RND( m ) - returns a random number from 0 to m

A=1234 - * Assign a decimal value*

A=&h1A2 - * Assign a hex value*

A=&b1001 - Assign a binary value

Control¶

IF expression statement - perform statement if expression is true

FOR variable = start TO end - start for block

FOR variable = start TO end STEP value - start for block with step

NEXT - end of for block

GOTO linenumber - continue execution at this line number

GOSUB linenumber - call a subroutine at this line number

RETURN - return from a subroutine

DELAY - Delay a given number of milliseconds

Pin IO¶

IODIR - Set a GPIO-pin as an output (1) or input (0)

IOSET - Set a GPIO-pin, configured as output, to high (1) or low (0)

IOGET - Get the value of a GPIO-pin

Example programs¶

Here are a few example commands and programs to get you started…

Read UART_DATE register of uart0¶

> PHEX PEEK(&h3FF40078)

15122500

Set GPIO2 using memory writes to GPIO_OUT_REG¶

Note: you can do this easier with the IOSET command

> POKE &h3FF44004,PEEK(&h3FF44004) OR &b100

Get value of GPIO0¶

> IODIR 0,0

> PRINT IOGET(0)

0

Blink LED¶

Hook up an LED between GPIO2 and ground. When running the program, the LED should blink 10 times.

10 IODIR 2,1

20 FOR A=1 TO 10

30 IOSET 2,1

40 DELAY 250

50 IOSET 2,0

60 DELAY 250

70 NEXT A

RUN

Credits¶

The ROM console is based on “TinyBasicPlus” by Mike Field and Scott Lawrence, which is based on “68000 TinyBasic” by Gordon Brandly

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值