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 : Demo Mode in Code.
Author | Message | ||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Hi All, Until about a week ago I had 2 MM backpacks configured on breadboard. One was the real Spa controller that's in service, The other much the same; temp sensors connected; other inputs fudges with resistors. Purpose being I could test the code on the 2nd one while the first stayed unchanged. A few lines of code determined which serial numbers were in use. It served it's purpose, but was taking space on the Coffee table. What I want to do is now use a single backpack for test purposes, with only a serial connection. More compact. I don't want 2 separate code files. I should be able to test for the test one by looking for the RTC, which won't exist. But from there, what's the best way to implement a demo mode. It won't need sensor values to change, they can remain static. Sole purpose is to build on my user interface & add additional control. Is the best option to add a 2nd "Main Loop", that can ignore the Sub's that are involved in reading data? Don't want demo test riddled all through to code. Any thoughts on the best approach? Thanks Phil. |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Just back on this un-touched tangent.... Looking at Geoff's code from the Super Clock, [Code]' test if the RTC is present I2C Open 100, 200, PU I2C Write &H68, 0, 1, 0 If MM.I2C <> 0 Then I2C Write &H51, 0, 1, 2 If MM.I2C = 0 Then TimeSource = 1 RTC GetTime .. .. ..[/code] Why the writes to 2 different addresses? Is that to accommodate different RTC's? The write to &H68 sets MM.I2C to 1 on my bare backpack, so is that a sufficient test that it's not present. What is the Write to &H51 doing? Can anyone explain it a bit more? Thanks Phil |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
I think it is addressing the EEPROM on the RTC board. From the doc with my RTC board AT24C32 (storage capacity 32K); IIC bus interface, the maximum transmission speed of 400KHz (working voltage of 5V); Can be cascaded with other IIC device, 24C32 addresses can be shorted A0/A1/A2 to modify default address of 0x57 |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
So Just the first test should suffice? Presume &68H is the address of the DS3231? Have this at the moment, [Code] ' Test if RTC is present I2C Open 100, 200, PU I2C Write &H68, 0, 1, 0 If MM.I2C=0 Then RTC Gettime Else DemoMode=1[/code] But have only tested it without an RTC present. Is it expected to return MM.I2C=0 on the in service unit that has the RTC connected. (Just cant test ATM... Water is heating etc...). Phil. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
Two different makes of RTC gives two different addresses. The PCF8563 uses &H51 Jim VK7JH MMedit MMBasic Help |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Thanks Jim, Just Re-read the SC article & had a read on Geoff's site. Your post is the first mention I've heard of the PCF8563. Phil |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
I think the 8563 was the first RTC we played with and has been retained for compatibility. It is mentioned in the micromite manual under Special Device support/ Real Time Clock... VK7JH MMedit MMBasic Help |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
GDay Phil, I know you are really looking for software ideas but if you wish to experiment with my Serial BackPack I am happy to send you a board.. This was primarily designed for the cheap OLED I2C based 0.96" modules but I have support for SPI and the small 1.44" TFT colour modules that can be had for around $6AU.. and the intention is to recieve commands from a serial/i2c/SPI port - details in manual--. The board is yours if interested.. Have a read of the manual and if it suits you let me know via PM or my email address in the manual listed above.. I also have all parts except the modules themselves. Kind Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Thanks Mick, Will take you up on the offer; but only if you'll accept a "Donation". Would require all components, minus the headers and display. Be in touch. Phil. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Hi Phil, Sorry I missed this post, just saw it now. OK a `donation' of $10 will get you the PIC and all R's and C's and VReg. PM me your address and I will send it all off to you. NOTE! You will need a PicKit3 to flash the Pic'170 as I have no way of flashing it until it is soldered to the board. Kind Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Done. Incidentally, do you have a personal preference between Type 1 & Type 2 displays for whatever reason? I know they are both accommodated. Only orientation of the board changing..... Phil. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Hi PHIL, No preference to me... The type 1&2 are both i2c displays and are typically monochrome.... The small colour TFT modules are typically SPI and usually the pin out I have matches the modules.. The serial backpack also supports the Nokia display modules but. Be careful as there are two pin outs for them and my board only supports one type.. Like all of my boards I try to squeeze in as many options as possible but I couldn't get the other Nokia format on that small a board.. Regards Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Print this page |