Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:49 28 Nov 2024 Privacy Policy
Jump to

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 : Using i2c on Micro Mite

Author Message
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 03:01pm 07 Feb 2014
Copy link to clipboard 
Print this post

Here I go banging on about i2c again. I just thought I'd start a thread so members can share how they use I2C.

This is just an example. I took Geoff's i2c RTC example for Maxi/Mini and displayed the time and date to a LCD. Plug in the Keypad and use it to change the date/time settings or drive a menu or with a data expander, manually or automatically switch relays etc. The Chinese RTC shown also has temperature readings available plus a pad for a eeprom.






David M.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 03:38pm 07 Feb 2014
Copy link to clipboard 
Print this post

WOW - we've gone back in time!
Smoke makes things work. When the smoke gets out, it stops!
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 04:27pm 07 Feb 2014
Copy link to clipboard 
Print this post

  graeme said  WOW - we've gone back in time


You weren't supposed to notice the date.

I'll plug the keypad in and programme it to alter the date and time (the alarm functions can also be altered). Next edition.


David M.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 07:17am 08 Feb 2014
Copy link to clipboard 
Print this post

Is that a powered i2c 'hub'?



Microblocks. Build with logic.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:04pm 08 Feb 2014
Copy link to clipboard 
Print this post

  Quote  Is that a powered i2c 'hub'?


Hi TZA, yes. The i2c bus board (4 pin headers) is fed with either 5vdc or 3.3vdc from a small LM317 power supply fed from a 5vdc switch mode plug pack.

I plugged the Keypad in last night, but the base address I had chosen a few years ago couldn't be recognised by the uMite i2c commands as the address range was illegal, so I had to reflash the keypad PIC (F88) with a legal address.

So far, the code lets me interrupt the main programme by polling the keypad in the main programme loop on the way past and also to read two keys (ascii format) and produce a bcd byte as required by the time/date registers of the rtc. I'll post the full code when I get it all running.

David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 06:08pm 08 Feb 2014
Copy link to clipboard 
Print this post

Traps for beginners.

Don't assume all RTC chips have the same register layout. I couldn't understand why the "day of the month" wouldn't change under Keypad control. The chip I'm using has a day of the week in between. It works now.

At the moment the register numbers and BCD register codes are displayed on the terminal. The date and time is on the LCD. I'll change that to fully LCD before I post my results. Also a couple of minor glitches to pretty up.

This set up should be handy for anyone wanting to make a timer solar tracker. The key pad makes it easy to reset daylight saving etc without having to alter the programme. Also to switch things on and off at the controller and to alter timer periods etc.
David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:39pm 08 Feb 2014
Copy link to clipboard 
Print this post

If anyone wants a play.
@Grogster, we are in the right year now. The test set up is essentially a clock running in a loop. The keypad is polled at the top of the loop and drops out to a menu subroutine to alter the registers then back into the loop.




Plus example firmware in zip. If you are using your own i2c modules, addresses and formats may change a bit.
2014-02-09_093854_uMite_rtc_keypad_lcd_test.zip
David M.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024