Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:52 08 Jul 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 : Micromite with lcd backpack problem

Author Message
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 05:50am 16 Aug 2016
Copy link to clipboard 
Print this post

Hello all!
i need serious help here because after spent some time programming the micromite with it's backpack i can't let it autostart at power on!!
what's wrong?
i placed "option autorun on" at the beginning of the program, i tried even placing it in the mm.startup subroutine but it doesn't work.. i need to issue a "run" at the console to run the program! in this way my project is completely useless :'(
can somebody help me please?
thanks
Juri
Edited by Juri74 2016-08-17
 
Justplayin

Guru

Joined: 31/01/2014
Location: United States
Posts: 327
Posted: 08:05am 16 Aug 2016
Copy link to clipboard 
Print this post

OPTION AUTORUN ON is used only at the command prompt. Load your program into the Micromite, type OPTION AUTORUN ON, then cycle the power. Your program should start automatically.

--Curtis
I am not a Mad Scientist...  It makes me happy inventing new ways to take over the world!!
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1573
Posted: 09:52am 16 Aug 2016
Copy link to clipboard 
Print this post

@Curtis

  Quote  OPTION AUTORUN ON is used only at the command prompt.


Sorry, this is not correct.

Regards
Michael
causality ≠ correlation ≠ coincidence
 
Justplayin

Guru

Joined: 31/01/2014
Location: United States
Posts: 327
Posted: 10:18am 16 Aug 2016
Copy link to clipboard 
Print this post

  twofingers said   @Curtis

  Quote  OPTION AUTORUN ON .


Sorry, this is not correct.

Regards
Michael


Perhaps "Should only be used at the command prompt" would be better phrasing. I don't like the idea of a program regularly writing to the same flash area of the Mite. Just my own personal over cautious fear of wearing out a chip.

--Curtis
I am not a Mad Scientist...  It makes me happy inventing new ways to take over the world!!
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1573
Posted: 10:24am 16 Aug 2016
Copy link to clipboard 
Print this post

  Justplayin said  Just my own personal over cautious fear of wearing out a chip.

Good point!

Edit:
AFAIK will the flash for Option Autorun not unnecessarily changed.


@Juri

I would try this steps:

1. save your program
2. make a reset to its original configuration (p 16 of User Manual
MMBasic Ver 5.2 Beta 1)
3. write a small dummy program (do:i=i+1:Print i:loop)
4. set the Micromite into the Autorun mode ("Option Autorun On" at the cammand prompt)
5. enter CPU RESTART (or do a reset/make a disconnect-reconnect to the power)

You should see
1
2
3
4
5
6
...

on the console output.

Edited by twofingers 2016-08-17
causality ≠ correlation ≠ coincidence
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9590
Posted: 01:34pm 16 Aug 2016
Copy link to clipboard 
Print this post

I also agree that OPTION AUTORUN ON should be entered in at the command prompt and not in the code. While you CAN put it in the code, the normal procedure is to run that as a direct command in immediate mode at the command prompt. Please let us know how you get on!
Smoke makes things work. When the smoke gets out, it stops!
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 08:26am 17 Aug 2016
Copy link to clipboard 
Print this post

ok removed from the code, thanks for the suggestion
followed twofinger suggestion
all worked perfectly until i reload my program. i doesn't autorun
but i found the problem!
issuing "RUN" from the console it work perfectly!
but...
it didn't autostart, after issuing "CPU RESTART"
the program throw an error "variable not defined"!!!!!!!
i use OPTION EXPLICIT and made some further testing:

this program:
DO
A=0
print A
LOOP
work perfectly if "RUN" from the console but it doesn't run on autostart
looks like the option explicit works at autorun and not when run program from console
:)
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1573
Posted: 08:51am 17 Aug 2016
Copy link to clipboard 
Print this post

Hi Juri,

if you are usung the OPTION EXPLICIT then you should (explicit) declare your variables (eg "DIM A as integer" or "Local A as integer").

Micromite User Manual Page 35
  Quote  The OPTION EXPLICIT command tells MMBasic to not automatically create variables. Instead they must be explicitly defined using the DIM or LOCAL commands (see below) before they are used.

If the OPTION EXPLICIT command was used as shown below the error would become obvious when the program was run:


Generally it would be helpful to know which system you are using (MMBasic version and the specific chip, eg Mx170/28) and - if possible - your code or parts of it.

Regards
Michael


causality ≠ correlation ≠ coincidence
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 06:19am 20 Aug 2016
Copy link to clipboard 
Print this post

hello the problem is not only the "option explicit" but something else too
example the "rtc gettime" command!
i spent half an hout trying to know why the minimite wouldn't set the pins to 0 at power cycle (i was debugging a board)
the program was very simple:
setpin 10,dout
pin(10)=0
setpin 16,dout
pin(16)=0

do
loop

when running (connected to terminal) nothing show up and pin 10&16 were still at 3v!!!
then i casually find the "RTC GETTIME" command in mm.startup subroutine when i issued the "CPU RESTART" command..
with that command the error "RTC clock not responding" (or similar i do not remember) appeared at the console!!

i bought the kit minimite + lcd backpack
actually i have another "backpack" at the opposite side of the lcd board, this is the daughterboard that have the clock on it. i have to disassemble it another time, but i wouldn't do it! now is working and installed.
but i'm almost sure the chip is PIC32MX170F256B as included in the kit..
what version is running.. i do not know unfortunately :(Edited by Juri74 2016-08-21
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 06:22am 20 Aug 2016
Copy link to clipboard 
Print this post

i found another strange behaviour, i do not know if it's normal or not
but,
when i enter the editor with "edit" command all Digital Out pins go to 1 state
is it normal?
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 01:37pm 20 Aug 2016
Copy link to clipboard 
Print this post

  Juri74 said   i found another strange behaviour, i do not know if it's normal or not
but, when i enter the editor with "edit" command all Digital Out pins go to 1 state
is it normal?

Yes it is. When the editor starts up it needs all the memory it can get so the firmware resets the interpreter which also resets all outputs.

Geoff (still overseas)
Geoff Graham - http://geoffg.net
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 05:38pm 20 Aug 2016
Copy link to clipboard 
Print this post


@geoffg
"Resets all outputs"? You mean that by exiting a running program into edit mode all digital outputs go to 1 state, as Juri74 wrote? This could switch on all external loads (e.g. valves, heaters, pumps, ...).


 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 07:05pm 20 Aug 2016
Copy link to clipboard 
Print this post

When a program starts, either on power up or by RUN, all outputs are reset so you cannot ever rely on I/O pins being set to some particular state. When a pin is reset it is set to high impedance so, if it is critical that an output be in a particular state, you should use a pullup or pulldown resistor to set that state so that it is correct during power up (or RUN or EDIT).

Geoff
Geoff Graham - http://geoffg.net
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025