Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:50 29 Nov 2024 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 Beta 10

     Page 3 of 4    
Author Message
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 07:53pm 12 Mar 2014
Copy link to clipboard 
Print this post

Hi Geoff,

Here's the possible STR$ bug I mentioned. I remove a space so it can run on 16x2 or 20x4 LCD's in case you've got the 16x2 set up, and included a working version. I've 'distilled' the problem area to the code at the bottom.

I'm displaying a mins/secs "Set Time" with the "Countdown" directly below it for a UV lamp PCB exposure box. (I'll write it all up for TBS when it's finished.) The 01:04 example is previously set via a keypad.

LCD INIT 2, 3, 4, 5, 23, 24
lcd 1,1, " Time set= 01:04"
totsecsrem = 64 'total seconds remaining
settick 1000,countdown

do
loop

countdown:
totsecsrem = totsecsrem - 1
print totsecsrem
remmins = totsecsrem/60 'remaining mins plus fraction
dispmins = fix(remmins)
dispsecs = cint((remmins-dispmins)*60) 'convert fraction of mins to secs
print remmins, dispmins, dispsecs
lcd 2,1, "Countdown= "+ str$(dispmins,2) +":"+ str$(dispsecs,2)
if totsecsrem = 58 then end
ireturn

This is the LCD output - the "Countdown=..." lines replace each other. When the Countdown drops below " 1: 1" it shifts left by one character and displays 3 digits instead of 2 for the seconds (the 3rd is a "1" left over from the countdown at 1 second).


" Time set= 01:04"
"Countdown= 1: 3"
"Countdown= 1: 2"
"Countdown= 1: 1"
"Countdown= 1: 1" This should be " 1: 0"
"Countdown= :591" The '1' stays because the rest shifted left one character

The corresponding output on the console from the "PRINT" commands is:


63
1.05 1 3
62
1.03333 1 2
61
1.01667 1 1
60
1 1 0
59
0.983333 0 59
etc.

These lines should contain the bug - assuming it's there and I haven't stuffed up.


totsecsrem = 60
remmins = totsecsrem/60
dispmins = fix(remmins)
dispsecs = cint((remmins-dispmins)*60) 'convert fraction of mins to secs
lcd 2,1, "Countdown= "+ str$(dispmins,2) +":"+ str$(dispsecs,2)


Greg
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6102
Posted: 08:24pm 12 Mar 2014
Copy link to clipboard 
Print this post

The problem is not with the LCD code.
STR$(0) works OK
STR$(0,2) prints a blank.

print str$(0)
print str$(0,2)
for n = 10 to -10 step -1
print "*"+str$(n,2)+"*"
next n


gives:

0

*10*
* 9*
* 8*
* 7*
* 6*
* 5*
* 4*
* 3*
* 2*
* 1*
* *
*-1*
*-2*
*-3*
*-4*
*-5*
*-6*
*-7*
*-8*
*-9*
*-10*
>



Jim
VK7JH
MMedit   MMBasic Help
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 01:26am 13 Mar 2014
Copy link to clipboard 
Print this post

@Geoff or all others who know it ...

micomite beta 10

what exactly send the print command if i send some bytes to serial ?

print #1, "xxx" send "xxx" and ( 0d,0a) ?

and

print #1, "xxx"; send only "xxx" ?

and

print #1,"xxx" , send "xxx" and ?

and will close a serial port flush the bytes from the buffer ?

thx
Edited by plasma 2014-03-14
 
Keith W.
Senior Member

Joined: 09/10/2011
Location: Australia
Posts: 118
Posted: 02:01am 13 Mar 2014
Copy link to clipboard 
Print this post

Hi Geoff,

I now have a Micromite embedded project which incorporates a power supply incorporating larger value capacitors, currently fed in turn by a Test 12 volt supply with large capacitors. My Micromite test jig powered from the same supply providing Console comms via a MAX232 converter with again capacitors which are perhaps of a little generous value.

