Wednesday, June 30, 2010

June 28 Blink All + Chase

The following application should use the touch sensor to switch between: 
  • blinking 3 leds and 
  • chase of 3 leds.
The touch sensor is used to alternate between blinking all leds and chase = turning an LED on then off and next LED on and soforth.
Blinking 3 LEDs is just "blinky" application using a flip-flop to alternate between on and off.

Unit testing: when button (touch sensor) is
  • not pressed = blink 3 LEDs when button (touch sensor) is not pressed
  • pressed       =  longer delay

Unit testing:  when button (touch sensor) is
  • not pressed = longer delay
  • pressed       = chase 3 LEDs
Chase uses 3 delays of 1500, 1000, and 500 and 3 E_RSs which send 100, 010, 001 (1=on) respectively.









But combining the two has problem because
  • only 1 boolean input is allowed
  • using E_RS only sends it EO output event if there is a state change between R and S. (So can not send cascade E_RS events to change how the events are changed=
In a sequential implementation a LED would be repeated, but would not map 1-to-1 to the HW.

Solution is to create a FB type which has same number of  boolean input/outputs the same as presented in FBDK tutorial in Vyatkin's book. He used a composite FB and 4 LEDs. With LEGO Mindstorms (LMS) with touch sensor as a button, there are only 3 sensor connections left for LEDs. Current FORTE version used with LMS does not support composite FBs.

Testing Lesson:
Connecting a LED with a duplicate output can be used to see if an application sends a specific output event.

Wednesday, June 9, 2010

June 9 Straight Line Follower

Simple line follower application "works" on a straight line and stops when off the line.
At moment the USB and JTAG are connected for download, so  doesn't  go far.

After changing to shorter names and repeating common, but less describtive names
and unmapping the delay and shutdown FBs at the end - It downloads!!!


Tuesday, June 8, 2010

June 8 Hit some boundary + voltage problems

Not sure what limit but...

When I try to add a 2nd motor so I can really have a line follower - it gets:
"Create Dataconnection failed"   once trying other smaller FBs instead of motor it got ""Create Eventconnection failed"

Have changed optimization from -O0 to -O3.

In the gdb (when still used -o3) it kept hanging by ~E_CTU. I got around that by making tests in ST code rather than ECC connections for start state.

Have told it could be stack size and what  said fits the symptoms.
This causes a limit on symbols allowed.
So currently changing FB to reuse var/event names and shorting names whereever I can.  (zB. SAMPLE is now REQ)
Also need to make to make basic motor FB better, but hit the limit when using smaller FBs (when tested my theory - that the application is hitting some limit) so more than changing basic motor FB is needed.

voltage problems 
Lego gets too low voltage off and on, sometimes the JTAG turns off. Tried different battery. first. This message appeared at Easter time. Then the connector between Lego and JTAG had a loose connection. Connector has been checked and is fine. Waited a while with the battery in the Lego and evidently the voltage when up to close to normal, but lower then usual (3.2 vs. 3.5+).


Monday, June 7, 2010

June 7 Duplicating an Application handish

You can see the copied application, but must have missed other connections,
because the old and new application are still connected some how.
Problems with map and unmap
and even after deleting the new application download has problems.
(of course made a backup copy beforehand)

To duplicate an application:
1. Create new application
2. Note the new application#
3. Replace the old application into the new application's xml file
4. Change the application # to the new application #


When 4DIAC opens the new application it adds an _0 to all FB instance names in the new application.

June 7 Using a boolean Hysteresis FB

The tutorials are for control theory so FB_GT_UINT  replaced with a Hysteresis FB.
The following calculates the boundary between black and white 
and then
turns LED on if over black and off if over white. 

The  greater than FB is still shown, but is unmapped to the device.

With 1 Motor

With 2 Motors - too large / too little memory 
error recieved: data connection error
So optimizing code  (distclean then setup_lms to change gcc options to -o3)



June 7 FORTE make all Notes

Didn't find a Blog entry on basics for FORTE compiling so will add here:
when to use make distclean and the order when starting/ restarting.

FORTE work-arounds:
Delete String.h and cpp when:
When get compile error because type is unknown 
or 
when downloading FORTE unsupported type.
Then in FORTE code delete src/stringlist.h and cpp
and make all again.

Cause: Exact pattern not yet know, but occurs when FB types are added and others deleted.
But not always.