| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| logicpython:index [2026/04/10 02:26] – [System and Debug] admin | logicpython:index [2026/04/14 05:15] (current) – [Modbus RTU Communication] mfranklin |
|---|
| ====== LogicPython User Documentation ====== | ====== LogicPython ====== |
| |
| LogicPython is a browser-based Python development environment for RP2350 hardware. | LogicPython is a browser-based Python development environment for microcontrollers. |
| The target device must be an RP2350-based device with LogicPython firmware installed. | The target device must be a microcontroller board device with LogicPython firmware installed. |
| You can edit code, deploy to the device, run programs, monitor output, and use AI-assisted editing. | You can edit code, deploy to the device, run programs, monitor output, and use AI-assisted editing. |
| |
| ===== CUBLOC API Reference ===== | ===== CUBLOC API Reference ===== |
| |
| The CUBLOC API pages are grouped by category. Each entry links to a dedicated page and includes a short description. | LogicPython includes a [[cubloc:index|CUBLOC]] API for those who wish to leverage their familiarity with the [[cubloc:index|CUBLOC]] platform. |
| |
| ==== Analog Input ==== | ==== Analog Input ==== |
| ==== Memory and Storage ==== | ==== Memory and Storage ==== |
| |
| * [[logicpython:cubloc_api:eeread|EERead]] - Read bytes from per-''address'' backing files named like _ee_0000. | * [[logicpython:cubloc_api:eeread|EERead]] - Read data from a non-volatile memory. |
| * [[logicpython:cubloc_api:eewrite|EEWrite]] - Write bytes into per-''address'' backing files named like _ee_0000. | * [[logicpython:cubloc_api:eewrite|EEWrite]] - Write data to a non-volatile memory. |
| |
| ==== Number Formatting ==== | |
| |
| * [[logicpython:cubloc_api:decn|DecN]] - Decimal formatting variants: ''Dec'' and ''Dec1'' through ''Dec11''. | ==== PWM ==== |
| * [[logicpython:cubloc_api:dp|DP]] - Convert an integer to a right-justified decimal string. | |
| * [[logicpython:cubloc_api:float|Float]] - Convert a numeric ''value'' to a fixed-point string with 5 decimal places. | |
| * [[logicpython:cubloc_api:fp|FP]] - Format a floating-point number with fixed whole and fractional digit counts. | |
| * [[logicpython:cubloc_api:hexn|HexN]] - Hex formatting variants: ''Hex'' and ''Hex1'' through ''Hex8''. | |
| * [[logicpython:cubloc_api:hp|HP]] - Convert an integer to a right-justified uppercase hexadecimal string. | |
| |
| ==== PWM and Counters ==== | |
| |
| * [[logicpython:cubloc_api:count|Count]] - Return the current pulse count for the specified counter ''channel''. | |
| * [[logicpython:cubloc_api:countreset|CountReset]] - Reset the pulse count for the specified counter ''channel'' to 0. | |
| * [[logicpython:cubloc_api:freqout|FreqOut]] - ''Output'' a square-wave frequency on the specified PWM ''channel''. | |
| * [[logicpython:cubloc_api:pwm|Pwm]] - ''Output'' a PWM waveform on the specified ''channel''. | * [[logicpython:cubloc_api:pwm|Pwm]] - ''Output'' a PWM waveform on the specified ''channel''. |
| * [[logicpython:cubloc_api:pwmoff|PwmOff]] - Stop PWM output on the specified ''channel''. | * [[logicpython:cubloc_api:pwmoff|PwmOff]] - Stop PWM output on the specified ''channel''. |
| |
| ==== Serial and Communication ==== | ==== Modbus RTU Process ==== |
| |
| * [[logicpython:cubloc_api:bclr|BClr]] - Clear the RS-232 receive buffer, send buffer, or both buffers. | |
| * [[logicpython:cubloc_api:bfree|BFree]] - Return the number of free bytes in a receive or send buffer. | |
| * [[logicpython:cubloc_api:blen|BLen]] - Return the number of bytes currently in a receive or send buffer. | |
| * [[logicpython:cubloc_api:checkbf|CheckBf]] - Return the number of bytes waiting in the receive buffer without consuming them. | |
| * [[logicpython:cubloc_api:get|Get]] - Read up to 4 bytes from the receive buffer as a little-endian integer. | |
| * [[logicpython:cubloc_api:geta|GetA]] - Read bytes into a mutable byte array. | |
| * [[logicpython:cubloc_api:geta2|GetA2]] - Read bytes into a mutable byte array until a stop character is found. | |
| * [[logicpython:cubloc_api:getcrc|GetCrc]] - Calculate the MODBUS RTU CRC-16 of a byte array slice. | |
| * [[logicpython:cubloc_api:getstr|GetStr]] - Read string data from the RS-232 receive buffer. | |
| * [[logicpython:cubloc_api:getstr2|GetStr2]] - Read string data until a stop character is encountered. | |
| * [[logicpython:cubloc_api:opencom|OpenCom]] - Enable serial communication on a CUBLOC-style ''channel''. | |
| * [[logicpython:cubloc_api:put|Put]] - Send an integer value as 1 to 4 little-endian bytes. | |
| * [[logicpython:cubloc_api:puta|PutA]] - Send a byte ''array'' on the specified RS-232 ''channel''. | |
| * [[logicpython:cubloc_api:puta2|PutA2]] - Send a byte ''array'' until a stop character is encountered. | |
| * [[logicpython:cubloc_api:putstr|PutStr]] - Send string ''data'' on the specified RS-232 ''channel''. | |
| * [[logicpython:cubloc_api:setmodbus|SetModbus]] - Start the LogicPython Modbus RTU slave worker using a pre-opened UART ''channel''. | * [[logicpython:cubloc_api:setmodbus|SetModbus]] - Start the LogicPython Modbus RTU slave worker using a pre-opened UART ''channel''. |
| * [[logicpython:cubloc_api:setrs232|SetRS232]] - Reconfigure an already-open RS-232 ''channel'' with a new baud rate and ''protocol''. | |
| * [[logicpython:cubloc_api:waittx|WaitTx]] - ''Wait'' until the send buffer for the specified RS-232 ''channel'' is flushed. | |
| |
| ==== Stepper and Pulse Motion ==== | ==== Stepper and Pulse Motion ==== |
| |
| |
| ==== System and Debug ==== | |
| |
| * [[logicpython:cubloc_api:debug|Debug]] - Print debug ''values'', interpreting CUBLOC debug control codes. | |
| * [[logicpython:cubloc_api:setdebug|SetDebug]] - Enable or disable ''Debug'' output. | |
| * [[logicpython:cubloc_api:setonglobal|SetOnGlobal]] - Enable or disable CUBLOC-style global interrupt handling. | |
| * [[logicpython:cubloc_api:sys|Sys]] - Return a supported CUBLOC system status value. | |
| * [[logicpython:cubloc_api:time|Time]] - Read system RTC values for addresses 10 through 13. | |
| |
| ==== Timing and Delays ==== | |
| |
| * [[logicpython:cubloc_api:delay|Delay]] - ''Delay'' execution for the given number of ''milliseconds''. | |
| * [[logicpython:cubloc_api:ontimer|OnTimer]] - Register a periodic timer ''callback'' using CUBLOC ''OnTimer'' semantics. | |
| * [[logicpython:cubloc_api:pause|Pause]] - ''Pause'' execution for the given interval in ''milliseconds''. | |
| * [[logicpython:cubloc_api:setontimer|SetOnTimer]] - Enable or disable execution of callbacks registered with ''OnTimer''. | |
| * [[logicpython:cubloc_api:udelay|UDelay]] - ''Delay'' execution for the given number of ''microseconds''. | |
| * [[logicpython:cubloc_api:wait|Wait]] - ''Delay'' execution for the given interval in ''milliseconds''. | |
| |
| |