Hi,
In the attached programme; there are two modes, manual and Auto. In manual, the nano reads in a pot value and sends out a PWM signal with duty cycle set to the pot value. This works fine and I get a fully controlled PWM output.
In Auto, the nano receives a CAN message, checks the right id, and takes a byte value from DO of the CAN message. The PWM duty cycle is then set to the value of DO. The nano then repeats back over CAN the value it thinks its set the PWM to. all values are decimal byte (ie 0 to 255).
The problem is that, in Auto, the PWM does not set to the CAN value until the CAN value is greater than about 200, the PWM then rises as the CAN value rises to a MAX of about 4 volts at a CAN value of 255. Im sure this is a scaling or number format issue but can not find where..... Please help!
Regards,
Chris
Something funny going on...
Moderator: Benj
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
-
- Posts: 188
- Joined: Thu Jun 28, 2012 7:29 pm
- Location: Durham
- Has thanked: 86 times
- Been thanked: 186 times
- Contact:
Re: Something funny going on...
Hi Chris
I am obviously not sure what your program is doing but, I would suggest you check that the assigned macro/variable you are using to read the 'POT' is 10-Bit wide (this is what is showing up in the properties window). This would produce a value greater than 0-255.
Just a thought.
Regards
I am obviously not sure what your program is doing but, I would suggest you check that the assigned macro/variable you are using to read the 'POT' is 10-Bit wide (this is what is showing up in the properties window). This would produce a value greater than 0-255.
Just a thought.
Regards
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
Re: Something funny going on...
Hi,
Thanks for your idea, it isn't the reading of the POT that appears to be the problem, the pot is read in manual mode and this works fine, the problem seems to be that the PWM doesn't set to the value read from CAN in auto mode.
Regards,
Chris
Thanks for your idea, it isn't the reading of the POT that appears to be the problem, the pot is read in manual mode and this works fine, the problem seems to be that the PWM doesn't set to the value read from CAN in auto mode.
Regards,
Chris
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Something funny going on...
Hi Chris,
I instantly thought it might be timer related. However I see you are using timer 1 in your program and timer 0 for the PWM.
As a sanity check maybe try switching to timer 2 in your program and see if that makes any difference.
I instantly thought it might be timer related. However I see you are using timer 1 in your program and timer 0 for the PWM.
As a sanity check maybe try switching to timer 2 in your program and see if that makes any difference.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- celebriums
- Posts: 125
- Joined: Sun Sep 25, 2016 3:50 pm
- Has thanked: 71 times
- Been thanked: 33 times
- Contact:
Re: Something funny going on...
Hi Chris Mira,
Can you look Rev 1.0.
Can you look Rev 1.0.
- Attachments
-
- HiUCV Loadbank Rev 1.0.fcfx
- (25.38 KiB) Downloaded 290 times