When turning on the power supply, and although Tera Term is on and connected, the Terra Term screen does not show a clean start up message and displays an error indicating that the Micromite thinks it has received a not legit command.

May I suggest that a delay be incorporated in MMBasic start up to allow power supplies to stabilize with then a clear out of comms buffers? Just 1 second might be quite enough. As MMBasic starts OK otherwise adding a voltage monitoring type reset chip to the circuit does not seem called for.

I do not think that my situation will remain unique.

Otherwise V 10 working well; See “ Micromite climbs the stairs” post.


Keith W.
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 02:19am 13 Mar 2014
Copy link to clipboard 
Print this post

  TassyJim said   The problem is not with the LCD code.
STR$(0) works OK
STR$(0,2) prints a blank.
Jim

That's a helluva lot more succinct Jim. At least there is a bug for Geoff to have a look at. Thanks for that.

Greg
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 02:19am 13 Mar 2014
Copy link to clipboard 
Print this post

why not use an r/c and a transistor to switch your micromite on after the supply is on .
i dislike the idea with the delay and i think many others too.
or use an extra supply for , a cheap handy loader costs 2,50 .
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2817
Posted: 02:39am 13 Mar 2014
Copy link to clipboard 
Print this post

Hi Keith,

  Quote   May I suggest that a delay be incorporated in MMBasic start up to allow power supplies to stabilize


IMHO I would strongly advise against adding any delay into the MicroMite start-up.

Since it may resolve your current issue; for other people they may require an immediate startup whether it be a Watchdog timeout that occurred, or initial power-up, or some other triggered 'reset'.

For example a MicroMite controlled device such as a 'vehicle' would remain 'out-of-control' for the period of any delay introduced rather than being back in control immediately after a 'reset'.

I would consider adding a diode and dedicated LDO to your power supply and then you will have a clean start up. This is assuming you are experiencing your issue when you have the correct Caps on the PIC. Use of decoupling caps and the recommended 47uF (ish) Vcap may solve you problem if you don't currently have them.

Alternatively use a different PSU!

I have constructed more than 30 MicroMites and have used different sources of power (i.e. not all using the same PSU). I have never experienced what you are so can only assume it is a PSU issue.

For these reasons I plead with Geoff not to add a delay to resolve what is realistically a PSU hardware issue.

If you are using a 'home-built' PSU as implied by your comment . . . currently fed in turn by a Test 12 volt supply with large capacitors then have you fed this with a different PSU? If the issue is with the 'home-built' PSU then please post a circuit diagram and I will try to recreate your issue!

Regards,

Phil



For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 03:37am 13 Mar 2014
Copy link to clipboard 
Print this post

  TassyJim said  STR$(0) works OK
STR$(0,2) prints a blank.

Ah, thanks - something that I can work with. It will be fixed in the next release.

  WhiteWizzard said  For these reasons I plead with Geoff not to add a delay to resolve what is realistically a PSU hardware issue.

No Phil, I will not.

Just to let everyone know, with the exception of Nordic nRF24L01 support (which I am working on) I will not be adding any new features to the Micromite. I need to stabilise what we have before the Micromite appears in the May issue of Silicon Chip.

So bug reports are welcome but please hold back on the new features.

GeoffEdited by Geoffg 2014-03-14
Geoff Graham - http://geoffg.net
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 03:55am 13 Mar 2014
Copy link to clipboard 
Print this post

I agree with WW. I need very fast start up for several projects and a delay would cause havoc. I too have used multiple psu with umite and have had zero issues with bogus data upon power up.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:36am 13 Mar 2014
Copy link to clipboard 
Print this post

Geoff says…

Just to let everyone know, with the exception of Nordic nRF24L01 support (which I am working on) I will not be adding any new features to the Micromite. I need to stabilise what we have before the Micromite appears in the May issue of Silicon Chip.

So bug reports are welcome but please hold back on the new features.

Geoff

Just so you know, Nordic says its a drop in replacement so code should be the same…

This product is not recommended for new designs. Nordic recommends its drop-in compatible nRF24L01+ or for a System-on-Chip solution the Nordic nRF24LE1 or nRF24LU1+


Can't wait for this feature!!!

Sorry I don't know how to do the white box around other peoples quotes yet, but I swear I will learn...



 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 722
Posted: 04:40am 13 Mar 2014
Copy link to clipboard 
Print this post

Use reset circuit like the LM809/LM810 3-Pin Microprocessor Reset Circuits.

A stable PSU is a must and can not be polished by Software.
Thats the wrong way.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 08:37am 13 Mar 2014
Copy link to clipboard 
Print this post

  viscomjim said  
Sorry I don't know how to do the white box around other peoples quotes yet, but I swear I will learn...

Jim, it's not hard. Here is a small tutorial. For a start, if you want to quote someone's post just use the quote button outlined in red in the next image. If you don't want to quote the whole post just delete text to suit.


The image doesn't look so great because it gets a bit shrunk in the upload etc. but I hope you get the idea. If you want a great looking image with text etc. then ZIP or PDF it and upload that.

The next image has a number of coloured arrows pointing to some of the functions you may like to use when creating your post.


See the red box around the Preview Post button. This button allows you to see your handiwork before going public. Use it as needed.

The cyan coloured arrow points to help for all of the forum codes. It opens in a popup. I can't write any of these codes here because they won't show.

The lime green arrow points to the CODE button. It puts down two CODE words into your text and you put your code snippets between them.

The pink arrow points to the QUOTE button.

The blue and orange arrows point to image and file upload buttons.

And the best for last. URLs, URIs, links, hyperlinks or whatever you wish to call them, are not automatically made active in your post if you paste them in as text. Even worse the forum software inserts strategic blanks into any text that looks like a link so that your link doesn't work. This makes other people unhappy as they try to figure out what you meant and you may get broken link comments. The solution is to use the Add Hyperlink button shown by the red arrow. Click it and follow the prompts.

If you hover over the toolbar buttons you will get a small popup to help you with the use of the particular button. Don't restrict your usage to the buttons I have mentioned. They are all useful.



 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 09:46am 13 Mar 2014
Copy link to clipboard 
Print this post

Thank You BobD. I will give this all a whirl!
 
Keith W.
Senior Member

Joined: 09/10/2011
Location: Australia
Posts: 118
Posted: 05:43pm 13 Mar 2014
Copy link to clipboard 
Print this post

There have been several responses to my suggestion of a turn on delay. Great to have feedback.



But I think that some are not quite seeing my point. I am not asking Geoff to fix my project to start up sweetly, I can do that. But I am suggesting something that might make the Micromite a bit more rugged. This is my view. I had only written about my test supply to make a point, it is stable and accurate but a bit slow to reach full volts from mains turn on. My oscilloscope indicates 30 Milliseconds to ramp to its 12 volts from cold turn on when driving the project, which is reasonable. Just 3 half wave mains pulses from the bridge rectifier. There are numerous factors that could influence this delay but it doesn’t matter. In my finished project it will not be used. A power supply is built on my projects board for which the required mains transformer is not there at present.

If I currently supply my project card via a toggle switch after the test supply output, so that 12 volts is present before powering the project, no initial comms corruption is evident. As is the case if I also turn on power to the Micromite test jig providing the RS232 comms from the post supply toggle switch, so this also is not the limiting factor.

Anyone communicating with the Micromite via a USB to TTL converter which is powered by their PC will never see this/my particular quirk. As I stated earlier it is not the Micromite that is slow to come on, it runs OK. In my case it is that the comms is not ready when the Micromite starts. And yes I have a 47 uF Tantalum cap fitted to the Micromite, those wishing a very rapid turn on should perhaps consider reducing it back to 10 uF that it not become the start up delay.

