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 : MMBasic 4.5 on Duinomite
Author | Message | ||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Hi, I have a small project I am working on and thought I would give MMBasic a shot since Wattmon does not have enough IO lines and woud cost more to set up. The idea is to use a coin acceptor with pulse output to receive money and dispense an amount of filtered water. I am now trying to just get basic IO working - can someone tell me whether the pin mappin is equivalent? I tried setting outputs on the D0-D7 but didnt get very far... |
||||
hitsware Guru Joined: 23/11/2012 Location: United StatesPosts: 535 |
Is this what you need ? |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Muchas gracias, Mercy buckets! |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Ok - great, I got my LCD up and running with a Onewire temperature probe, took no time at all! Now, I would like to count pulses for both a flow meter and a 'coin acceptor', and I have set this up as per the manual: SetPin 5,INTH,Rint Rint: Counter = Counter+1 IReturn The question I have is would it be better to use a pulse counter, and if so how does that work? This does seem to work fine, I just wonder what the maximum frequency would be that it works at. |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
It is better to used define subroutines instead of labels. With labels you have the change that code "falls through' a label and executes code that is not intended to run. [code] SetPin 5, INTH, Rint SUB Rint Counter = Counter + 1 END SUB [/code] Keeping the interrupt handling subroutine as short as possible helps a lot. If you only increase a counter like here then you might be able to process a few hundred per second. If in your case the pulse are much slower it can make your code easier to maintain when you add some code to the interrupt. Like checking the counter if it reached a certain value and then shut down the flow. In you main program loop you can then build in some safety features like using timeouts to make sure waterflow shuts down within a certain time. Check feedback switches (waterlevel?), container in place etc.. I am very interested in this project as here in Thailand the water dispensing machines are very expensive to buy. Being able to build one would increase its availability. Microblocks. Build with logic. |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Thanks for the info, TZAdvantage. I am doing this for a small company here that is trying to make low cost water dispensers with quality drinking water to try and reduce plastic bottles. I will certainly let you know how it goes and perhaps you could get the machines from them once it has been developed. We are looking to put in a TDS sensor as well to ensure the quality of water. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Gday Akashh and Hitsware, That diagram you posted I think only applies to the DM `fork' of MMBasic which was based on the earlier MMBasic ver 2.7a. I confess I have never used MMBasic on the DM and only have experience with the DMBasic `fork' of MMBasic. That table is one I created from an earlier one by, I think, Gerrard. I believe the MMBasic that Geoff offers for the DM does not use all I/O pins that are available on the DM. From memory only 15 pins are supported, the reason being that the DM shared pins with the SD card and Video, to use all 20 as IO it was necessary to disable SD and Video ability. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3678 |
I suspect Geoff's own info is the answer: DuinoMite MMBasic John |
||||
hitsware Guru Joined: 23/11/2012 Location: United StatesPosts: 535 |
> That table is one I created from > an earlier one by, I think, Gerrard. You made that table ? Seems to be working for Akashh . I know it's a ball of confusion with so many designations for each pin-path .... |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Well it mostly works but certain pins didn't work and this is as Goeff pointed out in the docs because they would otherwise interfere with SPI ports and VGA. I think that there are about 14 usable IO lines when using mmbasic 4.5, and that should be enough for me. I very much like the way it's so easy to define interrupt handlers for change notifications, it makes things like button presses and flow pulse counters very easy to use. I had some trouble with the vt100 terminal under linux since the default terminal size is less than 25 lines. This caused the editor to remain blank, i wonder if that couldnt be fixed? I think there is a way to get the number of rows in a terminal window using vt100 commands... just a thought. Increasing the window size fixed the issue. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3678 |
Look at the termcap/terminfo data (for VT100) on Linux, change it a little for the 'mite (number of lines etc), give it a name and there you go. John |
||||
Print this page |