Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : V6.00.00RC5 will be the release unless you tell me ortherwise
Page 1 of 3 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9080 |
Please can I encourage everyone to try V6.00.00RC15 and report any issues. This version will become the 6.00.00 final release unless any bugs are reported. Historically I make a release and only then bugs are found. I'd like to avoid this -this time! Please don't bother asking for any changes....... PicoMiteRP2040V6.00.00RC15.zip PicoMiteRP2350V6.00.00RC15.zip |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 206 |
Is it correct that counter variables used within sub routines are not local by default? ' local variable test Dim i = 99 Print "i=";i Sub test() Local i = 0 For i = 1 To 10 Print i Next i End Sub test() Print "i=";i results correctly in: i= 99 1 2 3 4 5 6 7 8 9 10 i= 99 If local i=0 within the sub is commented out, then the global i is used within the for next. I don't know why my expectation is that the a counter variable within a sub is always local to the sub - but may be this has its origin from other programming languages ;-) ' local variable test Dim i = 99 Print "i=";i Sub test() 'Local i = 0 For i = 1 To 10 Print i Next i End Sub test() Print "i=";i > run i= 99 1 2 3 4 5 6 7 8 9 10 i= 11 so the sub has modified my "global" i. -andreas |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Hello Andreas, Yes, as long as you dont declare them as local within a Sub or Function, they are global Cheers Martin 'no comment |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 206 |
may be dangerous. if you have a complex program (longer than 1 page;) and some subroutines then you have to take care that all subroutine-variables are declared 'local' otherwise you risk funny value changes in the main program. -andreas |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9080 |
Any variable not defined as local is global, including a loop counter. Same in every version of MMbasic that has ever been released |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2108 |
2350V6.00.00RC15 on power up screen message [1] Keypad 2 Error : Invalid syntax >UK usb keyboard connected on channel 1 no copywrite Geoff, Peter message > option list PicoMiteHDMI MMBasic USB Version 6.00.00RC15 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION AUTORUN ON OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD UK, 0, 0, 600, 150 OPTION CPUSPEED (KHz) 315000 OPTION HDMI PINS 1, 3, 7, 5 OPTION SDCARD GP22, GP6, GP7, GP4 OPTION AUDIO GP26,GP27', ON PWM CHANNEL 5 OPTION MODBUFF ENABLE 192 Edited 2024-11-10 05:17 by stanleyella |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 206 |
I understand. Sometimes I use python ;-) (may be interesting in this regard: https://www.geeksforgeeks.org/global-local-variables-python/ ) -andreas |
||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 193 |
Attempting to enter a date or time into system variables using the ENTER command results in an error both in the command line and from the program. > ? Date$ 01-01-2000 > INPUT Date$ ? 09-11-2024 Error : Variable name > ? Time$ 00:20:02 > INPUT Time$ ? 21:54 Error : Variable name Forgive me if it should be like this, I am a complete ZERO in MMBasic programming :) |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6089 |
You can't use a function name for a variable name. try: > time$ = "07:10" > print time$ 07:10:07 > input tmp$ : time$ = tmp$ ? 07:15 > print time$ 07:15:06 > VK7JH MMedit MMBasic Help |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2108 |
I used flash-nuke-uf2 and reflashed and now just the normal boot message geoff, peter. copied option list first. I tried OPTION KEYBOARD UK, 0, 0, 0, 0 but it reverts to OPTION KEYBOARD UK, 0, 0, 600, 150 > option list PicoMiteHDMI MMBasic USB Version 6.00.00RC15 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD UK, 0, 0, 600, 150 OPTION CPUSPEED (KHz) 315000 OPTION HDMI PINS 1, 3, 7, 5 OPTION SDCARD GP22, GP6, GP7, GP4 OPTION AUDIO GP26,GP27', ON PWM CHANNEL 5 |
||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 193 |
So these are functions!?! And in some places they behave like variables!? time$ = "07:10" Edited 2024-11-10 06:29 by javavi |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6757 |
They are listed under Functions in the manual. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JanVolk Senior Member Joined: 28/01/2023 Location: NetherlandsPosts: 143 |
Time$ and Date$ both appear in list commands and list functions. Jan. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2129 |
Their purpose is to return a value or string. eg X = Sin(a) Time$ is also a function as it returns a string. > now$ = time$ > ? now$ 06:47:35 > Edited 2024-11-10 07:14 by phil99 |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2108 |
option keyboard uk,0,0,0,0 always gives OPTION KEYBOARD UK, 0, 0, 600, 150 same as hdmi usb > option list PicoMiteVGA MMBasic USB Edition 6.00.00RC15 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD UK, 0, 0, 600, 150 OPTION CPUSPEED (KHz) 378000 OPTION SDCARD GP13, GP10, GP11, GP12 OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0 |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 896 |
There is a diagnostic printf("Regex\r\n"); in the instr function > > list Dim s$ Dim a! s$="123xyz789" Print Instr(s$,"x.z",a!) > > run Regex 4 > > Latest F4 Latest H7 |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9080 |
Thanks - removed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9080 |
[1] Keypad 2 Error : Invalid syntax You have option autorun set and the tokens have changed so the stored program is corrupt |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4212 |
Simply do a new FLASH SAVE. all will be fine after that. Volhout PicomiteVGA PETSCII ROBOTS |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 896 |
I have done a little bit of testing with CFunctions. They seem to be OK. An updated PicoCFunctions.h is attached. The same file for both PICO and PIO2, there is one #define to uncomment to use for the RP2350 i.e. /*** Uncomment this define if using PICO2 Chip ***/ #define PICORP2350 PicoCFunctions.zip This is the commandline used for the PICO2. "C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" -c -mcpu=cortex-m33 --specs=nano.specs -mfloat-abi=softfp -mthumb -Wall -Wno-main -ffunction-sections -O0 -fPIC -I. %1.c -o %1.o IF ERRORLEVEL 1 Goto Done "C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" -nostartfiles -T arm-gcc-link.ld -o %1.elf %1.o IF ERRORLEVEL 1 Goto Done Latest F4 Latest H7 |
||||
Page 1 of 3 |
Print this page |