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 : Anyone want to help test my I2c code
Page 2 of 2 | |||||
Author | Message | ||||
ksdesigns Senior Member Joined: 25/06/2011 Location: United StatesPosts: 143 |
Don I was hoping to get some feedback to see if it works well for other people first and it is done the correct way modular so its easy to add. just need to add some comments to the code and i will send it to Geoff ken |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
no worries, thanks Ken, I thought it may have been a silly statement mentioning it to you, but felt I better just in case. Just hope users give you feed back fairly quickly. Cheers Don... https://www.dontronics.com |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ken, grrrrrr, cant find a 26 way header to make a I2C cable. Off to the shops to get a couple and then fix my code to run with your firmware. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ken, I've just changed my program that I've been using to test my I2C basic code to use your i2cwrite command and its running fine. I'll have a go later with the DS1631 code and see how that goes. Thanks for all your work. Geoff, would it be possible to release the 2.4a source so that Ken could recompile. I'm really missing my edit command. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ken, one thing I dont really understand, and I've never used an I2C memory device. When you send an address to the memory to select a memory location, is it a 16 bit or and 8 bit address. How does your code handle different devices of different capacities? Tomorrow I'll attack the DS1631 code and get it running under your firmware. If it is as easy as the PCF8574 code earlier today it will be a breeze. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ken, I put a great long post here about how I couldn't get the DS1631 to work, moved to my other PC to look at the signals with the CRO and it seems to be working now. stay posted. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ken, I've just got my 2 DS1631 thermometers running. So far, as far as I can see your code is running very nicely. 10: CLS 20: REM *** T1 is first thermometer, T2 is second thermometer *** 30: I2CINIT(100) 40: I2CWRITE(&h90,&hac,&h06): REM *** T1, set cont conv, 2 bit fract temp *** 50: I2CWRITE(&h90,&h51): REM *** T1 start temp conv *** 60: I2CWRITE(&h92,&hac,&h06): REM *** T2, set cont conv, 2 bit fract temp *** 70: I2CWRITE(&h92,&h51): REM *** T2 start temp conv *** 80: PAUSE 1000 90: i2cbuf(0)=0:i2cbuf(1)=0: REM *** clear used bytes of i2c buffer *** 100: I2CREAD(&h90,&haa,2): REM *** T1, read 2 bytes of temperature *** 110: PRINT i2cbuf(0)+i2cbuf(1)/256;" degrees "; 120: i2cbuf(0)=0:i2cbuf(1)=0: REM *** clear used bytes of i2c buffer *** 130: I2CREAD(&h92,&haa,2): REM *** T2, read 2 bytes of temperature *** 140: PRINT i2cbuf(0)+i2cbuf(1)/256;" degrees" 150: PAUSE 1000 160: GOTO 90 Many thanks for your work. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
Page 2 of 2 |
Print this page |