![]() |
Forum Index : Microcontroller and PC projects : dim var as byte
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
Picaxe is ok for robots but not much good for glcd. It's not a compiler. It doesn't make an assembler hex file and flash it. It's basic and works up to a certain speed and easier than asm but not as fast as compiled basic. You can't use an arduino board of course as it's picaxe chips only. gcb uses arduino bootloader so just a usb lead not a rs232 to 3.5 jack to gnd,clk.data or dedicated usb lead,more money, which I found using pickit was pins 27,28 but picaxe used pins 1,2. I don't know why picaxe has such a dedicated fan club when there's open source basic compilers available. A rp2040 is cheaper. There is no free basic for rpi pico other than mmbasic that I know of. I got free basic on rpi 400. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7826 |
I think they should have called it a pre-processor really, but I can understand that in an educational context that might be a little confusing. "Compiler" might be easier to un-learn at a later stage. :) My "miracle" device is the Micromite. MMBasic on a 28-pin PIC is not far short of a miracle in my eyes. I don't know how Geoff managed to do that bit of magic, but I'm really grateful that he did. :) It still makes me smile when I hook one up to Tera Term and have a play. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
@Mixtel90 My "miracle" device is the Micromite. MMBasic on a 28-pin PIC is not far short of a miracle in my eyes. I don't know how Geoff managed to do that bit of magic, but I'm really grateful that he did. :) It still makes me smile when I hook one up to Tera Term and have a play. Please say more , what pic? You can get 32bit arduino boards. Are any supported? I'm happy with rpi pico and mmbasic. I really like all the glcd buttons and dials and gauges and touch interrupts. Better, IMHO than a Nextion touch lcd and a pic/arduino to run it. Cheaper to. Win 10 sees rpi as pico in devices, not com x. Teraterm finds the rpi pico on win 10 as com13:usb serial device. putty needs input com port but win 10 doesn't show it as a com number. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7826 |
https://geoffg.net/micromite.html GCBasic only supports the UNO as far as I know. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4033 |
Bear in mind the pico can be in one of a few modes. When expecting you to copy across new firmware it appears as a device. When running firmware it appears as whatever that firmware decides e.g. a USB COM port. (Also & sadly, Windows can be confused...) John Edited 2022-08-06 02:35 by JohnS |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
I tried running some code written in mmedit and click the running man and it saves and gives error messages which I've got to read data to array... it says - error array dimensions. I don't have a clue what's wrong. ![]() |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3348 |
cannon is not dimmed. If you provide code with an error, please provide the line number of the error. Edited 2022-08-06 06:09 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1128 |
And why do you have the command DATA after the READ command? Not needed. Visit Vegipete's *Mite Library for cool programs. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
> RUN [8] Read data,sp1(ptr) Error : Array dimensions > OPTION BASE 0 ' 0 based arrays OPTION DEFAULT NONE ' Don't assume a type for variables 'OPTION EXPLICIT OPTION DEFAULT INTEGER dim sp1 integer (255) for ptr=0 to 255 read data,sp1(ptr) next ptr data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk not a clu and amazed mmeditworked, well seems to.. running man button to save and run. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3348 |
sp1 is not an array. You've defined an array named "integer". PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10197 |
Read the manual for DIM. This is meaningless. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
please someone show how to dim array(255) and read data 0 to 255 to the array. This code gives error > RUN [18] Read data,sp1(ptr) Error : No DATA to read > OPTION BASE 0 ' 0 based arrays 'OPTION DEFAULT NONE ' Don't assume a type for variables 'OPTION EXPLICIT OPTION DEFAULT INTEGER dim sp1(255) CONST bk = RGB(BLack) const wh = rgb(white) const bl = rgb(blue) const gr = rgb(green) const cy = rgb(cyan) const re = rgb(red) const ma = rgb(magenta) const ye = rgb(yellow) const br = rgb(brown) restore for ptr=0 to 255 read data,sp1(ptr) next ptr data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
for ptr=0 to 255 read sp1(ptr) next ptr you were reading two values on each pass, one into a variable called data and the second into the array. VK7JH MMedit |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
line 18 is read data,sp1(ptr) I don't see my errors. it's annoying, hope it's not mmedit which I've not set up just clicked the running man to save and run. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
for ptr=0 to 255 read data,sp1(ptr) next ptr The manual says Reads values from DATA statements and assigns these values to the named variables. Variable types in a READ statement must match the data types in DATA statements as they are read. Arrays can be used as variables (specified with empty brackets, e.g. a()) and in that case the size of the array is used to determine how many elements are to be read. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4033 |
It's not READ DATA,... but just READ ... John |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
If oyu insist on using MMEdit, use the help. click in the READ word and "F1" for a short one line hint Hold Shift while pressing F1 key and the full help for the READ command pops up. The demo in that help should help. PS, If Teraterm finds your pico on com13, I would believe it. Playing with the syntax is much easier using Teraterm and the pico. You are welcome to continue using my test micromite but the pico is where you need to ed up. Jim VK7JH MMedit |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1128 |
Here's a working version: OPTION BASE 0 ' 0 based arrays 'OPTION DEFAULT NONE ' Don't assume a type for variables 'OPTION EXPLICIT OPTION DEFAULT INTEGER dim sp1(255) CONST bk = RGB(BLack) const wh = rgb(white) const bl = rgb(blue) const gr = rgb(green) const cy = rgb(cyan) const re = rgb(red) const ma = rgb(magenta) const ye = rgb(yellow) const br = rgb(brown) restore for ptr=0 to 255 read sp1(ptr) next ptr data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk cls for x = 10 to 200 DrawSprite sp1(),x,25 line x-1,25,x-1,25+16,1,0 ' erase old image next x end sub DrawSprite arr(),x,y local i,j for j = 0 to 15 for i = 0 to 15 pixel x+i,y+j,arr(j*16+i) next i next j end sub The biggest issue is erasing the previous image. The above just draws a black line on the left edge of the new image, which will erase that portion that didn't get replaced by the new image. Obviously this method is useless for general sprite movement. Better might be to draw a black box at the old location, then draw the sprite at the new location. Visit Vegipete's *Mite Library for cool programs. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2527 |
Thanks for the replies. I've not used read data since the 80's and it was different to mmbasic. It's use I misinterpreted with mmbasic. MMedit seems ok, it's more like what I'm used to ie win editor and save to mmbasicprogs in win, then press a button to save/run it to rpipico. @vegipete- I'll try my method of draw sprite,calculate new position then erase sprite by plotting background the plotting sprite in new position. Should be flicker free. I'll report back if it works. Cheers. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7826 |
Don't attempt to mix BASICs. Read the (excellent) manual for MMBasic - it's based on GWBASIC but it's not the same. On Geoff's site, in the Micromite section, he also has another little book: "Getting Started With The Micromite". Although not directly applicable to the PicoMite it's a good intro to MMBasic. Just bear in mind that there are some quite big differences because of the hardware and, in your case, the PicoMite manual takes precedence. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |