Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:44 02 Aug 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 and Micromite Plus Beta 36

     Page 2 of 3    
Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 09:48pm 12 Oct 2015
Copy link to clipboard 
Print this post

John, I will send you an email direct and see if we can sort it out.
Geoff Graham - http://geoffg.net
 
sc05027
Newbie

Joined: 01/01/2015
Location: Hong Kong
Posts: 10
Posted: 05:56am 13 Oct 2015
Copy link to clipboard 
Print this post

I tested beta 36 for uM170, after I used "library save" to save some code (about 200 lines long) as library, I found about half of the code disappeared by viewing it using "library list". It looks like a bug, would Geoffg take a look please.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 12:08pm 13 Oct 2015
Copy link to clipboard 
Print this post

You did not say what went missing but the LIBRARY SAVE command is designed to remove extraneous spaces, blank lines, comments and the contents of CFunctions. It does this because they are not needed in the library and removing them saves on program flash.

Geoff
Geoff Graham - http://geoffg.net
 
sc05027
Newbie

Joined: 01/01/2015
Location: Hong Kong
Posts: 10
Posted: 12:24pm 13 Oct 2015
Copy link to clipboard 
Print this post

Sorry I didn't state it clear. The code disappeared is not only the comment. The lower part of the code was cut as well.

SC
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 01:23pm 13 Oct 2015
Copy link to clipboard 
Print this post

Can you post a short example of the code and what happens to it?
Geoff Graham - http://geoffg.net
 
sc05027
Newbie

Joined: 01/01/2015
Location: Hong Kong
Posts: 10
Posted: 05:10pm 13 Oct 2015
Copy link to clipboard 
Print this post

Hi Geoff,

Below is the copy of Tera Term VT screen. The code at the end was disappeared after "library save". I test some other code and the result was similar. This problem does not exist on Beta 32.

Micromite MKII MMBasic Ver 4.7 Beta 36
Copyright 2011-2015 Geoff Graham

> list
' scwong 20150726
' micromite mk2 4.7 beta 23
' ___ _ ___
' RST(3v3)-|1 \_/ 28|-(3v3)
' Dig/Int/Ana-|2 M 27|-(Gnd)
' SPI Out/Dig/Int/Ana-|3 i 26|-Ana/Dig/PWM2A
' PWM1A/Dig/Int/Ana-|4 c 25|-Ana/Dig/SPI Clk
' PWM1B/Dig/Int/Ana-|5 r 24|-Ana/Dig/PWM2B
' PWM1C/Dig/Int/Ana-|6 o 23|-Ana/Dig
' Com1:En/Dig/Int/Ana-|7 m 22|-Dig/5V/Com1:Rx
' (Gnd)-|8 i 21|-Dig/5V/Com1:Tx #
' Com2:Tx/Int/Dig-|9 t 20|-(47uF Tant +)
' Com2:Rx/Int/Dig-|10 e 19|-(Gnd)
' 38400bps Console Tx-|11 18|-Dig/5V/Count/SDA #
' " Console Rx-|12 m 17|-Dig/5V/Count/SCL #
' (3v3 ie. 2.3V-3.6V)-|13 k 16|-Dig/5V/Count/Wakeup/IR
' SPI In/5V/Dig-|14 2 15|-Dig/5V/Count
' ---------
'
CPU 10
Option explicit
Dim integer setcoloron = 1 'set to 0 to disable color
Dim integer mode = 0
Dim integer count = 0
Dim integer pattern(9) = (&h6f,1,2,3,4,5,&h42,7,8,&h71)
' 0-9 of sparkfun LED display
SetTick 1 * 60 * 60 * 1000, refreshtime, 1 'every hour
SetTick 500, everyhalfsec, 2
SetTick 50, chkinkey, 3
Dim key As string
Open "COM1:9600" As #5 '7seg display using com mode
refreshtime

Do
' do nothing
Loop

Sub chkinkey
Local string key = Inkey$
If key = "c" Or key = "C" Then
setcoloron = 1 - setcoloron 'toggle 1, 0
EndIf
If key = "f" Or key = "F" Then
refreshtime
EndIf
End Sub

Sub everyhalfsec
Select Case mode
Case 0
wholesec
Case 1
halfsec
Case Else
'do nothing
End Select
mode = (mode + 1) Mod 2 '0-1-2-3-0-1-...
WatchDog 600
End Sub

Sub refreshtime
Local string oldtime = Date$ + " " + Time$
RTC gettime
Print "Time refreshed! From " oldtime " to " Date$ + " " + Time$
Print Chr$(7); 'make some noise
End Sub

Sub halfsec
Print #5, Chr$(&h77); 'decimal control
Print #5, Chr$(&b00000000); 'clear colon
End Sub

Sub wholesec
Local string t = Time$
setcolor count Mod 7
Print "color" count Mod 7 " ";
setcolor 0
Print Time$ "," count
Print #5, Chr$(&h79) + Chr$(0); 'cursor control, 0 = left most
t = Left$(t,2) + Mid$(t,4,2)
Local i As integer
For i = 1 To 4
Print #5, Chr$(pattern(Val(Mid$(t,i,1))));
Next
Print #5, Chr$(&h77); 'decimal control
Print #5, Chr$(&b00010000); 'colon
count = count + 1
End Sub

Sub setcolor (i As integer)
i = i Mod 8
Local code As string
code = Chr$(27) + "[3" + Str$(i) + "m" 'escape code for VT100
If setcoloron Then
Print code;
EndIf
End Sub

Function DSGettemp() As float
Local add11 As float
Local add12 As float
RTC getreg &h11, add11
RTC getreg &h12, add12
dsgettemp = add11 + add12/256
End Function
> library save
> library list
CPU 10
Option explicit
Dim integer setcoloron = 1
Dim integer mode = 0
Dim integer count = 0
Dim integer pattern(9) = (&h6f,1,2,3,4,5,&h42,7,8,&h71)
SetTick 500, everyhalfsec, 2
SetTick 50, chkinkey, 3
Dim key As string
Open "COM1:9600" As #5
refreshtime
Do
Loop
Sub chkinkey
Local string key = Inkey$
If key = "c" Or key = "C" Then
setcoloron = 1 - setcoloron
EndIf
If key = "f" Or key = "F" Then
refreshtime
EndIf
End Sub
Sub everyhalfsec
Select Case mode
Case 0
wholesec
Case 1
halfsec
Case Else
End Select
mode = (mode + 1) Mod 2
WatchDog 600
End Sub
Sub refreshtime
Local string oldtime = Date$ + " " + Time$
RTC gettime
Print "Time refreshed! From " oldtime " to " Date$ + " " + Time$
Print Chr$(7);
End Sub
Sub halfsec
Print #5, Chr$(&h77);
Print #5, Chr$(&b00000000);
End Sub
Sub wholesec
Local string t = Time$
setcolor count Mod 7
Print "color" count Mod 7 " ";
setcolor 0
Print Time$ "," count
Print #5, Chr$(&h79) + Chr$(0);
t = Left$(t,2) + Mid$(t,4,2)
>


SC
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 11:26pm 13 Oct 2015
Copy link to clipboard 
Print this post

Thanks Stephen, that was a great help. This bug can easily screw up library code so I will put out a new version in a couple of days with this fix and a few others.

I keep saying this but great thanks to everyone who is playing with the code - bug reports like this are a wonderful help. My test programs find a lot of them but there always seems to be the extra few that escaped.

Geoff
Geoff Graham - http://geoffg.net
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 11:30pm 13 Oct 2015
Copy link to clipboard 
Print this post

Geoff, this is probably a funny one, but I wanted to ask anyway. Would it be too hard for you to implement a way for multi-line commentaries in the source?
A well commented source is very important, especially for learners and building their style, and having the ' as only option is not really welcoming that practice. I have felt it myself with my own sources.
Thanks

http://rittle.org

--------------
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 01:37am 14 Oct 2015
Copy link to clipboard 
Print this post

  kiiid said  Would it be too hard for you to implement a way for multi-line commentaries in the source?

