![]() |
Forum Index : Microcontroller and PC projects : Error in Port command on Maximite
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Hi all, I am a brand new member and also new to the Maximite (well actually a Maximite CGMMSTICK from CircuitGizmo in the US). Have done quite a bit of programming of PicAxes so have some familiarity with micros. I am setting up a system to drive two large 7 segment LEDs and the PORT command is giving trouble! See this screen dump ![]() I hope the image is OK as I do not know how to capture the code as a text file. As you can see the interpreter thinks Port is an undeclared array. What am I doing wrong? Rob White |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
sry u cant send the half code in a picture. nobody can read it and help. i resize the picture and can read something but the code isnt full. |
||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
You could ZIP the image and upload it as a file. We would have some chance of reading it. I did the same as plasma and magnified the image and I could read enough to know that you only are showing us part of your code. You have used the PORT command more than once. Does it fail at each instance or which instance does it fail at? The error shows that it fails at line 26. If you don't know which line that is then invoke the editor when you get the message and it should position the cursor at the failing line. |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2927 |
From zooming in on your screen dump, it looks like you may be having variable names beginning with function names. For example, you use the variable name 'PortBit0edit' (I think it reads), but I would not advise this as it begins with a function name (i.e. 'Port'). Try changing any variable names that have a function name at the beginning and see how you get on. In the meantime we await a better screen shot/listing (see Bob's post above regarding zipping image). WW |
||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 982 |
Just a note, in Tera Term you can highlight the code using mouse button and when highlighted right click on the code which will place it onto clipboard. (an applet will verify the text on the clipboard, I usually cancel the applet) You can then paste it into a new text document to print or upload to forum etc. |
||||
ajkw Senior Member ![]() Joined: 29/06/2011 Location: AustraliaPosts: 290 |
I think we have the whole program, the first line is LIST. In the SUB declaration you have named a variable PortBit0 and in the PORT command within the sub you have used PortBit0edit which would be Null or 0 and therefore a illegal port and perhaps results in the error. |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Can you tell me how to capture the program as a text file? That would be a better way to display the code. Rob White |
||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
You are using Tera Term. Why don't you do it easy and list the program, select it on the screen, copy it and then paste it to Notepad. Save it as a file and upload it here. If it is a short program then just paste it straight into the forum editor and skip all that Notepad stuff. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9488 |
I too would love to see legible code. For what it's worth, I used the PORT command extensively with the dot-matrix printer project, and I never had a problem with the PORT command itself. Provided your code shows up in one window: 1) Press and hold the left mouse button, drag to all text is highlighted and release the mouse button - text will be copied to the clipboard. 2) Click OK at the window that says it is in the clipboard. 3) Click the CODE button just above the message window, and put your cursor in between the two HTML tags - between the ][. 4) Press CTRL-V or right-click/paste This should put your code in a code box in the message. Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
I think the line has an extra word 'edit' as part of the variablename. [code] Port(PortBit0edit,4) = ThisVal 'should be: Port(PortBit0,4) = ThisVal [/code] Ahum, that was what AJKW already found. :) Microblocks. Build with logic. |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2927 |
I have run your code on a 44-pin MicroMite (modifying the code to use valid MicroMite pins) and can report the following: 1> When using the 'incorrect' variable name PortBit0edit, an 'Invalid argument' error occurs. 2> When correcting variable name to PortBit0, the program runs fine. Please note that as stated in my previous post; it is not good programming practice to use function/command names at the start of variable names. It does happen to be ok in this case on my MicroMite module but I would still recommend changing any variable names that begin with a function/command to something else. By the way, the last line in your sub looks like 'Pin(16)=1'. Should this be 'Pin(LE)=1'? If you do actually want Pin16 then why not use Pin(LE2) since you define LE2 as 16. I am not trying to 'correct' your code - just highlighting a potential issue that you may have overlooked. Hope this fix that several people have spotted works for you . . . . Please do update this post with your progress as there are several members that are keen to help fix this for you. WW |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Thanks for all your comments. Whole host of things to take on board. Yes there were some typos in the code as pointed out. I am still coming to grips with the environment of the "mites". What I had not done was apply the KISS principle! If I type the following I get the following output:- Type NEW then edit and enter the following list For i = 0 To 9 port(11,4)=i Next i > run [2] port(11,4)=i Error: Array must be dimensioned first I will now contact CircuitGizmo I believe I may be using an early version of MMbasic. I remember reading somewhere that the port command was a late inclusion. I can not find a command to show the version number is there one? Rob White |
||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
See page 23 of the current Maximite manual. Predefined Read Only Variables. Print MM.VER will get you a version. If your MMBasic is down level then you can easily update it. It's all in the manual. |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Thanks for version info. Just confirmed my problem is with the Maximite Basic stick from CircuitGizmo. MMbasic version is shown as 4 (that's all no decimal point or anything) The colour version from the same supplier shows version 4.04 and the PORT command works fine. As I said in an earlier post I have contacted CircuitGrimo. Thanks all Rob White |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3269 |
The PORT command was added in V4.1 You can easily update the firmware yourself. Download the update from http://geoffg.net/maximite.html#Downloads, full instructions are in the download. Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
While you are waiting for a reply, you could update the firmware easily if you have a Windows computer. Go to http://geoffg.net/maximite.html Scroll down to near the bottom of the page. Download the firmware for the Monochrome Maximite MMBasic firmware V4.5 There are update instructions included in the ZIP file. If you have a colour maximite, you should also download the update for it while you are there. It's like buying a new computer. By the time you get it home, there are updates available. Jim edit: Welcome home Geoff. VK7JH MMedit |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
I agree with things being out of date before you get them home! I have updated my CGCOLORMAX2-B to version 4.5 and also my CGMMStick1 and still have problems here are screen grab from TT for the ColorMax :- [10] Port(10,4,16,4)=&B10000011 Error: Invalid output pin > list SetPin 10,dout SetPin 11,dout SetPin 12,dout SetPin 13,dout SetPin 16,dout SetPin 17,dout SetPin 18,dout SetPin 19,dout Port(10,4,16,4)=&B10000011 > ? mm.ver 4.05 > ? mm.device$ Colour Maximite > I will post the Stick error and code (identical) in a separate post as I need to reboot windows to change devices - not surprised. Rob White |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Here's the output from the stick:- [10] Port(10,4,16,4)=&B10000011 Error: Invalid output pin > list SetPin 10,dout SetPin 11,dout SetPin 12,dout SetPin 13,dout SetPin 16,dout SetPin 17,dout SetPin 18,dout SetPin 19,dout Port(10,4,16,4)=&B10000011 > ? mm.ver 4.05 > ? mm.device$ Maximite > As you can see I have used the example from the "MMBasic Langage Manual" Where's the finger trouble now? I have no hardware hanging off the devices. I have tried other pins and get the same results. Rob White |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
I tried your code on a maximite and can confirm that there is a problem with the port command. This works OK on the micromite but 'Error: Invalid output pin' on the maximite: SetPin 16,dout
SetPin 17,dout SetPin 18,dout SetPin 15,dout Port(15,4)=&B0011 I think the pin numbers should be correct for both devices. I don't know why you need to reboot Windows to change devices. The port number may change but I have never needed to reboot! Jim VK7JH MMedit |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Thanks Jim for that verification. Rob White |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |