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
Searchlight Controller Over CAN-BUS
Moderator: Benj
Searchlight Controller Over CAN-BUS
- 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.
- QMESAR
- 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
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
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
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- 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
Thank you for adding the flowcharts
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- 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
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.
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.

- Attachments
-
- Software Model .fcfx
- (41.81 KiB) Downloaded 215 times
Re: Searchlight Controller Over CAN-BUS
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
cheers
Simon

cheers
Simon