Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:34 16 May 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 V4.7 Beta 11

     Page 1 of 2    
Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 10:12pm 11 Jun 2015
Copy link to clipboard 
Print this post

There is a new beta version of V4.7 for the Micromite.
It can be download it using this link: http://geoffg.net/Downloads/Micromite/Micromite_4.7_Beta11.zip

This has three major changes over beta 8:

- Fixes the issue with the DISTANCE command.

- Implements the new reset feature discussed some time ago. Now, if you want to reset the Micromite to "factory defaults" just hold down the exclamation key (!) on the console (38400 baud) while applying power to the Micromite. Keep holding it down (about two seconds) until you get the reset message.

- Has a more sensible method of sharing the SPI port with the display and touch. Now, you must open the SPI port, read/write to it then close it before doing any display/touch commands. Chip Select must be managed by the BASIC program. The old beta 8 way of doing things is still there but I will remove it later.

This is an example of Zonker's code which shares the SPI with display/touch commands.



' initialise everything
DIM LTCrxdata%(2)
PIN(26) = 1
SETPIN 26, DOUT ‘ pin 26 will be used as the enable signal
' other stuff including possible display and touch commands

LTCread_status_reg ' get the status reg
' more general code including possibly more display and touch commands

LTCread_status_reg ' get the status reg for a second time
' more stuff

END

' sub to get the LTC status
Sub LTCread_status_reg
SPI open 4000000,0,8 ' 4meg speed, mode 0, 8bits
PIN(26) = 0 ' chip select low
SPI write 3,3,0,0
SPI read 1, LTCrxdata%(1)
PIN(26) = 1 ' chip select high
SPI CLOSE
end sub


Geoff

Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 12:56am 12 Jun 2015
Copy link to clipboard 
Print this post

Sweet Geoff..!

Getting ready to head into work... Will get this tested out as soon as i get home...

The code snippet shows the program controlling CS but I will change it to:

SPI open 4000000,0,8,26

This will let MM firmware run the CS bit... Ok...

Touch Panel telemetry module on the way..! Will post demo video when ready..!
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 03:39am 12 Jun 2015
Copy link to clipboard 
Print this post

Hi Geoff !
Unfortunately I have 2 new problems with the version 4.7B11:

This program works with V4.6B2 without problems:

trigPin = 17
echoPin = 18
voltPin = 2
refPin = PIN(0) / 1.2
SETPIN voltPin, AIN

DO
volt = voltPin / refPin
dst = DISTANCE(trigPin, echoPin)
PRINT "DIST="dst" SPG="volt
PAUSE 1000
LOOP


V4.7B8:
refPin = PIN(0) / 1.2 'OK'
dst = DISTANCE(trigPin, echoPin) 'Works not correct: I read only 0.4'

V4.7B11:
refPin = PIN(0) / 1.2 "ERROR invalid Pin"

1. loop, distance-value OK
2. loop, ERROR pin 17 is in use !


Thank you !

WolfgangEdited by PicFan 2015-06-13
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 04:17am 12 Jun 2015
Copy link to clipboard 
Print this post

Ah, I removed the code for reading the internal reference. Eg, PIN(0). Due to issues in the PIC32MX170 chip this function would occasionally cause the Micromite to restart without warning.

It just shows, once you put something in the language you can never remove it.

Do many people use this feature? Is it worth putting it back in?
Geoff Graham - http://geoffg.net
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 04:34am 12 Jun 2015
Copy link to clipboard 
Print this post

Hi Geoff,

I have used it but not in production, only testing.

What I actually feel should change though is the assumption of a regulated 3V3 supply and returning a value of 0-3.3 as a float.

I generally run my devices somewhere between 2.5 and 3.0 volts, from batteries, and an integer value of 0 - 1024 is a lot easier to scale according to the supply voltage and input voltage divider than a float.

Would it be possible to have an OPTION to return ether Int or Float with the current float as the default?

Or alternately a System variable for Vdd so that the Conversion adapts to the actual supply voltage?

I think that would eliminate 90% of what people are using the PIN0/VRef to circumvent.

Cheers
Chris
Edited by Chris Roper 2015-06-13
http://caroper.blogspot.com/
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2294
Posted: 04:57am 12 Jun 2015
Copy link to clipboard 
Print this post

i'd very much like to see the feature put back in if it can be made safe. this may be as simple as implementing it in a slightly different form.

as i recall, problems were encountered when people read the reference before any other analog reads were made, whereas the sample code given in the micromite manual (and perhaps most testing testing done) was with code like this:

A = PIN(x) / (PIN(0) / 1.2)

am i right in saying that if the above format was always used - with an analog input pin read just before the reference - then everything would be ok? this being the case,l then my suggestion (that i have made before) is that reading the reference be made a part of the pin reading command, something like:

