MIAC Advanced

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

Moderators: Benj, Mods

popemadmitch
Posts: 3
Joined: Wed May 11, 2016 12:28 pm
Been thanked: 1 time
Contact:

MIAC Advanced

Postby popemadmitch » Mon May 23, 2016 5:37 pm

Is there any published source code for the MIAC Advanced Expansion ?
or at the very least some detailed documentation on the CAN bus messages it accepts and ALL their options ?

I have managed to piece together basic communication between it and the MIAC base unit in C, but there appears to be a bunch of bugs in the UART handling code, or some aspect of it that is just undocumented. plenty of places in the CAL and online documentation that just refer to 'Flags' and never define what any of them are.

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

Re: MIAC Advanced

Postby JohnCrow » Mon May 23, 2016 6:49 pm

Hi

All the MIAC info is here

http://www.matrixtsl.com/miac.php
These users thanked the author JohnCrow for the post:
LeighM (Tue May 24, 2016 8:52 am)
Rating: 5.26%
 
1 in 10 people understand binary, the other one doesn't !

popemadmitch
Posts: 3
Joined: Wed May 11, 2016 12:28 pm
Been thanked: 1 time
Contact:

Re: MIAC Advanced

Postby popemadmitch » Mon May 23, 2016 10:28 pm

JohnCrow wrote:Hi
All the MIAC info is here
http://www.matrixtsl.com/miac.php


Yes, that's the documentation i am complaining about.

The total sum of documentation for the UART Init command for example

Code: Select all

416 Init (txsta, spbrg, data size, config flags, rts terminal, cts terminal)

What do those config flags do? why is there no rxsta if your going to expose raw registers, with only one theres a bunch of stuff i cant set or change properly.

Also, code 420 'Receive String', that one is definitely broken, it can only receive upto 6 characters then silently swallows the rest, I even tried building the same simple routine in flowcode and it did the same thing.

Maybe one of the init flags addresses these issues, but its not documented.

User avatar
LeighM
Matrix Staff
Posts: 1911
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 460 times
Been thanked: 646 times
Contact:

Re: MIAC Advanced

Postby LeighM » Tue May 24, 2016 8:52 am

Here are the parameter details for the UART initialise command:

1) UBRG high byte. Where UBRG value = (750000/baud)-1
2) UBRG low byte.
3) Character bit width (value of 8 or 9)
4) Config Flags:
Bit 0: Flow control (0 = Disabled)
Bit 1: Echo control (0 = Off)
Bit 2: Set this to 1 (needs further investigation)
Bit 3: 0 for 8 bit return, 1 for 16 bit return value
5) RTS Terminal number
6) CTS Terminal number

popemadmitch
Posts: 3
Joined: Wed May 11, 2016 12:28 pm
Been thanked: 1 time
Contact:

Re: MIAC Advanced

Postby popemadmitch » Wed May 25, 2016 11:37 am

Ah ha, that matches up much better with what i could see flowcode trying to do with it, and explains the options, thanks.

The option to set 16bit responses also fixes the other issue i was having, as it makes UART_ReceiveChar return 0x200 for no data, instead of 0xFF.

thanks

btw, if anyone else is looking to program their MIAC from Linux (as XC8 and MPLABX work fine there) search for and download a tool called 'fsusb' you just need to tweak the sourcecode to change the vendorID and productID it is looking for, and it works a treat.
These users thanked the author popemadmitch for the post:
LeighM (Thu May 26, 2016 8:20 am)
Rating: 5.26%