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 : Beta Testers Wanted
Page 13 of 26 | |||||
Author | Message | ||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Not sure how it is done in the Micromite but the Maximite had a variable you could test for I2C completion. It was MM.I2C and the valid values are: [quote]Is set to indicate the result of an I2C operation. 0 = The command completed without error. 1 = Received a NACK response 2 = Command timed out 4 = Received a general call address (when in slave mode) [/quote] |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 722 |
Hallo Bobd, you where right with this hint, 100000 thanks!!! But i must say this is very, very confusing. It is nowhere documented in the micromite documentation (maybe in mmbasic??) and if you follow the "international Standards" for handling/addressing i2c devices, we think it is not a good idea to change them in such a strange way ( just our opinion). This is really "down under", sorry ;-). @Geoff please put this in the documentation of the micromite to avoid hours of lost time for guys like us (2 experienced electro engineers). Is there a reason for handling addressing in i2c in this way? Thank you very much, in the meantime we drank some bottles of PILS beer.... Dietmar&Rüdiger |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 722 |
it seems to me that the Routine fail before it can set the variable. I asked Geoff in my beginning thread Dietmar |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
In this case, the command had invalid parameters and probably was never executed and so it would not have been able to set the MM.I2C variable. |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
I think if you take a look you will see this is the International Standard "The I2C specification from NXP (formerly Philips) actually specifies two different slave addressing schemes. Standard Mode I2C makes use of 7-bit addressing. 10-bit addressing was later added as an extension to standard mode I2C. 7-bit Addressing In 7-bit addressing procedure, the slave address is transferred in the first byte after the Start condition. The first seven bits of the byte comprise the slave address. The eighth bit is the read/write flag where 0 indicates a write and 1 indicates a read." "8-bit Addresses Some vendors incorrectly provide 8-bit addresses which include the read/write bit. Often times, you can determine if this is the case because they will provide one address for writing to the slave device and another to reading from the slave. In this situations. please only use the top seven bits of the address." Regards Jman |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Attached is a document which shows almost exactly what jman said in the previous post. 2014-01-25_222416_I2C_Slave_Addressing.pdf See this link to the standard document issued by NXP in 2012 http://www.nxp.com/documents/user_manual/UM10204.pdf |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
To make life interesting, the data sheets for the I2C devices are rarely clear about which addressing scheme they are talking about. I usually go by : If the address is higher than 7F, they have included the 8th bit so divide by two. Jim VK7JH MMedit  MMBasic Help |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 722 |
Shame over me, you guys are absolutely right! To be honest, we had some Beer before beginning programming;-). Before mmbasic i programmed some routines for this RTC in Bascom and had some strange effects. Tomorrow i will try this out with the addresses divided by 2 (shift right). to all for me Dietmar |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9311 |
Yeah, I have to agree with all the above. Welcome to the wonderful world of I2C on microcontrollers! Not sure how you were interfacing before, being that you are engineers, but perhaps you were using raw machine-code or something, to talk to your I2C stuff, which would require that YOUR code manage the read/write bit. PICAXE does the same thing - you specify the I2C address using 8 bits, but the read/write bit can be either 1 or 0 - PICAXE will ignore it and change it as it needs to. This is a good thing - one less thing to complicate matters in your BASIC code. I agree though, it would be a good idea if this was hammered home more in the MM manual, as unless you already know that MM is managing the read/write bit for you, you can get into a hell of a confusing state, as evidenced by you too chaps. Hope the beer helped. Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3200 |
Thanks fellows. While I was asleep a question was raised and very competently answered by others. To my mind this illustrates why I2C is often regarded as complicated and difficult. I don't know if your pdf is copyright BobD or in the public domain but I propose to add the following to the MMBasic manual (it borrows heavily from your document). Please tell me if it is in error (I am no I2C expert): Geoff Geoff Graham - http://geoffg.net |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Geoff I am no expert either. I practice lots of RTFM. The document that I provided is a composite of information generally available. I have had it for a while so I don't recall the sources except for the NXP standards document that I also referenced. I did check the document over and make minor changes for clarity before I posted it today. If there was any copyright then it would be hard for me to tell you where it was and the info is so generalised that it would be hard to make a claim. FWIW you have my OK to use it in your MMBasic manual. I think the last sentence should be omitted. I have to go out now so I cannot look into it today. I will check the standards doc unless someone else beats me to it (please). |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3200 |
Yes, the last sentence is wrong. On reflection I believe that the last paragraph should read: Anyone else care to comment? Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
Sounds good to me. By the time we add a few more real life example programs, it should be easier to decipher the data sheets of new devices. Jim VK7JH MMedit  MMBasic Help |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Yip looks ok to me Geoff's 10 bit rewrite looks spot on Jman |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9311 |
OK, finally got my MM talking to me - YAY! I get the command prompt, but if I try to enter the editor, strange things happen. This is still all at the 38k4 speed. I seem to remember someone else here talking about the [ bracket thing being an issue too, so here are a couple of photos: and I have to scroll down the terminal screen to get to the bottom, which looks like this: I'm getting the welcome screen though, and if I type a command such as HELP, MM responds with an Unknown Command message, which I would expect. I will keep playing.... Smoke makes things work. When the smoke gets out, it stops! |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
That terminal use the Borland's Turbo Vision text user interface - the best ever. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9311 |
It's a terminal called TERMINAL PLUS by Scott Lightsey, written 2001. Yes, perhaps the best terminal program I have ever used, and I have used lots, but this is my favourite. Can do daily log files too, which is really handy if you need to monitor something that only does odd things in the middle of the night, and only on certain days! Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9311 |
I just set the baudrate of the console to 9600 to test if it was something to do with TPLUS and or the laptop(it's older) being unable to keep up at 38k8 baud. Not really that likely, but I tried it, and get EXACTLY the same result on the screen. Perhaps TPLUS is not 100% VT100 compatible? I will now try TerraTerm - Only used TPLUS, as it was the first laptop I came across at the time. EDIT: Cranked up the throttle to 57k6, then 115k2 - same issue, so not a case of the laptop not being fast enough. Get the startup message and the > prompt just fine even at 115k2. Probably is TPLUS not being VT100 compatible - I don't know if it is or not, you see... ...more tinkering... Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6104 |
What you are seeing are the VT100 escape codes which means that the terminal program is not capable or more likely, it needs configuring. If the laptop is really old and you are using built in serial ports, there might be problems with a lack of FIFO buffers. If you are running Windows 95 or newer, it is not really old. Jim VK7JH MMedit  MMBasic Help |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9311 |
It WAS TPLUS, and yes you are right Jim. TPLUS was running on an old Win98 laptop, in DOS mode. I have downloaded TeraTerm and installed it on this Win8 machine, connected to COM1, set baudrate etc, and it away now happy as Larry. I took the RPM's back to 38k400 for this test, now I will ramp up the RPM to 115k2... Smoke makes things work. When the smoke gets out, it stops! |
||||
Page 13 of 26 |
Print this page |