![]() |
Forum Index : Microcontroller and PC projects : Example Codes
Author | Message | ||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
I just came across THIS CODE in one of the posts It's extremely useful. Are there any other example codes around that would help newbies like me? I did search but all the links I found are all dead Any chance of a post with just code examples in it? |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1148 |
Hi Lewis, yes, I see the problem. This is not exactly what you are looking for, but maybe in many cases the Maximites code will help you. You can also look at older basic code examples in the WWW. Another way is to have a look at the profiles of some active members (MatherP, Geoff, ...). In general I'm also interested in a MicroMite Library (or a thread with a collection of working code examples). Michael |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2302 |
there was (is?) a library, but the people who maintained it moved on. this seems to be a recurring problem on the internet as a whole. even on this very forum the active (posting) membership base is much diminished from a couple of years ago. one idea might be for someone (or some group) to set up some sort of a 'wiki', like wikipedia, dedicated to the maximite and micromites. a place where anyone can create an article, but edited and vetted by a few, with just enough vague rules to avoid it becomming a commercial billboard. essentially, over time, it would become an organic micro/maximite manual-encyclopedia. for example, one person might write an article on the SERVO command, someone else an article on creating CFunctions, while another person might be interested in putting up a guide on getting firmware into the PIC32 family devices. the trick is capturing a wide interest for contribution and keeping it up to date, and ensuring it doesn't die off as people move on and new users arrive. just my opinion! cheers, rob :-) |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1421 |
I do have room on my web site for projects and example code. I can add authors that can maintain the information. It is a commercial site, as I have made boards for the Maximite and Micromite. I try to take note of the code that is shared here and keep the examples and projects up to date. I've had a busy winter, though, so I have some catching up to do. It would be ideal to have a non commercial site, but there is no reward for the authors. On my site if you are an author of a micromite article I at least offer a discount on what I sell. It is the least I can easily do to help improve resources for the 'mites. Micromites and Maximites! - Beginning Maximite |
||||
Benzol Regular Member ![]() Joined: 07/01/2015 Location: AustraliaPosts: 64 |
Hi all I agree with the concept. As a newbie I find some of the code posted on this site can be intimidating. Even referring the recent Silicon Chip article on the micromite with the ILI9341 to Geoff's manual still leaves me a bit in the dark. Once i get the unit to play with maybe the coding will become clearer but certainly a basic BASIC library would be very helpful. cheers David Benzie |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
I have a domain and hosting that could be used for such a project if someone wanted to set it up I have no idea on how to make a wiki page or set up a website where people can add bits of code to a page for others to see Its just a website I made for myself when I "was going to" do local computer repairs, but this was before I had brain surjery I keep the domain and hosting active because I use the email address and its handy to have as I know the email will neve change If someone wants to have a look and wants to make a site up with code examples its HERE I can set up a sub domain but I'd have to leave the actual setting up of the page to someone who actually knows what they are doing. CircuitGizmos Your Website is very interesting, I had no idea that information was there, it took me a bit of searching to find your website but once found the information is very good What we need though is a site with code examples on it, especially now as the version has been upgraded to Version 5.1 As to the complexities of code and why we need examples - and in an ideal world the examples would have explanations of why they used such a function In the example I posted above - I cannot understand when getting time and date from a GPS module, you need to convert the current day into seconds from a certain date and work from that, |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1421 |
Thank you! I also made a 500 page document on the Maximite. That is still linked to on my sig. There is plenty of room for projects, examples, code libraries, etc on CG. There can be code bits added to any command as an example of that command. Anyone can suggest that as a comment to that command page, and I'll then officially add it to the page. I've listed a lot of MatherP's fantastic code in the library/project section. Anyone else that want's their code saved there I'm willing and happy to give it a home. If you have a project with code and pictures it can be sent to me and I'll put it in a project category. If you have a lot of samples to contribute I can make you an author to create your own articles. Yes it is a commercial site, but the Maxi/MicroMite boards and all of the 'mite information on CG are more of a labor of love. I hope to gather what info I can, make what boards I can and offer them to make more worldwide 'mite fans. Please help me to keep the awareness of 'mites growing. Micromites and Maximites! - Beginning Maximite |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
I've been using Geoff's "GPS.BAS" to TRY and get the whole $GPRMC printed on the screen My ultimate aim is to send the $GPRMC string to an indoor micromite via a com port 433Mhz transceiver where the string will be decoded properly I cannot figure out how to get ALL the $GPRMC string to print on the screen (so once it's working I can then finish it so it sends it to a com port I added this line but it's not working Print arg$(0) to arg$(20) Print arg$ doesn't work either Is there a simple way to do it, or do I have to print every argument one at a time rather than print the whole string which is what I would like to do [code] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Demonstration of parsing the NMEA string produced by a GPS module ' Geoff Graham - July 2013 ' ' All GPS modules are guaranteed to produce the GPRMC string ' See http://home.mira.net/~gnb/gps/nmea.html for details of the string ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' max = 20 ' maximum nbr of params DIM arg$(max) ' used to hold the data fields SETPIN 23, DOUT 'GPS Power PIN(23) = 0 'GPS Power OFF OPEN "COM2:9600" AS #1 DO ' loop forever GetGPSData ' get the next line IF arg$(0) = "GPRMC" THEN ' GPRMC contains lat/long IF arg$(2) = "A" THEN ' "A" means locked on to satellites PRINT "Latitude = "; LEFT$(arg$(3), 2); " "; MID$(arg$(3), 3); PRINT " "; arg$(4); PRINT " Longitude = "; LEFT$(arg$(5), 3); " "; MID$(arg$(5), 4); PRINT " "; arg$(6) Print arg$(0) to arg$(20) ELSE PRINT "GPS searching..." ENDIF ENDIF LOOP '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' subroutine to load the GPS data fields into the array arg$() ' returns with the array populated SUB GetGPSData DO DO WHILE INPUT$(1, #1) <> "$" : LOOP ' wait for the start FOR i = 0 TO max arg$(i) = "" ' clear ready for data DO ' loops until a specific exit x$ = INPUT$(1, #1) ' get the character IF x$ = "," THEN EXIT ' new data item, increment i IF x$ = "*" THEN EXIT SUB ' we have all the data so exit arg$(i) = arg$(i) + x$ ' add to the data LOOP ' keep going NEXT i ' increment i LOOP END SUB [/code] |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3169 |
The code that you listed is decoding the data from the GPS. It sounds as if you do not want to do that, you just want to send the data somewhere else where presumably it will be decoded. If this assumption is correct then this is all that you need: OPEN "COM2:9600" AS #1 ' open the GPS input
OPEN "COM1:9600" AS #2 ' open the radio link DO ' continuous loop LINE INPUT #1, A$ ' get a line from the GPS PRINT #2, A$ ' and sent it to the radio LOOP Geoff Geoff Graham - http://geoffg.net |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Thanks Geoff ![]() That's helped a lot, what I would like to do is wait till it gets a valid $GPRMC then send the whole $GPRMC string to #2 'radio link The reason for waiting till it gets a valid $GPRMC is this will be mounted remotely outside and I'll only be sending the $GPRMC string probably once per day. It will save battery power rather than sending "all the data" from the GPS receiver as it will be running on battery power. (using the gps to update the clock on an indoor micromite) Edit: Success It does exactly what I want [code] OPEN "COM2:9600" AS #1 ' open the GPS input 'OPEN "COM1:9600" AS #2 ' open the radio link NOT CONNECTED YET DO ' loop forever GetGPSData ' get the next line IF arg$(0) = "GPRMC" THEN ' GPRMC contains lat/long IF arg$(2) = "A" THEN ' "A" means locked on to satellites PRINT "$"arg$(0)"," arg$(1)"," arg$(2)"," arg$(3)"," arg$(4)"," arg$(5)"," arg$(6)"" ELSE PRINT "GPS searching..." ENDIF ENDIF LOOP[/code] |
||||
lew247![]() Guru ![]() Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
What I'd like to do is print the $GPRMC string continually for a period of 2 minutes every 12 hours. If I set a tick timer as a sub How could I format the code so it prints the data at this time rate? I was thinking something like this - (but it doesn't work) ************I tested it by changing the MOD 43200 to MOD 2************** [code] OPEN "COM2:9600" AS #1 ' open the GPS input 'OPEN "COM1:9600" AS #2 ' open the radio link NOT CONNECTED YET DO ' loop forever GetGPSData ' get the next line IF arg$(0) = "GPRMC" THEN ' GPRMC contains lat/long IF arg$(2) = "A" THEN ' "A" means locked on to satellites PRINT "$"arg$(0)"," arg$(1)"," arg$(2)"," arg$(3)"," arg$(4)"," arg$(5)"," arg$(6)"" ELSE PRINT "GPS searching..." ENDIF ENDIF IF secs MOD 43200 = 0 THEN FOR C = 1 to 120 PRINT "$"arg$(0)"," arg$(1)"," arg$(2)"," arg$(3)"," arg$(4)"," arg$(5)"," arg$(6)"" NEXT C LOOP END 'B1 - 1 second Tick interrupt Sub B1 secs=secs+1 'update seconds timer if secs => 43200 then '12 hrs reached secs = 0 'reset counter endif end sub |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 5950 |
I small addition to Geoff's code OPEN "COM2:9600" AS #1 ' open the GPS input OPEN "COM1:9600" AS #2 ' open the radio link DO ' continuous loop LINE INPUT #1, A$ ' get a line from the GPS PRINT A$ ' for debug IF LEFT$(A$,6) = "$GPRMC" THEN PRINT #2, A$ ' and send the one you want to the radio ENDIF LOOP By using lots of PRINT statements during code development, you can see what's happening. Jim VK7JH MMedit MMBasic Help |
||||
![]() |