Something funny going on...

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Something funny going on...

Post by Chris_MIRA »

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
Attachments
HiUCV Loadbank.fcfx
(24.43 KiB) Downloaded 316 times

johnsondav
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...

Post by johnsondav »

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.
ADC_Pot 10-Bit Width
ADC_Pot 10-Bit Width
ADC_Pot.jpg (70.75 KiB) Viewed 4738 times

Just a thought.

Regards

Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: Something funny going on...

Post by Chris_MIRA »

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

User avatar
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...

Post by Benj »

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.

User avatar
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...

Post by celebriums »

Hi Chris Mira,
Can you look Rev 1.0. :D
Attachments
HiUCV Loadbank Rev 1.0.fcfx
(25.38 KiB) Downloaded 290 times
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

Post Reply