![]() |
Forum Index : Microcontroller and PC projects : Micromite MkII beta testers needed
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Justplayin![]() Guru ![]() Joined: 31/01/2014 Location: United StatesPosts: 327 |
I read this in the CHANGE LOG: So, I decided to give it a try... When I type PRINT PIN(0) the Micromite displays power on message. Am I doing something wrong? --Curtis FYI - I'm using a 28 pin chip. I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
You can still use the $ for strings so there is no need to retrain. Some languages prefer to declare all variables and determine their type when they are declared. I will probably stick to strings with $ for MMBasic although I do go without them in other languages. As your programs get bigger, options like declaring variables before use are very useful. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
Worked OK for me. 28 pin Beta16 Jim VK7JH MMedit |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
@Grogster - To clear up the mechanism for declaring the type of a variable... You can set the type of a variable in a number of ways: name$ = "Grogs" This is the old method (still supported) where the variable is automatically created and the $ suffix specifies that it is a string. Automatic creation of variables can cause some nasty bugs so if you do not want this you can use OPTION EXPLICIT.
DIM name$
In this case the variable is explicitly declared and you use the $ suffix to specify that it is a string. Note that you will also need to use the $ suffix whenever you refer to the variable in your program.
name$ = "Grogs" DIM STRING name
In this case the type is specified in the declaration and the suffix is not needed (although you can still use it if you want). This is the preferred way of doing it as it leads to fewer bugs.
name = "Grogs" DIM name AS STRING
This is the way that Microsoft does it in Visual Basic and you can use the same syntax in MMBasic.
name = "Grogs" When you specifically set the type of the variable in the declaration MMBasic will then know its type and will prevent misuse of the variable, even if it does not have a suffix. For example: > list
DIM STRING name name = 1234 > > RUN [2] name = 1234 Error: Expected a string > With the larger memory space in the Micromite MkII people will be writing more complex programs with more chances of creating bugs. These changes have been implemented to make it easier to write bug free programs. However, you can still use the old methods which are OK for quick and dirty programs. Geoff Geoff Graham - http://geoffg.net |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Excellent, thanks Geoff. That explains it perfectly, and I can see the need for it, and the reasons behind it for helping to minimize bugs. Smoke makes things work. When the smoke gets out, it stops! |
||||
Justplayin![]() Guru ![]() Joined: 31/01/2014 Location: United StatesPosts: 327 |
Okay... I have been testing programs on the Micromite for several hours and all was fine until the Pin(0) reset problem. Since it worked for TassyJim I rechecked my breadboard setup and found a missing jumper wire. I must have pulled it out by mistake after doing one of the hardware tests. I also switched from using the USB adapter for power to a separate 3.3v power supply. It still does the same thing. I'll have to flash another chip and see what happens with it. --Curtis I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!! |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
Pull up/ down works fine. I have also the pin 1 reset on Mk2 |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
i'm hoping it is actually more like (+/-1sec) + (+/-0.5%) The sleep timer uses the LPRC oscillator which Microchip says is +/- 15% plus there are other inaccuracies. The SLEEP command was never intended for accurate timing, if accuracy is important you should use an external RTC with an alarm output connected to the WAKEUP pin. Geoff Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2428 |
The sleep timer uses the LPRC oscillator which Microchip says is +/- 15% plus there are other inaccuracies. The SLEEP command was never intended for accurate timing, if accuracy is important you should use an external RTC with an alarm output connected to the WAKEUP pin. Geoff the application i have in mind is an intervalometer, where a small amount of drift is ok. if the drift characteristics are mostly determined by temperature and supply voltage changes (suggested as contributing factors in the datasheet), then one could perhaps compensate for these - over a limited range a simple linear approximation would probably do. pushing drift down to +/-2% would be quite acceptable. an LM555 could likely achieve this. would it be practical/easy for the on-die temperature sensor to be made accessible within MMbasic? along with the per-second increment applied to TIMER after waking up? (maybe as MM.LPRC which has a default value of 1000) being able to read the on-die temperature sensor voltage would also enable compensating for ADC drift for the analog pins as well. perhaps accessing it as on_chip_temp = PIN(-1) could be used? largely just me musing here at 2am in the morning. rob :-) |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
a reset solved my question so i delete my message it contains no info for others. |
||||
Synergetic![]() Newbie ![]() Joined: 14/01/2013 Location: New ZealandPosts: 22 |
Now that is for me the single most important feature. Together with bitwise operators there are no more limits in usability. Wait until you get into CFunctions (was called plugins). They have changed out of sight and I have great hopes for them. The beta distribution includes a SerialTx CFunction which adds up to eight transmit serial ports (that is 13 serial ports counting COM1, COM2 and the console). In the future I hope that people will add extra I2C and SPI channels, encryption algorithms, drivers for special chips and more. They can all be done using CFunctions. Geoff Geoff, Sounds like this will really open up "Open" MMbasic extensible functionality to the USER community .. Well Done !! |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
Let there be light .... Cfunction provide Ws8211 This Video shows the WS8211 Led stripe powered from my Cfunction on Micromite MK2. At the moment it can provide up to 85 Leds . Its not a Lurker . iam not happy with my code ( to much bytes, only up to 85 leds also) so i fight next days with it to provide here a lib for the leds. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
That is brilliant. It also illustrates what you can do with CFunctions - something that was not possible in BASIC alone. Geoff Graham - http://geoffg.net |
||||
Oldbitcollector![]() Senior Member ![]() Joined: 16/05/2014 Location: United StatesPosts: 172 |
@plasma... brilliant! I just got a few of those LEDs in this morning and was starting to wonder if MMBASIC or Cfunction couldn't be used for this.. Looking forward to your code... My Propeller/Micromite mini-computer project. |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
Hi, Iam working on a port to provide much moore Rgb leds as 85. At the moment the leds are stored in a string. Iam thinking about an array but i dont know if I can dim an array as byte(s). I know i can use char for this in c but in basic I need to shift so much bits if i use integers in Mmbasic Thx |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1569 |
Hi plasma, I can dim an array as byte(s). Dim MyArrayofBytes(500) length 1
does not work in uMite MMBasic? Mmbasic I guess there is not a big difference. Because MMbasic (32bit system) needs to do that - or something equivalent - internaly if you are using Bytes. Or i'm completely wrong? Grüße Michael causality ≠correlation ≠coincidence |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
You can DIM an array in MMBasic as INTEGER, ie 8 bytes/element. Then in your CFunction treat it as 8 chars per element, ie MMBasic doesn't know what your CFunction is doing with the memory block. So for example, DIM MEM%(1024) 'Declare Memory block of 8 KBytes in CFunction, long long main(char *mem){... Code ...} does that make sense ? Peter The only Konstant is Change |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
Thx , i take a look |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
Right peter , this is what i mean . I need to calculate the integer in mmbasic for storing r,gb in and have have 2 bytes free before i can store rgb in the next integer. I prefere a continued block of mem to become a fast routine without delays from the code. Maybe the chars from strings are in the memory without spaces or data between ? I need to test this . Gtx |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
So do U mean R<0..7>G<0..7>B<0..7>Byte<0..7>Byte& lt;0..7> ie 5 bytes per record/element ? If so then you could fit the 5 bytes into a 64 bit integer, and just 'waste' the other 3 bytes in the 64 bit integer. I'm guessing that a UDT like Type RGB Byte R Byte G Byte B Byte Spare1 Byte Spare2 End Type is what you'd like ideally ? Peter The only Konstant is Change |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |