MIAC-RC LawnMower
Moderator: Benj
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
MIAC-RC LawnMower
User Type Device: MAC (Arduino) MI5466
Used for motor control for LawnMower.
The code below works: But try convert to MIAC (Arduino) MI5466 but do not work.
See below: Is there anyone here that can see where things are going wrong.
Hope someone here will help solve the problem.
Used for motor control for LawnMower.
The code below works: But try convert to MIAC (Arduino) MI5466 but do not work.
See below: Is there anyone here that can see where things are going wrong.
Hope someone here will help solve the problem.
Best Regard
Monie
Monie
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: MIAC-RC LawnMower
would love to see that when it's finished
Steve
Steve
Success always occurs in private and failure in full view.
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Can PulsTiming work in MAC (Arduino) MI5466 Like MEGA 2560 ?
And what should be changed in the coder so that PulsTiming can work with MAC ?
And what should be changed in the coder so that PulsTiming can work with MAC ?
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Hi Monie,
In the "while sw = 1" loops you need to change the InputANALOG() into InputDIGITAL()
Or change the compare value to your own threshold, e.g. while sw > 128
The value will depend on what range of voltage you have into the MIAC inputs.
In the "while sw = 1" loops you need to change the InputANALOG() into InputDIGITAL()
Or change the compare value to your own threshold, e.g. while sw > 128
The value will depend on what range of voltage you have into the MIAC inputs.
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Thank you very much LeighM.
Have worked a lot about the problem;)
Please see attached File:
Voltage range I have input MIAC inputs.
0.878 Vdc to 1.003 Vdc
Have worked a lot about the problem;)
Please see attached File:
Voltage range I have input MIAC inputs.
0.878 Vdc to 1.003 Vdc
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Hi Monie,
If your MIAC input high voltage is between 0.878 Vdc to 1.003 Vdc then it will not be high enough to trigger a logic high.
Have a look at the conversion chart on page 18 of the MIAC datasheet.
In this case you will need to use the InputANALOG() which will return a value of about 20 for an input of 1 Volt.
So if your input voltage is 0v for off and about 1v for on, then I suggest you test for values above and below a threshold of about 10...
If your MIAC input high voltage is between 0.878 Vdc to 1.003 Vdc then it will not be high enough to trigger a logic high.
Have a look at the conversion chart on page 18 of the MIAC datasheet.
In this case you will need to use the InputANALOG() which will return a value of about 20 for an input of 1 Volt.
So if your input voltage is 0v for off and about 1v for on, then I suggest you test for values above and below a threshold of about 10...
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM,
Have tried your suggestion but enter resultal, only "0" is displayed.
So right now I do not know what to do!
What do you say to convert ouput up?
Can this be used or is something I can not
Else how much should I convert?
Have tried your suggestion but enter resultal, only "0" is displayed.
So right now I do not know what to do!
What do you say to convert ouput up?
Can this be used or is something I can not
Else how much should I convert?
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
What is the circuit that supplies voltage into the MIAC input?
The MIAC has an input resistance of 10K
The MIAC has an input resistance of 10K
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Is it the device below which supplies voltage to MIAC input?
Remote control system
Receiver type FS-R9B manual for FS-R9B
https://www.aliexpress.com/store/produc ... 55869.html
Is it the device below which supplies voltage to MIAC input?
Remote control system
Receiver type FS-R9B manual for FS-R9B
https://www.aliexpress.com/store/produc ... 55869.html
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Ah, I see, I missed the fact that you are using an RC servo system.
You would need to use MIAC Inputs 1 and 2 as direct digital inputs with InputDIGITAL(),
only these two inputs connect directly to digital inputs on the processor.
The InputANALOG() will be too slow.
The next problem is that the RC receiver channel outputs will not be a high enough voltage,
so you will need to level shift from the RC logic level to the MIAC level,
something like this should do it ...
https://www.onsemi.com/pub/Collateral/MC14504B-D.PDF
You would need to use MIAC Inputs 1 and 2 as direct digital inputs with InputDIGITAL(),
only these two inputs connect directly to digital inputs on the processor.
The InputANALOG() will be too slow.
The next problem is that the RC receiver channel outputs will not be a high enough voltage,
so you will need to level shift from the RC logic level to the MIAC level,
something like this should do it ...
https://www.onsemi.com/pub/Collateral/MC14504B-D.PDF
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Thank you very much for your help.
I want to work on my project
Thank you very much for your help.
I want to work on my project
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Trying to use dsPIC .Type MI5809
But now the interrupt not will work!
See attached code: Do you have a suggestion?
Trying to use dsPIC .Type MI5809
But now the interrupt not will work!
See attached code: Do you have a suggestion?
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Hi,
I have made some changes in CH2 macro, you still had a test for sw < 20 for the digital return.
Hope that helps.
Leigh
I have made some changes in CH2 macro, you still had a test for sw < 20 for the digital return.
Hope that helps.
Leigh
- Attachments
-
- MIACdsPIC-LawnMower.fcfx
- (19.13 KiB) Downloaded 208 times
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Received notification when trying to upload at Interrupt error
See compiler messages below!
Received notification when trying to upload at Interrupt error
See compiler messages below!
Code: Select all
Target folder: C:\Users\Bruger\Desktop\MIACTI~1
Source name: C:\Users\Bruger\Desktop\MIAC til FLOWCODE FORUM\MIACdsPIC-LawnMower.fcfx
Title:
Description:
Device: PIC16.33E.MIAC (dsPIC)
Generated by: Flowcode v7.2.1.4
Date: Tuesday, May 23, 2017 10:01:10
Users: 1
Registered to: monie jacobsen
Licence key: YUWNEC
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic16\batchfiles\pic16_C30_comp.bat "MIACdsPIC-LawnMower" "C:\Users\Bruger\Desktop\MIACTI~1\" "33EP256MU806"
Launching compiler...
C:\Users\Bruger\Desktop\MIACTI~1>xc16-gcc -c -mcpu="33EP256MU806" -omf=coff -funsigned-char -fno-short-double -Os -I"C:\PROGRA~2\FLOWCO~1\COMPIL~1\pic16\BATCHF~1\..\support\h" -I"C:\PROGRA~2\FLOWCO~1\COMPIL~1\pic16\BATCHF~1\" -std=gnu99 "MIACdsPIC-LawnMower".c -o "MIACdsPIC-LawnMower".o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
MIACdsPIC-LawnMower.c: In function 'FCM_CH2':
MIACdsPIC-LawnMower.c:1392:2: error: 'TCNT0' undeclared (first use in this function)
MIACdsPIC-LawnMower.c:1392:2: note: each undeclared identifier is reported only once for each function it appears in
Error returned from [xc16-gcc.exe]
Completed compilation, return = 1
C:\Program Files (x86)\Flowcode 7\compilers\pic16\batchfiles\pic16_C30_comp.bat reported error code 1
FINISHED
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Hi,
You can remove your Reset timer C icon, it should be TMR1 and this is reset in the Interrupt Enable ...
And the last one after the Interrupt Disable should be ...
You can remove your Reset timer C icon, it should be TMR1 and this is reset in the Interrupt Enable ...
Code: Select all
// TCNT0 = 0;
Code: Select all
FCV_TSUM = TMR1;
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi Leigh
Thank you for your great help.
Now I can upload code to dsPIC.
I try to convert Receiver type FS-R9B output signal up.
Thank you for your great help.
Now I can upload code to dsPIC.
I try to convert Receiver type FS-R9B output signal up.
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
I have now got the RC logic level to the MIAC.
The converted RC outputs 4V to 12V according to the oscilloscope. But in dsPIC. Type MI5809 does not show the correct ouput for display that should be 0- 255 bit
User RC-Servo Test: Result shown in display from dsPIC .Type MI5809.
See ouput below: By from RC servo is 800 til 2200 Pulse
Has attached the FlowCodes below:
Servo: Output display:
800 - 255 bit
935 - 0 bit
1147 - 30 bit
1351 - 194 bit
1827 - 255 bit
1930 - 0 bit
But want Output for display from 0 to 255 bit
Can you see the codes where it goes wrong:
I would be very happy for your help
I have now got the RC logic level to the MIAC.
The converted RC outputs 4V to 12V according to the oscilloscope. But in dsPIC. Type MI5809 does not show the correct ouput for display that should be 0- 255 bit
User RC-Servo Test: Result shown in display from dsPIC .Type MI5809.
See ouput below: By from RC servo is 800 til 2200 Pulse
Has attached the FlowCodes below:
Servo: Output display:
800 - 255 bit
935 - 0 bit
1147 - 30 bit
1351 - 194 bit
1827 - 255 bit
1930 - 0 bit
But want Output for display from 0 to 255 bit
Can you see the codes where it goes wrong:
I would be very happy for your help
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Perhaps you could display the tsum value before (and after) the Map, also use an (additional) different variable for the output of Map.
Then you will be able to see the raw timer values that the MIAC uses, and then adjust the min and max parameter values of Map to match the MIAC ones.
Then you will be able to see the raw timer values that the MIAC uses, and then adjust the min and max parameter values of Map to match the MIAC ones.
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Have tried but no luck
Please see the following update file: Is that what you mean?
I'm not sure what you mean!
Have tried but no luck
Please see the following update file: Is that what you mean?
I'm not sure what you mean!
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Result from practice driving with RC servo tests
Ouput from RC servo is 800
Displayed in display:
MAP value = 255
TSUM value = 3523
Ouput from RC servo is 2200
Displayed in display MAP value = 130
TSUM value = 1517
Servo: Output display should be:
800 - 0 bit
2200 - 255 bit
What should be done to show this result?
Result from practice driving with RC servo tests
Ouput from RC servo is 800
Displayed in display:
MAP value = 255
TSUM value = 3523
Ouput from RC servo is 2200
Displayed in display MAP value = 130
TSUM value = 1517
Servo: Output display should be:
800 - 0 bit
2200 - 255 bit
What should be done to show this result?
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Thank you for your suggestion but it did not change the result on the output display.
OK with overflow on a variable.
Ouput speech has not changed.
MAP value is still as from last post
TSUM value is still as from last post
Thank you for your suggestion but it did not change the result on the output display.
OK with overflow on a variable.
Ouput speech has not changed.
MAP value is still as from last post
TSUM value is still as from last post
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC-RC LawnMower
Can you get some more values (of tsum and the servo) between the two limits, 800 (3523) and 2200 (1517)
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: MIAC-RC LawnMower
Hi LeighM
Servo: Output display:
800 - 255 bit
935 - 0 bit
1147 - 30 bit
1351 - 194 bit
1827 - 255 bit
1930 - 0 bit
I can not get some more values (of tsum and the servo) between the two limits, 800 (3523) and 2200 (1517)
Servo: Output display:
800 - 255 bit
935 - 0 bit
1147 - 30 bit
1351 - 194 bit
1827 - 255 bit
1930 - 0 bit
I can not get some more values (of tsum and the servo) between the two limits, 800 (3523) and 2200 (1517)
Last edited by Monie Jacobsen on Fri Jun 02, 2017 4:33 pm, edited 2 times in total.
Best Regard
Monie
Monie