MIAC Advanced

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

Moderators: Benj, Mods

Post Reply
popemadmitch
Posts: 3
Joined: Wed May 11, 2016 12:28 pm
Contact:

MIAC Advanced

Post by popemadmitch »

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
Contact:

Re: MIAC Advanced

Post by JohnCrow »

Hi

All the MIAC info is here

http://www.matrixtsl.com/miac.php
1 in 10 people understand binary, the other one doesn't !

popemadmitch
Posts: 3
Joined: Wed May 11, 2016 12:28 pm
Contact:

Re: MIAC Advanced

Post by popemadmitch »

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: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: MIAC Advanced

Post by LeighM »

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
Contact:

Re: MIAC Advanced

Post by popemadmitch »

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.

Post Reply