RTC for MIAC(Part two)

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Ok Enamul,

I have connected the 0v on the MIAC to the neg rail on my slave breadboard but still nothing ?

Does the cable need to be shielded twisted pair or does it not matter for 12 inches or so ?

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for MIAC(Part two)

Post by Enamul »

Does the cable need to be shielded twisted pair or does it not matter for 12 inches or so ?
Not an issue for short distance and your house environment. I think issue is related to code.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for MIAC(Part two)

Post by Enamul »

Hi Stuart,

Can you please try this code and let me know?
Attachments
RTC_MIAC.fcf
Please use what Stuart posted..this misses start of LCD
(22.98 KiB) Downloaded 343 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Hi Enamul,

I have programmed the new code but I get a blank screen, I then reprogrammed with keyboard test prog and was fine, then reprogrammed with new code again and I still get blank screen even connected to the can bus etc.

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Hi Enamul,

I have looked at the code and the "Display Start" was missing so I put it in and reprogrammed and Voila !

All working now with Date & Time

Thanks
Acestu
RTC_MIAC_Final.fcf
(23.12 KiB) Downloaded 389 times
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Hi Enamul,

All I need to know now really is can this RTC slave unit be incorporated into the bootloader of the MIAC ie part of the system so that it always keeps time, or does your code that is in the MIAC now have to be incorporated into whatever program you write for the MIAC ?

Hope that makes sense !

Thank you for all your help Enamul as always
Acestu

P.S. It is interesting that when the "Display Start" was left out of the code, Flowcode still simulated the display.....
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for MIAC(Part two)

Post by Enamul »

Hi Stuart,
It great to know that you have sorted it. I don't have MIAC in hand but I keep that in first priority. That's why I can't test the code before posting..I noticed the mistake of missing start LCD macro in earlier post but I have been working from uni and home machine and I thought it was corrected one. Anyway, you caught the issue; that's even better.
All I need to know now really is can this RTC slave unit be incorporated into the bootloader of the MIAC ie part of the system so that it always keeps time,
First of all RTC slave unit needs physical hardware like slave module with RTC module and I don't think it's possible. But you can keep time easily with the existing set-up if you have coin cell battery connected to RTC module..if slave or MIAC power goes off still RTC module can keep time.
or does your code that is in the MIAC now have to be incorporated into whatever program you write for the MIAC ?
Yes, I think if you want to have the feature of RTC you have to add the code we have used for MIAC in all program. But the good thing is that CAN bus is so fast you can do whatever you want in between RTC data read.
P.S. It is interesting that when the "Display Start" was left out of the code, Flowcode still simulated the display.....
Yes, that's something really need to be improved in FC simulation. If simulation would show what hardware shows; things will be much easier..
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Thanks Enamul,

Now that everything is done and working I will put all the ingredients into a folder and upload it soon for anyone that is interested in this post.....

Thanks again
Acestu :D
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for MIAC(Part two)

Post by Enamul »

Hi stuart,
One more thing you can add with the code is...adding a feature of setting time from MIAC. That should work as MIAC has a Keypad interfaced with it already and so you don't need to suffer for any connection :)
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: RTC for MIAC(Part two)

Post by acestu »

Hi Enamul,

Yes that would be great to add that time set feature to the program that you put into the MIAC, that is going to be my next project, so don't run off lol...

Anyway I am including an archive file with all the info for this thread now, so anybody interested can have a go ....

Thanks
Acestu :wink:
MIAC_RTC.rar
(169.92 KiB) Downloaded 365 times
P.S. you can download Winrar to expand the archive file.
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

DylanBalloo
Flowcode V4 User
Posts: 73
Joined: Mon Sep 24, 2012 4:31 pm
Been thanked: 1 time
Contact:

Re: RTC for MIAC(Part two)

Post by DylanBalloo »

Hello Enamul,
Regarding the Keypad test program I have a few queries?
Firstly, in the main program, regarding the second loop that you place, why did you put TEST LOOP AT THE END?AND WHY KEYVAL IS 255 NOT 0
Secondly in the keyDecode macro, can we use the variable keyval instead of the keyDecode.keyval? and in the loop that you add at the bottom why did you put <>255?

Thank you.....

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: RTC for MIAC(Part two)

Post by Enamul »

Firstly, in the main program, regarding the second loop that you place, why did you put TEST LOOP AT THE END?AND WHY KEYVAL IS 255 NOT 0
Keypad is read first then it is checked..if you check at start you have to put read outside the loop and inside loop. but we can avoid one more macro by checking at the end..default return is 255 if nothing pressed. so we will be in the loop until no button pressed.
Secondly in the keyDecode macro, can we use the variable keyval instead of the keyDecode.keyval? and in the loop that you add at the bottom why did you put <>255?
keyval is local variable in the keyDecode macro..so have to use either keyDecode.keyval or .keyval format...but if you declare global variable keyval; you will be able to use simply keyval in all macro.
Last loop with condition keyDecode.keyval<>255 is waiting till you release the button..as if you released the button cause the keyDecode.keyval = 255 so the loop will wait till it become 255 i.e. button release which will in other way provides switch debounce or one one key return for one press.
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply