Page 2 of 3
Re: MIAC-RC LawnMower
Posted: Fri Jun 02, 2017 2:07 pm
by Monie Jacobsen
Is anyone here knowing what to do in the codes above, to see 0 to 255 in the display?
Re: MIAC-RC LawnMower
Posted: Fri Jun 02, 2017 2:27 pm
by LeighM
Hi,
I would help to see some more values, between the two extremes, as the values look to be the wrong way round (min and max)
As there are a few possibilities, such as the shorter pulses being missed, the pulse being inverted.. etc.,
It is difficult to suggest further without having hardware to test, which you have, so we rely upon your tests and observations
Re: MIAC-RC LawnMower
Posted: Fri Jun 02, 2017 4:02 pm
by Monie Jacobsen
LeighM
I can get more values.
By changing the numbers between the two limits, 800 (3523) and 2200 (1517) "
But not from that 800 = 0 and 2200 = 255 bit
Re: MIAC-RC LawnMower
Posted: Fri Jun 02, 2017 4:10 pm
by LeighM
Yes, "changing the numbers between the two limits, 800 (3523) and 2200 (1517)" is what I mean.
So that we can see if the numbers from MIAC go up or down or jump value suddenly at some point.
Example: 1100(?) 1400(?) 1700(?) 2000(?)
Re: MIAC-RC LawnMower
Posted: Fri Jun 02, 2017 4:20 pm
by Monie Jacobsen
Hi LeighM
No I can not get more!
Re: MIAC-RC LawnMower
Posted: Tue Jun 06, 2017 7:38 am
by Monie Jacobsen
Hi LeighM
You can see below at numbers from MIAC go up or down or jump value suddenly at some point.
Example: 1100(?) 1400(?) 1700(?) 2000(?)
From Servo Tester
1100
MAP = 0
TSUM = 741
1400
MAP = 239
TSUM = 2111
1700
MAP = 255
TSUM = 3399
2000
MAP = 0
TSUM = 642
2200
MAP = 131
TSUM = 1517
Hope you can use the above measured data?
And see where it goes wrong..
Re: MIAC-RC LawnMower
Posted: Tue Jun 06, 2017 8:45 am
by LeighM
Hi Monie,
That definitely looks like a roll over issue, are you sure you are testing with MIACdsPIC-LawnMower-006.fcfx, not 005?
Re: MIAC-RC LawnMower
Posted: Tue Jun 06, 2017 10:13 am
by Monie Jacobsen
Hi LeighM
I am testing with MIC dsPIC-LawnMower-006.fcfx
Re: MIAC-RC LawnMower
Posted: Tue Jun 06, 2017 11:38 am
by LeighM
Hi Monie,
Please try this new version (007)
edit: If my calculations are correct, that should give you a tsum range of 7000 to 19250
I which case the parameters of Map should be ...

- map.jpg (7.93 KiB) Viewed 17946 times
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 6:00 am
by Monie Jacobsen
Hi LeighM
From file MAC dsPIC-LawnMower-007.cfx
There I get tsum range of 7045 to 19358
Output from Map valus range of 87 to 255
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 8:35 am
by LeighM
Looking better then
Did you try using 7045 and 19358 as parameters to Map?
I've not checked the maths in Map, but it looked OK on a quick glance.
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 10:44 am
by Monie Jacobsen
Hi LeighM
It looks better then

I have tried using 7045 and 19358 as parameters to Map - and it works fine.
Ouput MAP Value from 0 to 255 works very well.
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 11:07 am
by LeighM
Cool
Thanks for letting me know.
And make sure we get some photos of the Lawnmower in action

Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 11:14 am
by Monie Jacobsen
Hi LeighM
The codes seem very fine now.
Thank you very much for your help and your great diligence.
Proposals:
Since there are many who work with RC servor "Recevier system" for many purposes. I would like to make a suggestion.
Making a component so your work can benefit many people.
Was it a go idea?
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 11:16 am
by Monie Jacobsen
LeighM wrote:Cool
Thanks for letting me know.
And make sure we get some photos of the Lawnmower in action

I'll send some pictures...
Re: MIAC-RC LawnMower
Posted: Wed Jun 07, 2017 8:13 pm
by jgu1
Hi LeighM!
Today I discover some new in your program (FC7).
I see in your program the macro MAP it is possible to add some variable. Never seen before. Are these only for use with local varabel. I can not see you have used these in any calculation other place in the program, what happen, I can¨t figure out

. I try to look in help, but don¨t understand. Will you please (when you get time) explain how to use and feature/benefit by these.( I dare, maybe create a very simple program/example wich is very easy to understand)
Thanks in advance
Jorgen
Re: MIAC-RC LawnMower
Posted: Sun Jun 11, 2017 9:00 pm
by jgu1
Hi Monie!
Concerning these variable in a Macro, maybe, are you able to explain the above, please.
Br Jorgen
Re: MIAC-RC LawnMower
Posted: Sun Jun 11, 2017 9:35 pm
by kersing
Local variabels can not be accessed from any other part of the program, they are private to the macro where they're declared. The advantage of local variables is that they do not permanently require memory.
Take a program with two macros, a and b. If the main routine call macro a and once a is finished calls b, the local variables of the macros can occupy the same memory locations, saving ram. If the main program calls a and a calls b the memory locations need to be different to make sure the values of a are not overwritten by b. To check which macros are 'exclusive' the compiler analysis the code while generating the compiled program.
Re: MIAC-RC LawnMower
Posted: Mon Jun 12, 2017 6:04 am
by jgu1
Hi Kersing!
Thank's for your explanation. Make sense.
Br Jorgen
Re: MIAC-RC LawnMower
Posted: Mon Jun 12, 2017 11:28 am
by Monie Jacobsen
Hi LeighM
2xPWM With MI509-dsPIC
Have worked all weekend to get 2 outputs with PWM but it is not successful.
Please see the attached test program: MIACdsPIC-2xPWM
Do you have a suggestion for setting up the 2 x PWM
Do you have a table or guide on how to set PWM to the 4 OuputON A, B, C and D?
I need an overview of possible PWM channel for MI509-dsPIC.
Can not see any description of the above only MIAC PIC (Old)
Do not hope there were too many questions

Re: MIAC-RC LawnMower
Posted: Mon Jun 12, 2017 1:23 pm
by LeighM
Hi Monie,
You are very close, you just need to turn on the output drivers.
See Motor1 and Motor2 (Port F0 and F1) in the Chip View ...

- MotorEnable.jpg (7.14 KiB) Viewed 17734 times
The solid state drivers are explained in the MIAC (V3) datasheet ...
http://www.flowcode.co.uk/old_site/resources/file ... C-60-3.pdf
Hope that helps
Leigh
Re: MIAC-RC LawnMower
Posted: Mon Jun 12, 2017 2:24 pm
by Monie Jacobsen
Hi LeighM
Thank you very much.
I must have overlooked this problem

.
Sorry for the inequality.
GO'Arbejdsdag
Re: MIAC-RC LawnMower
Posted: Mon Jun 12, 2017 4:39 pm
by Monie Jacobsen
Hi Leigh
So now there are 2 x PWM out on both motors running.
Thank you very much Leigh.
Your answer to jgu1 with MAP, I would like to learn about Setup and options for MAP.
Is it something you could or have time to describe the possibilities with the MAP device?
Many thanks in advance
Re: MIAC-RC LawnMower
Posted: Tue Jun 13, 2017 11:07 am
by LeighM
Hi Monie,
Sorry, I don't understand your question.
kersing explained about local and macro parameter variables.
The Map macro in your program came from your Ardunio example code I think.
It converts one range of values into another range of values, much like reading values from a straight line graph (with offset origin and fixed slope)
Hope that helps.
Re: MIAC-RC LawnMower
Posted: Tue Jun 13, 2017 3:45 pm
by Monie Jacobsen
Hi LeighM,
Many thanks for your description.
I would like to learn the use as well as possible.