value = pin( n [, scale])

thus pin(2) would return the analog input at pin 2 assuming a 3v3 supply (as is currently implemented), while pin(2, 1.2) would return the value scaled using the bandgap reference (assumed to be 1.2v). using a scale value other than 1.2 would allow the returned value to be corrected for both variances between bandgap references on individual MX170's, as well as any input divider at the pin:

volts = pin(2, 1.1 * 10)

the above line would return a voltage based upon a 1.1v actual reference and a 9k/1k input divider between the measured source and pin 2. as an added bonus, the pin( n [, scale]) format would always use a current reading of the reference - only reading the reference at program startup (as some people seem to be doing) has the problem that if a battery supply tapers downwards while the program is running, this is not compensated for.


cheers,
rob :-)Edited by robert.rozee 2015-06-13
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 06:10am 12 Jun 2015
Copy link to clipboard 
Print this post

I had a typo in Program, here the correct version.


This program works with V4.6B2 without problems:

trigPin = 17
echoPin = 18
voltPin = 2
SETPIN voltPin, AIN

DO
refPin = PIN(0) / 1.2
volt = voltPin / refPin
dst = DISTANCE(trigPin, echoPin)
PRINT "DIST="dst" SPG="volt
PAUSE 1000
LOOP


V4.7B8:
refPin = PIN(0) / 1.2 'OK'
dst = DISTANCE(trigPin, echoPin) 'Works not correct: I read only 0.4'

V4.7B11:
refPin = PIN(0) / 1.2 "ERROR invalid Pin"

1. loop, distance-value OK
2. loop, ERROR pin 17 is in use !


Thank you !

WolfgangEdited by PicFan 2015-06-13
 
rentner111
Newbie

Joined: 18/03/2014
Location: Austria
Posts: 19
Posted: 11:08am 12 Jun 2015
Copy link to clipboard 
Print this post

Hello Geoff!

Thanks for the version 4.7 beta 11th

Unfortunately command works the "DISATNCE" only once.
The second call is an error message.

EXAMPLE:

Power-On.
First entry: print DISTANCE (22,21)
First answer: 23.6

Second input: print DISTANCE (22,21)
Second answer: Error: Pin 22 is in use

Distance command works only after a restart.

I have helped me so that I the trigger pin and echo pin each time with

Setpin 22 OFF
Setpin 21 OFF

back set.

In this way the DISTANCE command works, but if this is correct?

print DISTANCE (22,21)
23.6
Setpin 22 OFF
Setpin 21 OFF

print DISTANCE (22,21)
23.6
Setpin 22 OFF
Setpin 21 OFF


I have an LCD panel connected ili9341.
In the new version of the RESET pin is not driven.


Best regards from Tyrol
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 12:19pm 12 Jun 2015
Copy link to clipboard 
Print this post

  rentner111 said  Unfortunately command works the "DISATNCE" only once.
The second call is an error message.

Sorry about that. I will be travelling the next week and I will try to get a modified beta out while I am away but at least you have a good workaround.

  rentner111 said  I have an LCD panel connected ili9341.
In the new version of the RESET pin is not driven.

This is strange, it seems to work for me. Could you elaborate please?

GeoffEdited by Geoffg 2015-06-13
Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 06:31pm 12 Jun 2015
Copy link to clipboard 
Print this post

Ok...

So, i got the download and shot the first 28 pinner... Seemed to go good...

Then, I loaded the starting program I left off with.. Hit the editor, and Yikes things started getting weird... I saw the first line but everything else was not seen, but still there... Anyway, I thought somehow I got a bad copy, so downloaded a fresh one... Same thing... Tried shooting the other test board... same thing... what..! ... So, I re-shot beta 8 back in... All good... what...! Yikes.. Am i the only guy that can't get this going..?

P:S:... The Baseball game was great..!! What an awesome birthday gift...!

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 08:27pm 12 Jun 2015
Copy link to clipboard 
Print this post

@rentner111
  Quote  
I have an LCD panel connected ili9341.
In the new version of the RESET pin is not driven.

I have no problems with the ILI9341 display.
For D/C pin, reset pin ,CS pin I am using 4,5,6 on a 28 pin 170.
What pins are you using?

@Zonker
  Quote   Hit the editor, and Yikes things started getting weird...

No obvious problems here but I am only playing with a short program..

@Geoff

I DO seem to have a problem calibrating the touch screen
The first target and prompt appear for a couple of seconds then the display goes blank.
I use "OPTION TOUCH 2,7" on a 28 pin 170 to set up the touch.

The display clears before I have time to "touch" it.
CTRL-C brings the prompt back.

