MIAC PIC Source code Errors
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
MIAC PIC Source code Errors
Hi Team.
There is a few problems with the supplied FC MIAC USB Slave Source code.I will try to point it out in away tat you can follow what I am trying to say.
(1) Down loading the files from the MIAC resource page the files contain Examples for FC5, FC6 and FC7.There is also a folder LVINT which contains 2 LabVIEW examples and the FC MIAC USB Slave Source code (firmware Folder)
This FC Source code does not compile at all there are a number of errors reported as you can see here.
The mentioned Source File Also downloading the MIAC Slave Firmware hex file from the resource page does not work at all the USB never connects!
(2) From the FC 6 Wiki page MIAC section you can down load the same files with the same name this file This files compile and the MIAC function however there is a section commented out /disabled in the Request_Handler Makro
one issue I have been picking up is that I can transmit a CAN message but the command to change the CAN buffer data (19) never writes the new CAN data to the Buffer .
Here is a screen print from my CAN logger as you will see the Message is sended evry 50mSec with the preloaded data in the TX buffer Now loading sending new buffer data from LabVIEW to the MIAC never updates the Data in the Tx Buffer
sending new data to the MIAC and transmit the message the Data never changes Team please help me to solve this confusion with the source files It seams that the MIAC firmware only excepts a 3 byte string and handle it correctly every thing more than 3 bytes long is handled incorrectly as the 9 byte CAN set buffer Command and string /Array.
There is a few problems with the supplied FC MIAC USB Slave Source code.I will try to point it out in away tat you can follow what I am trying to say.
(1) Down loading the files from the MIAC resource page the files contain Examples for FC5, FC6 and FC7.There is also a folder LVINT which contains 2 LabVIEW examples and the FC MIAC USB Slave Source code (firmware Folder)
This FC Source code does not compile at all there are a number of errors reported as you can see here.
The mentioned Source File Also downloading the MIAC Slave Firmware hex file from the resource page does not work at all the USB never connects!
(2) From the FC 6 Wiki page MIAC section you can down load the same files with the same name this file This files compile and the MIAC function however there is a section commented out /disabled in the Request_Handler Makro
one issue I have been picking up is that I can transmit a CAN message but the command to change the CAN buffer data (19) never writes the new CAN data to the Buffer .
Here is a screen print from my CAN logger as you will see the Message is sended evry 50mSec with the preloaded data in the TX buffer Now loading sending new buffer data from LabVIEW to the MIAC never updates the Data in the Tx Buffer
sending new data to the MIAC and transmit the message the Data never changes Team please help me to solve this confusion with the source files It seams that the MIAC firmware only excepts a 3 byte string and handle it correctly every thing more than 3 bytes long is handled incorrectly as the 9 byte CAN set buffer Command and string /Array.
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Hi Team.
As described above with the problem of setting the CAN Data buffer it also seams to have an issue of reading the CAN receive buffer.
I send the Command to check of incoming messages which works fine ( see LabVIEW print screen) Th ID is returend correctly then I select with a case structure based on the ID what to do ,I then send the Command to et the RX Buffer Data it returns 9 bytes however the data bytes are always empty (0)
Please help with this CAN issues all other things are working PWM,ADC;Relay Switching and LCD
I can clearly and 100% say that there is CAN Communication with the real DATA as I am sending the correct ID and Data for the message from my PeakCAN interface with a CAN.DBC file from the Manufacturer of the machine
CAN Data Send from Peak-.dbc File with data
Capturing the ID and masking out what message was received
Correct number of bytes is returned but no Data
As described above with the problem of setting the CAN Data buffer it also seams to have an issue of reading the CAN receive buffer.
I send the Command to check of incoming messages which works fine ( see LabVIEW print screen) Th ID is returend correctly then I select with a case structure based on the ID what to do ,I then send the Command to et the RX Buffer Data it returns 9 bytes however the data bytes are always empty (0)
Please help with this CAN issues all other things are working PWM,ADC;Relay Switching and LCD
I can clearly and 100% say that there is CAN Communication with the real DATA as I am sending the correct ID and Data for the message from my PeakCAN interface with a CAN.DBC file from the Manufacturer of the machine
CAN Data Send from Peak-.dbc File with data
Capturing the ID and masking out what message was received
Correct number of bytes is returned but no Data

https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: MIAC PIC Source code Errors
Hi,
I've had a quick look at the MIAC Slave program and found that the CAN initialise is missing.
I've added this into the attached, but not had chance yet to test the CAN communications with another device.
Do you want to try the attached?
Regards,
Leigh
I've had a quick look at the MIAC Slave program and found that the CAN initialise is missing.
I've added this into the attached, but not had chance yet to test the CAN communications with another device.
Do you want to try the attached?
Regards,
Leigh
- Attachments
-
- MIAC (PIC) USB Slave Source V7.fcfx
- (62.68 KiB) Downloaded 367 times
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Leigh Thank you however I forgot to mention this I added the initialization already as you will see in my post that I mention I am able to get the RX ID and also I showed a print with the TX ID but in both cases there is a problem with the Buffer data byte 0 -7LeighM wrote:I've had a quick look at the MIAC Slave program and found that the CAN initialise is missing.I've added this into the attached, but not had chance yet to test the CAN communications with another device.

