Searchlight Controller Over CAN-BUS

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

Moderator: Benj

Post Reply
SimonKee
Posts: 2
Joined: Fri Jul 10, 2020 6:54 pm

Searchlight Controller Over CAN-BUS

Post by SimonKee »

HI Guys i am new flowcode and CAN-BUS i have a project at the moment a searchlight controller which i have now tried to apply CAN-Bus to and i am having some trouble with and i a hope someone can help me with.
1st the controller
the controller has 6 buttons and 3 leds and a two axis joystick the joystick has a 5v supply and the output centre x and y is 2.5vdc then moving progressively increases or decreases left down to 0v and right up to 5v i have split the CAN-BUS accordingly
ID 8 is horizontal control output motor direction and send to home switch
ID 16 is horizontal control output motor direction and send to home switch
ID 32 is left lamp on off and focus /right lamp on off and focus#

the Nodes are as as follows
Node 1
controls left and right and left lamp and right lamp on and off and the home microswitch
response back from this node would be home switch is active and the lamp is on and the address is ID 24
Node 2
controls UP and Down and left lamp and right lamp focus on and off and the home microswitch
response back from this node would be home switch is active and is on ID 40

i have the project working at the moment but there are some delays in the operation of some of the components but i dont know why?
when i use the CAN King monitoring hardware the output from the controller is instantaneous but the is a delay on the response for instance.
NODE 1
the left and right is very responsive and works fine but when i switch the lamps on there is a 2 second delay some times and 1 second at others

NODE 2
the UP and DOWN is not as responsive but works ok but when i press the momentary focus buttons on there is a 1 or 2 second delay then it wont turn off for a second or two.
when the home switch is pressed this works on an interupt which works ok.

as i said i am new to CAN-BUS and flowcode so i would be great full for any help anyone can give me.
thanks Simon

hi i have added the code now thankyou
Attachments
CAN_Example_Twinlite Receiver Version 6 TOPHEAD Motors Prototype.fcfx
(39.87 KiB) Downloaded 209 times
CAN_Example_Twinlite Receiver Version 21 Motors Prototype.fcfx
(43.16 KiB) Downloaded 194 times
CAN_Example_04_Send Twinlite controller Prototype rev20.fcfx
(65.26 KiB) Downloaded 198 times
Last edited by SimonKee on Tue Jul 14, 2020 10:00 am, edited 1 time in total.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: Searchlight Controller Over CAN-BUS

Post by QMESAR »

Hi,
Welcome to the Forum hope you will enjoy your time with us,
In General any delays in Code does slow things down and is not a recomened way ,Normally programmers set flags to indicate certain Actions has been done for example set a flag when a button is pressed and the Code reacts to the Flag ,this remoave delay operations,However I would advise you to post your Flowchart for People to view and help you with out it we can only assume certain things when we see the Flowchart we can help directly

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: Searchlight Controller Over CAN-BUS

Post by QMESAR »

Thank you for adding the flowcharts

User avatar
celebriums
Posts: 125
Joined: Sun Sep 25, 2016 3:50 pm
Has thanked: 71 times
Been thanked: 33 times
Contact:

Re: Searchlight Controller Over CAN-BUS

Post by celebriums »

Dear Simon

Welcome to the Flowcode family.

I share a model software method for you.
Task method. In short; Do the job and come back.

You have to keep your software simple. This will increase the efficiency of the processor.

Errors;
-Interrupt must be at the beginning of the program.
-It is not right to put a delay in the main loop.

That is, software; first you have to check and mark them with flags.

If you share it after you've fixed your program, I can still help. :wink:
Attachments
Software Model .fcfx
(41.81 KiB) Downloaded 215 times
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

SimonKee
Posts: 2
Joined: Fri Jul 10, 2020 6:54 pm

Re: Searchlight Controller Over CAN-BUS

Post by SimonKee »

Thank you for your reply i will try it today , i have seen any literature on the switch before they aren't covered in the flow-code videos from Matrix from what i remember ,i was going to go on a flow-code course from matrix, but i bought the software and CAN bus e blocks 2 the week before lock down :o
cheers
Simon

Post Reply