JimEdited by TassyJim 2015-06-14
VK7JH
MMedit   MMBasic Help
 
yobortsa
Newbie

Joined: 12/12/2011
Location: Australia
Posts: 37
Posted: 05:20pm 13 Jun 2015
Copy link to clipboard 
Print this post

@Zonker, I also get issues with editor not displaying when I use Putty. Just the first line, everything else blank. Beta 8 is ok for me also.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 05:52pm 13 Jun 2015
Copy link to clipboard 
Print this post

Yep... Not sure why it's working for some people and not others... On mine the display doesn't init correctly either... I go back to B8... All Ok.. I guess we could "bit-bang" a soft SPI and see if that works on B8...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 07:20pm 13 Jun 2015
Copy link to clipboard 
Print this post

I have found the problem with Putty and Beta11

The Editor is sending ESC[30m at the end of each line and this sets the foreground colour to black.
Since Putty is usually run with a black background, the text is invisible.

In Putty, go to Change settings.../Window/Colours/ and change default background to 255 255 255 (White)

You may want to change the other defaults but just the background will do for now.

I have in the past tried to make sense of putty's colour setup but without much success.

Jim

VK7JH
MMedit   MMBasic Help
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 07:21pm 13 Jun 2015
Copy link to clipboard 
Print this post

Sorry about this folks... I should not put out a new release just before I go travelling. I am away from my test setup for the next week so I cannot test these reports. I did run this release through my test suite and it passed, so it seems that these problems are caused by something not covered by the test suite or something that went wrong when I packaged it up.

I will look at this over the next couple of days but probably it will be a week before I can fix them. In the meantime, if B11 is causing trouble for you it might be best to go back to B8.

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

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 07:25pm 13 Jun 2015
Copy link to clipboard 
Print this post

Enjoy your travels Geoff, beta's are supposed to be a 'learning experience'

RE Putty,
I also changed the default foreground colour to 63 63 63 and things look OK

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 10:48pm 13 Jun 2015
Copy link to clipboard 
Print this post

  TassyJim said  
I DO seem to have a problem calibrating the touch screen
The first target and prompt appear for a couple of seconds then the display goes blank.
I use "OPTION TOUCH 2,7" on a 28 pin 170 to set up the touch.

This was an operator error....
I had the two pins for T_CS and T_IRQ back to front.
The calibrate routine works as it should. Sorry about the noise...

Jim

VK7JH
MMedit   MMBasic Help
 
piclover
Senior Member

Joined: 14/06/2015
Location: France
Posts: 134
Posted: 04:38am 14 Jun 2015
Copy link to clipboard 
Print this post

  Geoffg said   Ah, I removed the code for reading the internal reference. Eg, PIN(0). Due to issues in the PIC32MX170 chip this function would occasionally cause the Micromite to restart without warning.

It just shows, once you put something in the language you can never remove it.

Do many people use this feature? Is it worth putting it back in?

I do... Without this feature (which was cruelly lacking in Mk I), the problem with the Micromite, is that it can't use an internal reference and must rely on the accuracy of the analog power supply.

In my first Micromite project (a bench testbed for the Micromite), which was using the MX150 (Mk I), I even had to use a (venerable but still great) LM723 as the regulator to achieve a 10mV (or better) accuracy...

Of course, it would be even better if we could configure the Micromite ADC to use its internal reference instead of the analog power supply as the reference voltage... The PICAXE got this feature (it even got 2 references: 2.048 and 4.096V), and it's really great (it's still sensitive to temperature changes but at least it's totally independent from power supply variations).
The PIN(0) reading in the MX170 at least allowed to make for the absence of such a feature...
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2294
Posted: 06:01am 14 Jun 2015
Copy link to clipboard 
Print this post

i presume the reason for using the 3v3 (analog) supply as the reference was to allow the analog inputs to measure any voltage between ground and Vcc. if the internal reference were used directly for the A/D conversion then an extra external voltage divider would be required whenever an analog input was used. it would have also been necessary to have a return value that indicated an over-range condition.

the weakness with the pin(0) solution (apart from the resetting problems some folks have been seeing) is that it allows the programmer to read the reference just once at program startup, rather than requiring a reference read every time an analog input is performed. given that Vcc can drift as batteries run down, or temperature changes, reading the reference just the one time is not prudent.


cheers,
rob :-)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 11:47am 14 Jun 2015
Copy link to clipboard 
Print this post

I have used an external reference - LM336 in my Maximite/micromite projects when an accurate reference was needed. You can check it at any time but it does use one analogue pin.

Jim

VK7JH
MMedit   MMBasic Help
 
     Page 1 of 2    
Print this page
© JAQ Software 2024