Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:34 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 8

     Page 1 of 2    
Author Message
Geoffg

Guru

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

In what has become a tradition I have started a new thread for the Micromite beta 8.

This contains fixes for all known bugs and a few new features:
- The STR$() function has been expanded so that you can format a number with leading blank characters and a specified number of decimal places.

- There are two new commands for driving an LCD in "raw mode". These are LCD CMD and LCD DATA. A lot of people have asked for this and its overhead was small.

- Due to "popular demand" there is a new command (DS18B20 START) which will start the measurement on a DS18B20 sensor. Your program can then do other things while the measurement is in progress and later use the DS18B20() function to get the reading. This command is optional, if you do not use it the DS18B20() function will act exactly the same as before.

In implementing the expanded STR$() function I discovered some inefficiencies in the previous method of converting a float to a string. As a result these new changes are neutral with respect to the amount of free flash that is available (for the RF modules when they arrive).

I must admit that I dislike counting bytes. It forces you into bug prone programming convolutions that recalls the days when I squeezed BASIC into an 8080 chip with 4KB RAM. The full sized PIC32 chips are much easier in that regard.

Geoff
Geoff Graham - http://geoffg.net
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2817
Posted: 04:50pm 01 Mar 2014
Copy link to clipboard 
Print this post

And I was just about to go to bed when guess what just arrived in my inbox

Have to sleep first but will begin Beta 8 testing in the morning.

Thanks for the new commands - they WILL prove useful for many of us!

PS Do you ever sleep Geoff??
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 04:51pm 01 Mar 2014
Copy link to clipboard 
Print this post

How are you going in the free flash department?
I only ask, as you keep adding new features, but have not yet seem to have run out of space!
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

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

As I said I have discovered some inefficiencies in the previous method of converting a float to a string. As a result these new changes are neutral with respect to the amount of free flash that is available.

At this time there is about 4K free so I am hoping that the RF commands will come in under that. There are a few more tricks available to free up flash but they have a performance penalty so I want to avoid them if I can.

Geoff
Geoff Graham - http://geoffg.net
 
plasma
Guru

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

thx geoff , sounds great !
i run some i2c routines sinces 3 days , its rock solid !!!
thx again .
 
Lou

Senior Member

Joined: 01/02/2014
Location: United States
Posts: 229
Posted: 10:30pm 01 Mar 2014
Copy link to clipboard 
Print this post

Geoff,

Thanks for the expanded STR$() function, I think I can use it in a program I'm working on. In reading about STR$() in the beta 8 manual I noticed a typo, you have "the number" in there twice at the end of the sentence.
If 'n' is not specified then the number of decimal places
will vary according to the number the number.

Also verified the counter input pins on both 28pin and 44pin devices return "0" now, not "1" until pulses are actually counted.

Lou
Microcontrollers - the other white meat
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 926
Posted: 11:05pm 01 Mar 2014
Copy link to clipboard 
Print this post

Thank you again Geoff, cannot wait to start playing with the new commands.

Could this be a small typo on page 50? Or am I interpreting it wrong ?

STR$(55, 6) will return " 53"
STR$(55, 6, 2) will return " 53.00"


All the best
Graeme
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 10:25am 02 Mar 2014
Copy link to clipboard 
Print this post

Geoff,
My 3 terminal ultrasonic range module works well as a three terminal device. That saves another pin (and diode).

The STR$ function is good but could you change it to round instead of truncate?

> print str$(-123.456,6,2)
-123.45
> print str$(123.456,6,2)
123.45
>
> print str$(-1,0,1)
-0.9
>


New users have enough trouble with the oddities of floating point without "-1" becoming "-0.9"

Graeme,
The first number is the number of "whole digits plus padding" while the second is the number of decimal places.

This way a table of numbers will be "decimal aligned" with or without the decimal places showing.

The alternative would be having the first number specifying the total length of the string which is what I think you are expecting.

Either way has it's uses.

Jim

VK7JH
MMedit   MMBasic Help
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 05:37pm 02 Mar 2014
Copy link to clipboard 
Print this post

a couple of quick questions for geoff:

1. how difficult would it be to make the micromite receive NEC IR control codes?

i just notice that small remote controls that transmit NEC codes (38kHz carrier) are very cheaply available on ebay, whereas ones that do sony codes are much more expensive (apart from 2-button sony DSLR remotes for about $1.50).

and,

2. would it be possible to have the RTC GETTIME command also configure the pulse output pin of the PCF8563? even if only setting it to 1 pulse/sec, this would then allow for precise timekeeping with a little user code.


cheers,
rob :-)
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 05:49pm 02 Mar 2014
Copy link to clipboard 
Print this post

  rob said  2. would it be possible to have the RTC GETTIME command also configure the pulse output pin of the PCF8563? even if only setting it to 1 pulse/sec, this would then allow for precise timekeeping with a little user code.



