Logic - Development Thread

Discuss the SplashBase & get support

Logic - Development Thread

Postby Carl-SolderSplash » Sat Nov 16, 2013 1:55 pm

Thread that shows the status of "Logic" mode of the SplashBase. This mode allows choosing a sequence of actions to perform when a condition is true.

* BETA - In Development - Contains bugs *
PC App & SplashBase Firmware - Download - 26/11/2013

For logic mode to function it must be enabled from the main control window.

Overview
An Event is a collection of Conditions and Actions, all conditions must be satisfied before the any Actions are executed. Each event is limited to 2 conditions from the list of 24 and 24 actions.

Logic mode has 10 general purpose 32bit registers, actions can modify them and conditions can use them. These can be used to delay actions or count occurrences of a condition for example.

Using Logic Mode
To add or modify an Event first select the event number in the Event list

Next move to the condition list, select a condition number once selected then configure the condition below the condition list. When you are happy with the condition click update. This send the condition to the SplashBase. To apply this condition to the event tick the box next to the condition in the list.

Now move to the action list, again select an action number and configure the action below the list. Once complete click "Update ACtion" and tick the action to apply to indicate you would like this to occur if the event's conditions are true.

Finally click update event and the event's condition number's and actions numbers are sent to the splashbase.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Carl-SolderSplash » Sat Nov 16, 2013 2:07 pm

Conditions
Analog input (ADC) above threshold
Analog input (ADC) below threshold
GPIO Raising Edge - used to capture an input going high
GPIO Falling Edge - used to capture an input going low
GPIO High -
GPIO Low -
Date after -
Date before -
Date between (On Hold)
Time after -
Time before -
Time between (On Hold)
Ethernet transitioned from Disconnected to Connected -
Ethernet transitioned from Connected to Disconnected -
On Boot -
Register equal
Register above -
Register below
Every 10ms Tick -

Actions
Set GPIO -
Increment Register -
Decrement Register -
Clear Reg -
Set Reg -
Control a relay -
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Carl-SolderSplash » Sun Nov 24, 2013 11:57 pm

-- Bug/Issue List --

- Need to add a clear function to remove all logic commands
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Carl-SolderSplash » Mon Nov 25, 2013 12:07 am

Example requirement :

Relay 1 to be on and Relay 2 to be off if the ADC channel 1 is lessthan 512 (1.5v)
Relay 2 to be on and Relay 1 to be off if the ADC channel 1 is more than 512 (1.5v)

This would require 2 Events, 2 Conditions and 2 Actions.

To implement this follow these steps :

  • Click event 0
  • Select Condition 0, choose "ADC below", select channel 1 and enter a value of 512
  • Click update condition
  • Check Condition 0 on the Condition list
  • Select Action 0 on the Action list, choose "Control Relay"
  • Tick Relays Affected 1 and 2
  • Check Relay State 1
  • Click Update Action
  • Check action 0 on the Action list
  • Click the "Update Event" button
  • Repeat the steps above for a new event number, selecting ADC above and Checking Relay state 2 ( leaving 1,3 & 4 unticked )
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Dave » Tue Nov 26, 2013 12:07 pm

I'm having no luck with this at all Carl.

I have followed all the instructions above and tried a few of my own but I can't get any to work. I will explain what I am doing so you can see where I'm going wrong.

In this example I am trying to turn on relay 1 when GPIO port H is set high turning LED's on.

I select Event 0 then move to the Condition 1 list.
Here I select condition 0 , from the list, select GPIO HIGH, then PORT H, mask 0xFFFF, press the Update Condition button and check the box next to condition 0.
I then move to the Actions where in action 0 I select Control Relay from the drop down menu and check Affected Relay 1 and Relay State 1.
I now press Update Action and check the box next to action 1.
I finish by pressing the Update Event button.

Now when I go to the GPIO Control and configure Port H with Direction 0xFFFF and Port/Pins 0xFFFF my LED's light up but the relay does not turn on.

Where am I going wrong?

I can turn all the relays on using the Relay and RGB control so no problem there.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Logic - Development Thread

Postby Carl-SolderSplash » Tue Nov 26, 2013 1:09 pm

When you say "when PORT H is set high" I assume you have a button or your using a link? and that you want to operate an LED + the relay when an input on PORT H changes.

First you will need to configure the GPIO direction using the GPIO Control form.

Select Port H set the direction bit for the input you have chosen. for example if I am using Input 0 on the Port the direction would be 0xFFFE making the rest outputs.

If you want this to happen on boot do the same in the init direction.

Also to make the change permanent and applied on boot use the "Save Config" button on the main page. The same for any settings or logic config.

The GPIO expanders have internal pull ups so will idle high, if your using a button, pull it low might be a better idea.

When creating the Condition limit the mask to the input you want to check, again if it's input 0 then use a Mask of 0x0001 on a falling edge condition ( if you connect your switch to ground ).

See if that helps. If not take a screen cap of your logic form and the GPIO form and I shall work on it tonight.

I have just noticed a PC App bug, a last minute change is stopping it displaying the condition/action parameters correctly at the bottom when selected. shall fix tonight - Now Fixed
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Dave » Tue Nov 26, 2013 2:55 pm

In my example I have 5 LED's connected to 0 to 4 pins on Port H and was using the mask 0x0015 so the LED's were on-off-on-off-on. I have no button in this set up I was just using the GPIO Control.

I have work soon so I just tried a quick experiment by setting a relay to turn on after a Time After condition and still nothing happens.
Last edited by Dave on Tue Nov 26, 2013 2:58 pm, edited 1 time in total.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Logic - Development Thread

Postby Carl-SolderSplash » Tue Nov 26, 2013 2:56 pm

Assume you have flashed the SplashBase with Version 0.11 above?
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: Logic - Development Thread

Postby Dave » Tue Nov 26, 2013 3:01 pm

Ah! I never noticed the new firmware.

Think I just have time to do this before work.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Re: Logic - Development Thread

Postby Dave » Tue Nov 26, 2013 3:13 pm

It now works fine.

Thanks again Carl you're a star.
Dave
 
Posts: 58
Joined: Fri Mar 29, 2013 12:48 am

Next

Return to SplashBase LM3S6x

Who is online

Users browsing this forum: No registered users and 1 guest

cron