OK, that is an interesting one. When I am working in C I almost always use comments that comment out one line (ie, //) even though C has multi-line comments. So I never thought about multi-line comments for BASIC.

There are a few hurdles; the first is that Bill Gates never set a standard for this type of feature (for example, the apostrophe (') as a comment character came from him) and BASIC is very line orientated which makes multi-line structures difficult.

This will require some thought.
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 02:38pm 14 Oct 2015
Copy link to clipboard 
Print this post

hi geoff,
given that the 4.7 code is getting close to being 'final', is there any chance that we might see a way (on the MX170 in particular) to switch over to using the internal bandgap reference (instead of AVcc) in analog reads? being able to do this while at the same time returning unscaled values in the 0 - 1023 range (only when internal bandgap is selected) would be brilliant for a set of applications i have in mind.


cheers,
rob :-)
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 05:43pm 14 Oct 2015
Copy link to clipboard 
Print this post

Hi Geoff,

Just a revisit about the possibility to use an interrupt on the touchdown for LCD on the MX170. I am working around it by tying the T_IRQ pin to another pin (say T_IRQ2) and issuing the interrupt against that pin .e.g.
setpin T_IRQ2,INTL,readtouch


This allows you to only scan for a touch when one is there.
Another use is where you want to reduce power by turning the back light off and setting CPU to say 5 MHz. This is OK as long as you get back to 20MHz before you try to talk to the LCD or Touch.If you have an interrupt you can get back to speed before reading the touch.

It would be good to be able to use the interrupt and save the use of the additional pin.

regards
Gerry

The quote below is from discussions after the initial Beta release.

  Quote  

A bunch of questions and I will try to answer them in one batch.

Quote:
Can we have an interrupt on touch down?

I will have a look at this but the MX170 is now VERY low on flash. I have used a number of techniques to squeeze the new code in without impacting speed or the memory available to programs but there is very little space left. So, some things will have to be left out. The MX470 version (still under development) has a lot more flash so it will support interrupts on both touch down and up.

Quote:
Probably better, is it just possible to remove the protection on the T_IRQ

Good idea, it might be the solution. I will investigate. Thanks.

Latest F4 Latest H7 FotS
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 06:21pm 14 Oct 2015
Copy link to clipboard 
Print this post

Geoff,
I remembered you were thinking about making more of a division between an embedded version and a computer version. Maybe that time arrived.

If it were up to me i would remove the editor from the 150/170 version as there is a perfectly good editor for it on most pc platforms (MMEdit).
This could free up more space for functionalities that enhance the capabilities.
The more i use the 170 version of the chip the less i use the internal editor. Once programs getting bigger then 2-3 pages of code i find the internal editor slowing me down a lot, so much so that i not use it anymore because of that.
What i do use is the command line. Very easy to just set a pin or do a quick for next loop in a single line of code.
Instead of the full screen editor maybe a single line editor is a good compromise. With up/down arrow to go through the last commands.

Starting from scratch on a pc i even found that people get MMEdit to work quicker then TeraTerm (Less setup). And as you at least need one of those to work with the micromite i now instruct people to start with MMEdit.
Edited by MicroBlocks 2015-10-16
Microblocks. Build with logic.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 08:11pm 14 Oct 2015
Copy link to clipboard 
Print this post

  MicroBlocks said   Geoff,
I remembered you were thinking about making more of a division between an embedded version and a computer version. Maybe that time arrived.

If it were up to me i would remove the editor from the 150/170 version as there is a perfectly good editor for it on most pc platforms (MMEdit).
This could free up more space for functionalities that enhance the capabilities....


Personally I would ask if Geoff would supply two versions, one with the editor, and one without. This is off course assuming it is reasonably easy to maintain the two versions. Or can the one including the Editor be the 'master' which is maintained, and then on each release he then strips it out to create the 'non-editor' version?

I think from history that there are as many people wanting the editor left in, as there are people not wanting it included. At the end of the day, the editor is useful in certain situations (i.e. quick field repair) so to totally remove it would upset some people!

WW
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:26pm 14 Oct 2015
Copy link to clipboard 
Print this post

  MicroBlocks said   Geoff,
If it were up to me i would remove the editor from the 150/170 version as there is a perfectly good editor for it on most pc platforms (MMEdit).


Hi Jim

I for one would not agree I use the internal editor most of the time and losing it
would take away a feature that puts the Mites far ahead of the rest

Regards
Jman
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 08:41pm 14 Oct 2015
Copy link to clipboard 
Print this post

@jman - Nice Avatar!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 08:58pm 14 Oct 2015
Copy link to clipboard 
Print this post

  jman said  
  MicroBlocks said   Geoff,
If it were up to me i would remove the editor from the 150/170 version as there is a perfectly good editor for it on most pc platforms (MMEdit).


Hi Jim

I for one would not agree I use the internal editor most of the time and losing it
would take away a feature that puts the Mites far ahead of the rest

Regards
Jman

To use the internal editor you need a PC running a terminal program.
As such it would just as easy to start MMEdit. There is no advantage.
he difference is only you double click the teraterm icon on your pc or the MMedit icon.

With the MM+ however the LCD will/can be the 'monitor'. Same as with the Maximite and ColorMaximite. But that is the distinction between the 'embedded' and 'computer'.
On those having the internal editor is great!

I only bring it up because flash is running out and very use full features can not be added. The choice is either have those extra features that can have no alternative or remove the editor and use an alternative like MMEdit/Notepad/Xmodem etc.

Edited by MicroBlocks 2015-10-16
Microblocks. Build with logic.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 09:27pm 14 Oct 2015
Copy link to clipboard 
Print this post

  MicroBlocks said  To use the internal editor you need a PC running a terminal program....

Or a VT100 terminal (i.e. not a PC)!

This is just one feature that makes it so powerful to many people.

I agree with you about the space; it just has to be accepted that you can't satisfy everyone's needs with just one solution. . . .

WW
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:34pm 14 Oct 2015
Copy link to clipboard 
Print this post

  WhiteWizzard said  
  MicroBlocks said  To use the internal editor you need a PC running a terminal program....

Or a VT100 terminal (i.e. not a PC)!

This is just one feature that makes it so powerful to many people.
WW

I have been known to use my phone as a terminal.

(No I am not going to produce MMEdit for Android)

Jim

VK7JH
MMedit
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 09:36pm 14 Oct 2015
Copy link to clipboard 
Print this post

  TassyJim said  (No I am not going to produce MMEdit for Android)

How about iOS then
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 10:08pm 14 Oct 2015
Copy link to clipboard 
Print this post

  MicroBlocks said  I only bring it up because flash is running out and very use full features can not be added. The choice is either have those extra features that can have no alternative or remove the editor and use an alternative like MMEdit/Notepad/Xmodem etc.



I would expect that if you want more features, you use the MM+ in either 64 or 100 pin flavours. The 28's will be for less intensive tasks. I would not expect that Geoff would be adding much more to the 170 series for exactly the reasons you indicate - lack of flash. The 470 does not have the same problems there.

Perhaps as simple as: "You need the advanced features? Use the MM+."

You might have space constraint reasons for wanting the 28's. In that case, you might be stuck or in need of a PCB redesign....
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 2 of 3    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025