Surely this feature can be accessed using a simple i2c command as the RTC chip is i2c and has a i2c address? I don't have a PCF8563 but I do have an i2c RTC chip and do all my RTC functions with i2c.
David M.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1873
Posted: 06:03pm 02 Mar 2014
Copy link to clipboard 
Print this post

SPI pins.
In the example on page 47 Geoff has used pin 11 as the enable pin. But on page 6 it states that this pin is not to be used as it is dedicated to a function.
Is the example wrong and should I use another pin for enable.
I had this SPI working on my MM and I am trying to change the code to work with the Micromite.
Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 06:14pm 02 Mar 2014
Copy link to clipboard 
Print this post

  robert.rozee said  
2. would it be possible to have the RTC GETTIME command also configure the pulse output pin of the PCF8563? even if only setting it to 1 pulse/sec, this would then allow for precise timekeeping with a little user code.

Rob
If 32,768 Hz will do you then the PCF8563 runs that on the CLKOUT at power on with no further assistance.

However, it can be disabled or frequency changed by command.Edited by BobD 2014-03-04
 
robert.rozee
Guru

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

you are indeed right, a 1Hz output can be accomplished by writing 83h to register 0Dh, something that would probably consume an extra half a dozen bytes within the interpreter.

i'm guessing that the basic code would be something like this:

I2C OPEN 100, 0
I2C WRITE &hA2, 0, 2, &h0D, &h83
I2C CLOSE

as it stands, a 32kHz is not really that useful, being too fast to sensibly tie to an interrupt service routine. at a 1Hz rate, however, it could be used to derive a correction for the 32MX's internal clock.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 07:11pm 02 Mar 2014
Copy link to clipboard 
Print this post

Rob, I am not a participant in the MicroMite testing so I don't have the doco but the address of A2 is not correct. It is if you are using C or assembler but not microMite Basic. It is a 7 bit address. Do a right shift by one bit and you get an address of &H50 and the read / write bit is added by the interpreter according to the command you are using.
Bob
 
BobD

Guru

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

Rob, I was working on memory when I wrote that last reply. My answer was correct at &h50 for a 7 bit address but it was not a correct right shift of your address of &hA2 which is &h51.

The PCF8563 does not implement a 7 bit address of hex 51. Were you reading the PCF8583 datasheet? It implements an adjustable A0 address on pin 3 which means it can use hex 50 or 51 as the 7 bit address.

Apologies to anyone I may have confused with the right shift error. I even confused me for a while.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 08:30pm 02 Mar 2014
Copy link to clipboard 
Print this post

i was looking at the PCF8563 datasheet, which reads:
"I2C-bus slave address: read A3h and write A2h".

the above code was just a best guess, i know nothing about the mechanics of talking to I2C devices and don't have the hardware in front of me to test. was hoping that it would be trivial to add the needed code into the MMbasic interpreter as having a 1Hz clock available for timing and calibration does seem like it may be useful for various applications.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 09:05pm 02 Mar 2014
Copy link to clipboard 
Print this post

Rob, we may both be correct. Sort of. What was the date on your datasheet? Mine was 1999 rev 1. I've had it for a while but never used it before. You obviously have a later one and that has to be more correct. I better find a newer one.

Use the address of &h51 instead of A2 and your code should work.
Bob
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 09:15pm 02 Mar 2014
Copy link to clipboard 
Print this post

Rev. 10 — 3 April 2012, the first result google throws out.
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:32pm 02 Mar 2014
Copy link to clipboard 
Print this post

  BobD said  
Use the address of &h51 instead of A2 and your code should work.
Bob


Spot on this one is correct


Jman
 
Geoffg

Guru

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

  palcal said  In the example on page 47 Geoff has used pin 11 as the enable pin. But on page 6 it states that this pin is not to be used as it is dedicated to a function.

Yes, you are right (for a 28 pin device). I tested it on a 44-pin device which was why I used pin 11. I will change the manual to use pin 10 which is free on both devices.

  Lou said  I noticed a typo, you have "the number" in there twice at the end of the sentence.

Thanks Lou, I will fix it.

  TassyJim said  The STR$ function is good but could you change it to round instead of truncate?

Good point, should be easy.

  robert.rozee said  1. how difficult would it be to make the micromite receive NEC IR control codes?

Sorry Rob but no way. There are hundreds of protocols and I would be entering a black hole if I tried to implement everyone's favourite.

  robert.rozee said  would it be possible to have the RTC GETTIME command also configure the pulse output pin of the PCF8563?

You can do this easily enough using the I2c protocol so, no I don't have plans to add this (or any other) option.

GeoffEdited by Geoffg 2014-03-04
Geoff Graham - http://geoffg.net
 
     Page 1 of 2    
Print this page
© JAQ Software 2024