Please also read my comment carefuly regarding the 2 set of Firmware files

https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Hi Leigh .
I tried the modified V7 file ,CAN does not work at all there is no Transmission (Command 20)
just to let you know the only file that works quite well (almost all function work) but with CAN buffer problems and strings longer that 3 bytes
is the old V6 Firmware source in a nutshell ,I have written more about this in the above posts
Have good one
I tried the modified V7 file ,CAN does not work at all there is no Transmission (Command 20)
just to let you know the only file that works quite well (almost all function work) but with CAN buffer problems and strings longer that 3 bytes
is the old V6 Firmware source in a nutshell ,I have written more about this in the above posts
Have good one
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: MIAC PIC Source code Errors
Hi,
The Slave MIAC transmitted CAN messages OK for me.
I've done another modification and receive now also works.
But I am testing with a Flowcode program using the USB Slave component, not LabView.
Maybe there is something different about the way it sends and receives the USB packet info?
Leigh
The Slave MIAC transmitted CAN messages OK for me.
I've done another modification and receive now also works.
But I am testing with a Flowcode program using the USB Slave component, not LabView.
Maybe there is something different about the way it sends and receives the USB packet info?
Leigh
- Attachments
-
- MIAC_USB_Slave_Test_Read_CAN.fcfx
- (11.53 KiB) Downloaded 317 times
-
- MIAC (PIC) USB Slave Source V7.fcfx
- (63.17 KiB) Downloaded 328 times
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
leighLeighM wrote: But I am testing with a Flowcode program using the USB Slave component, not LabView.
Maybe there is something different about the way it sends and receives the USB packet info?
Thank you very much for your efforts however this is exactly the point the MIAC is advertised with labVIEW support however there is issue
with it ,let me try your files and look a bit deeper however at the end of the day together we need to solve the labVIEW issue

https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Leigh.
my friend We are on opposing sides at the moment
I disagree that it is LabVIEW with this comment
In my humble opinion there is some error /logic error in the firmware when the command 21 is issued the firmware returns the ID correctly of the message recieved then the firmware expects the command to get the received message Data(bytes 0 -7) which it does but it looks like it reads the wrong Receive buffer as the data returned is always 0
I can not say what the error is however the error is in the Miac FC firmware
Here the array is received correctly by LabVIEW as pre-loaded in the Firmware
my friend We are on opposing sides at the moment

I disagree that it is LabVIEW with this comment
I commented the CAN buffer read in the FC firmware and load the outgoing string with the length of 9 and numbers from 1-7 and 0x0A in the 8 th byte posision the data should look like this in the array byte 0 the length and then the numbers following in each element which is then send over the USB and received perfectly in LabVIEW see print screens.Maybe there is something different about the way it sends and receives the USB packet info?
In my humble opinion there is some error /logic error in the firmware when the command 21 is issued the firmware returns the ID correctly of the message recieved then the firmware expects the command to get the received message Data(bytes 0 -7) which it does but it looks like it reads the wrong Receive buffer as the data returned is always 0
I can not say what the error is however the error is in the Miac FC firmware
Here the array is received correctly by LabVIEW as pre-loaded in the Firmware
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: MIAC PIC Source code Errors
OK, I've run through more tests but do not get the zero data error that you get.
I've attached the latest CAN component, although I guess you have same,
but might be worth dropping this into your components directory and rebuild the MIAC firmware.
At what repetition rate are your CAN messages being sent to the MIAC?
I've attached the latest CAN component, although I guess you have same,
but might be worth dropping this into your components directory and rebuild the MIAC firmware.
At what repetition rate are your CAN messages being sent to the MIAC?
- Attachments
-
- CAN.fcpx
- (25.64 KiB) Downloaded 321 times
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Leigh
Thank you very much for your confirmation,
I am sending and requesting CAN data from the MIAC every 100mSec
I will dug deeper into this thanks a million for all your efforts much appreciated
Thank you very much for your confirmation,
I am sending and requesting CAN data from the MIAC every 100mSec
I will dug deeper into this thanks a million for all your efforts much appreciated

https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
Hi Leigh.
The new CAN component seams to do the trick,
I can read the CAN Received Data bytes out now ,
I am not sure if the loading of the CAN Data is working as I did not have time yet to test that but will do tomorrow but if I can read the bytes then it should work the other way around too
I appreciate all your efforts very much once again than you
The new CAN component seams to do the trick,
I can read the CAN Received Data bytes out now ,

I am not sure if the loading of the CAN Data is working as I did not have time yet to test that but will do tomorrow but if I can read the bytes then it should work the other way around too
I appreciate all your efforts very much once again than you
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: MIAC PIC Source code Errors
leigh.
found time to test the populating of the TX buffer from LabVIEW to the Miac
it is working also
so now everything is working from LabVIEW on my Miac
Have great time thanks again for all your help and efforts
Sending data to be transmitted from Miac CAN The outgoing CAN message from the MIac with the populated data
found time to test the populating of the TX buffer from LabVIEW to the Miac

so now everything is working from LabVIEW on my Miac




Have great time thanks again for all your help and efforts
Sending data to be transmitted from Miac CAN The outgoing CAN message from the MIac with the populated data
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR