MIAC as cental heating programmer

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

Moderators: Benj, Mods

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: MIAC as cental heating programmer

Post by medelec35 »

echase wrote:
1) What is format of years? Years in bytes since 1990?
Format will be the last two digits of the year
so 2012 = 12 retrieved.

echase wrote: 2) Mousing over the MIAC LCD window (without clicking) under simulation can cause the LCD numbers to change. Why?
Not sure sure, some one different ot me..i.e clever would be able to answer that one.
echase wrote: 3) Please can you explain the purpose of the full stop and MOD (looks like “do this till counted up to this number”) in the following syntax from Ben’s underfloor programme?
Full stop is automatically generated if your using local variables.
Local variables save precious memory since space taking variables are destroyed one the macro is exited.
With MOD as soon as the variable reaches the MOD number a 0 is returned.
so you will get
0
1
2
0
1
2
0
etc
echase wrote: 4) If I want this expression to be true
IF C<A or B
if byte C is less than byte A or byte B do I use OR or || ?

Recommended format is:
(C < A) || (C < B)
echase wrote: 5) When complied I get 37 errors like
MIAC_v1.0.c(516): Illegal redefinition of symbol: CAN_CHIPSEL
MIAC_v1.0.c(544): Illegal redefinition of symbol: TXB1DB7_VAL

Looks like some CAN function is not initializing even though I did use the CAN Init function but none of the CAN send/TX/Rx ones.
How the expansion modules work is the CAN side is totally transparent.
There is no need to initialize the can component at all!
When you initialize the expansion module the CAN part is then automatically initialized for you.

Hope this helps

Martin
Martin

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

medelec35 wrote:
echase wrote:
echase wrote: 3) Please can you explain the purpose of the full stop ............ in the following syntax from Ben’s underfloor programme?
Full stop is automatically generated if your using local variables.
Local variables save precious memory since space taking variables are destroyed one the macro is exited.
echase wrote: 5) When complied I get 37 errors like
MIAC_v1.0.c(516): Illegal redefinition of symbol: CAN_CHIPSEL
MIAC_v1.0.c(544): Illegal redefinition of symbol: TXB1DB7_VAL

Looks like some CAN function is not initializing even though I did use the CAN Init function but none of the CAN send/TX/Rx ones.
How the expansion modules work is the CAN side is totally transparent.
There is no need to initialize the can component at all!
When you initialize the expansion module the CAN part is then automatically initialized for you.

Hope this helps

Martin
Many thanks, but still don’t understand these:-

The phrases I quoted with the full stop are in Flowcode calculation boxes. So must have been Ben and not some automatic function that entered them. Can’t find what “minute”, “return” and “hide” refer to. Where are local variables defined?

Why am I getting those error messages? It won’t compile at all because of them.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: MIAC as cental heating programmer

Post by medelec35 »

echase wrote: Why am I getting those error messages? It won’t compile at all because of them.
Hi echase,
We may be talking at cross purposes here?

I thought errors your talking about are there becuse you have created your own flowchart in advance of getting a MIAC advanced expansion module.

But after downloading MIAC_Underfloor_v1.1.fcf, I see that does not compile with FC5

If that's the issue, to enable it to compile just right click CAN component on control panel and select Custom code.
Select top row (Defines) then click Edit Code. In the New window click Revert to Default. Select OK when it asks about reverting to Default.

Then It should compile OK for you.
If that is not what your referring (I could have misread posts) to could you post the flowchart that has all the errors, then we can have a look for you.

Martin
Martin

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

medelec35 wrote: If that's the issue, to enable it to compile just right click CAN component on control panel and select Custom code.
Select top row (Defines) then click Edit Code. In the New window click Revert to Default. Select OK when it asks about reverting to Default.
The standard underfloor programme gives one error that your fix cures but if I change to MIAC System instead of just MIAC I get 37 errors. Doing the Revert to Defaults cuts it to 34 errors. If I then add the Advanced module and Revert to Defaults on this too it stays at 34.

In my code which is variant of this I also get 34 errors after your fix. What to do?

I have not yet got the hardware to run this on as am waiting for the Advanced module to be available..

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: MIAC as cental heating programmer

Post by medelec35 »

Hi echase,
If your setting FC up for advanced expansion module and that's the only thing you want CAN for, then you need to remove the CAN component.
CAN communications is set up for you automatically, seamlessly in the background when Miac_Advancec(0) component is added to control panel.

If you would like to post your flowchart (or PM if you want to keep it private) then I can help you further.

Martin
Martin

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

medelec35 wrote: If your setting FC up for advanced expansion module and that's the only thing you want CAN for, then you need to remove the CAN component.
You are right, all the half dozen references to CAN interface need to be deleted and the component. No idea what adverse impact it will have on the running of Ben’s software. The 34 errors have all gone away.

If you are reading this Ben why did you need to call the CAN interface as not aware of you using it in the application. Were you intending to link more than one MIAC?
Elsewhere you said “I decided to simply use thermistors for each zone for now rather then create a CAN network of sensor nodes” so looks to me that you included code for testing and communicating to a CAN network but never used it. Hopefully I can simply delete these bits.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC as cental heating programmer

Post by Benj »

Hello,

Yes sorry my original intention was to use CAN nodes with temp sensors around my house. I built the CAN boards but then got lazy and decided to simply use temperature sensors directly into the MIAC instead. Bit of a mistake if you ask me but you live and learn and really I had to get the floors back down in my house before my partner kicked off :)

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

Very disappointed at the pricing structure for the add on modules I am afraid. There is no way my project can afford to pay 90% of a MIAC cost to add the Advanced Expansion Module, whose only purpose in my case would be for the real time clock. So I am going to have to think of a different way to do this. Maybe a £5 PCB with RTC chip and battery. Then assuming one of the original PIC I2C or SPI ports is available on the MIAC I/O, albeit as normal I/O, alter the MIAC component in Flowcode to turn it back into an I2C or SPI port.

Another way I can think of doing it is to have some sort of slow parallel interface on the external PCB that can be read by the MIAC I/O but the minimum number of pins for this is about 8.

Alternatively battery back the MIAC and use Ben’s software RTC, but it’s a big battery to power the whole MIAC for a few hours when the actual PIC is all that needs backing up. Nevertheless a 12V 4Hhr lead acid is 1/10 of the cost of a Advanced Expansion Module and it maybe can be charged from the normal MIAC mains power supply using a suitable 14volt regulator.

The MIAC spec sheet is a bit confusing as it has 2 lines for power supply. One says 12 - 16V, <2A and the other 12/16V at 100mA. I assume that nearly 2A is total current if transistors are delivering their max but 100mA is the rating of the supplied main power unit, so this unit can not actually deliver the full current needed by the transistors, which therefore need a separate power source. What is the actual running current of the MIAC assuming no output current is delivered and no relay coils are energised? I would have thought less than 50mA.
Last edited by echase on Fri Jul 27, 2012 2:50 pm, edited 2 times in total.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: MIAC as cental heating programmer

Post by JohnCrow »

Hi Echase

The MIAC itself does not have I2C so that rules out using something like the DS1307 RTC chip as a direct connection.
I2C is also available on the serial expansion, but that is a comparable cost to the advanced expansion.

The DS1307 works with the MIAC serial expansion on the I2C

Could you build something along the lines of a PIC and a CAN chip to give you basic I2C capability then you could use this to control a DS1307 RTC device.I assume you could then connect this to the MIAC can port.

For my 10 pence worth, the expansison modules may be expensive if you only need to use one function of them, but overall considering their versatility, they are good value, and very flexable.
1 in 10 people understand binary, the other one doesn't !

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: MIAC as cental heating programmer

Post by Enamul »

Hi Echase,
I am using exactly same idea as John said for multi-controller CAN bus network project. The price of expansion modules also become higher than my budget for that.
I am using one chip(may be built-in CAN controller(18f4580/18f4680) - MCP2551 (seems cheaper in market) or without CAN chip (16f877a) - MCP2515 & MCP2551) and interface RTC using standard I2C protocol. And the PIC-CAN bus you can easily interface to MIAC CAN bus and the CAN bus operates in so high speed that the MIAC will see that RTC module is almost connected with it.
If you need code for the RTC and CAN controller chip end and MIAC end, please let me know...as I am currently working on that.
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

Enamul wrote:If you need code for the RTC and CAN controller chip end and MIAC end, please let me know...as I am currently working on that.
Enamul
Thanks, that code could be very useful as I know nothing about CAN. Where does your code actually sit? Is it within the MIAC or programmed into these exterior chips? Sounds like there is a market for a little CAN module that does just the RTC function. Some cheapish ones that provide RTC as well as other functions are available via Google but I would not know how to programme them.

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: MIAC as cental heating programmer

Post by Enamul »

Hi,
I didn't mean that. MCP 2515 is a CAN controller and MCP 2551 is a Can transceiver. You need that for Can bus communication with MIAC. RTC and Can controll program will be in one micro controller where the RTC module will be connected. In MIAC, there will be a code running to receive time and date data through Can bus. So you can buy one pic chip like 16f877a, one Rtc module (from ebay with backup battery ), one Mcp 2515, 20Mhz xtal, Mcp 2551. I'll post you diagram for that.
Hope the idea is clear now. :)
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

A diagram would be useful.

A DS1305 RTC has an SPI interface as does the MCP 2515 CAN controller. So could one miss out the PIC and send the data straight through the SPI and CAN interfaces via the MCP 2551 Can transceiver with no code needed? Or do you need the PIC and code to tell the MCP 2515 what to do?

In my simple mind this is like translation from English (the RTC data) to French (SPI) to German (Can) and back through French (the MIAC’s Can to PIC interface) to English (the clock’s data in MIAC’s PIC). So one is not doing anything drastic at each interface other than changing the protocol (language) so the message passes on without changing its meaning.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: MIAC as cental heating programmer

Post by JohnCrow »

Hi
You still need a PIC

The devices are both classed as slave and need to communicate with the master (Microcontroller)

There are some tutorials on here about I2C

http://www.matrixmultimedia.com/mmforum ... ial#p25891
1 in 10 people understand binary, the other one doesn't !

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: MIAC as cental heating programmer

Post by Enamul »

Hi,
The main issue not to read RTC data rather the communication between pic to pic using CAN protocol. I've to study CAN controller ic data sheet carefully to say it's not possible but it's certain that you can't do that right now using Flowcode. About RTC, you can use Ds1307 and JOHN has a nice post on that. I'm sending it from mobile. Hopefully I can post diagram tomorrow when I'll be at home.
Enamul
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: MIAC as cental heating programmer

Post by Enamul »

Hi,
I am posting here a circuit using PIC 18f4580 which has built-in CAN controller..so you just need to buy RTC module, MCP 2551 and PIC 18f4580..

Here is a link for MCP 2551..
http://www.ebay.co.uk/itm/260963866494? ... 522wt_1139
and for RTC module...
http://www.futurlec.com/Mini_DS1307.shtml
and for PIC 18f4580...
http://uk.rs-online.com/web/p/microcontrollers/6230853/

Hope this will help. :)
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

Re: MIAC as cental heating programmer

Post by echase »

Thank you for all the ideas but I think this all too difficult for me even if a smaller PIC is used. Unless someone comes up with a cheap ready build RTC PCB with all the CAN/I2C software I will have to use Plan B, which is to just battery back the MIAC and use Ben’s software RTC.

I can build into Ben’s code a menu input for clock calibration to speed it up if too slow and BST adjustments.

Post Reply