Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:54 11 May 2025 Privacy Policy
Jump to

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 : Error in Port command on Maximite

     Page 1 of 2    
Author Message
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 01:35am 06 Jul 2014
Copy link to clipboard 
Print this post

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: Germany
Posts: 437
Posted: 07:48am 06 Jul 2014
Copy link to clipboard 
Print this post

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.

Edited by plasma 2014-07-07
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 09:23am 06 Jul 2014
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2927
Posted: 09:45am 06 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 982
Posted: 12:33pm 06 Jul 2014
Copy link to clipboard 
Print this post

  Quote  I hope the image is OK as I do not know how to capture the code as a text file.


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: Australia
Posts: 290
Posted: 01:16pm 06 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 192
Posted: 08:08pm 06 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 935
Posted: 08:22pm 06 Jul 2014
Copy link to clipboard 
Print this post

  Bizzie said   Can you tell me how to capture the program as a text file? That would be a better way to display the code.

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 Zealand
Posts: 9488
Posted: 08:47pm 06 Jul 2014
Copy link to clipboard 
Print this post

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: Thailand
Posts: 2209
Posted: 09:26pm 06 Jul 2014
Copy link to clipboard 
Print this post

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. :)
Edited by TZAdvantage 2014-07-08
Microblocks. Build with logic.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2927
Posted: 11:04pm 06 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 192
Posted: 01:05pm 07 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 935
Posted: 01:16pm 07 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 192
Posted: 01:42pm 07 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 3269
Posted: 02:10pm 07 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 6220
Posted: 02:13pm 07 Jul 2014
Copy link to clipboard 
Print this post

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.Edited by TassyJim 2014-07-09
VK7JH
MMedit
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 01:53pm 08 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 192
Posted: 02:03pm 08 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 6220
Posted: 02:49pm 08 Jul 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 192
Posted: 03:41pm 08 Jul 2014
Copy link to clipboard 
Print this post

Thanks Jim for that verification.
Rob White
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025