Out in the cruel hard world should the Micromite have a start up delay? It may only be required for comms, but should delay other outputs and inputs unless the supply and other circuit can be guaranteed available (instantly?).
I had taken the MAX232 chip for my Maximite test jig from a microprocessor board that I designed and built commercially 30 years ago. I could take the DS1232 voltage sensing, watchdog and delay chip that sat beside the Max232 on this old board and use it. However nearly every other feature of this board is now within the Maximite with steroids, watchdog included. The Maximite is now pretty much the whole system. Geoff’s fantastic MMBasic and/or the PIC chip may have a delay already but perhaps another 100 milliseconds would cover all cases. Geoff can inform us of what happens at present. And yes users can provide their own start up circuit if they think it required.

I think that the Beta testing process is proving very fruitful and this is my small contribution.

Keith W.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 06:12pm 13 Mar 2014
Copy link to clipboard 
Print this post

The Maximite has about a half second delay on startup to let everything settle - but that is OK because it is more like a desktop computer. The Micromite has a 1mS delay and I used that because it is more like a microcontroller where you want it to be immediately ready.

If you want to delay the Micromite's startup this can be easily achieved with a capacitor on pin 1 (MCLR) which will hold the processor in reset for as long as you want after power up.

  Quote  I think that the Beta testing process is proving very fruitful and this is my small contribution.

Yes, it is and thank you for yours and everyone's contribution.

Geoff
Geoff Graham - http://geoffg.net
 
Keith W.
Senior Member

Joined: 09/10/2011
Location: Australia
Posts: 118
Posted: 06:41pm 13 Mar 2014
Copy link to clipboard 
Print this post

Thank you Geoff,

Now we know what is happening.

Perhaps it is worth 2 lines of hint in the Manual.

Keith W.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 07:38pm 13 Mar 2014
Copy link to clipboard 
Print this post

Keith, in the final version of your project, surely the micromite will be running in AUTORUN mode? your code can, upon startup, either use a delay or monitor the various needed power supply rails until they reach the required level, before flushing any characters sitting in the input buffer.

Geoff, a quick question: what is the hiword address for the start of RAM? the 32MX datasheet leaves the question not fully defined (there seem to be a couple of options, with the suggestion that it may be remappable). and is the full 32k continuous?


cheers,
rob :-)
 
Keith W.
Senior Member

Joined: 09/10/2011
Location: Australia
Posts: 118
Posted: 08:23pm 13 Mar 2014
Copy link to clipboard 
Print this post

Hi Rob,

Thank you.

It is not about my project which is not mission critical and yes it will AUTORUN and I will not be turning it on and off.

I was concerned for new users who may build up a simple system c/w power supply, not use a USB to TTL converter for Console and wonder why the startup message is corrupt. Not a good look.



Keith W.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 01:24am 14 Mar 2014
Copy link to clipboard 
Print this post

  robert.rozee said  what is the hiword address for the start of RAM? the 32MX datasheet leaves the question not fully defined (there seem to be a couple of options, with the suggestion that it may be remappable). and is the full 32k continuous

RAM starts at 0xA0000000 and is contiguous (it ends at 0xA0007FFF). Flash starts at 0x9D000000.

Geoff

Geoff Graham - http://geoffg.net
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 06:32pm 14 Mar 2014
Copy link to clipboard 
Print this post

Geoff,
Would it be possible to 'allocate' a continous piece of that memory and use it through some array/variable in MMBasic.

I specifically would like the capability of accessing a large byte array.
Is that possible with the current DIM Buffer$(4096) and then define the length as 1?
What kind of overhead will that use?

I could then as an example use that block of memory with head and tail pointers to make a input/output fifo buffer.



Microblocks. Build with logic.
 
     Page 3 of 4    
Print this page
© JAQ Software 2024