Lighting for Halloween

nhphantom

New Member
I have a board from EFX-TEK. My concern is the serout command. Below is the paragraph for it FC 4 Command protocol: The FC-4 serial connection conforms to the Parallax AppMod bi-directional communications protocol, which operates at TTL (0 to 5 VDC) using "open-true baud mode to enable daisy-chaining devices. All exchanges are initiated by the host controller. The format of host communications to the FC-4 is as follows; "IFC4", address, command ( , data )
Were 'IFC4" is the preamble that allows the FC_4 to exist on the same communications line as other devices (e.g., AP-8, DC-16, etc) My concern is where it states "open true" baud modem, the serout command is PinC.1, OT2400,(xxxxx) My concern is with the OT2400 work with a Picaxe or what should I use?

My next question has to do with the Picaxe 40x2. In the basic command manual under the run command it states:

#slot 0
if pinC.1 = 1 then
run 1
endif
if pinC.2 = 1 then
run 2
endif

What I would like to know is there a way to use something similar using 1 button on pinC.1 to step thru each if statement and then use a second button on pinC.2 to select any given one. Hope this makes sense.
Thank you
David Warren
 

lbenson

Senior Member
If you search for "menu" with "search titles only" selected, you will find many threads. This one by westaust55 may not address your particular needs, but it's sure to have good ideas and good code: scrolling menu.

The answer to your question "is there a way?" is "yes". (But there is no need to have multiple "runs" (and on the 40X2, no option to).) You may need to more specifically spell out what you need.
 
Last edited:

AllyCat

Senior Member
Hi,

Personally, I've never heard of the "AppMod protocol", nor the term "Open-True", and it appears even the Parallax Forum can't say much about it: :(

Here's the skinny on our "AppMod protocol"
1. Bi-directional serial I/O on a single conductor
·· -- this means all entities transmit in "open" mode; we use Open-True an put a pull-up on the serial line
2. Master header begins with "!" (bang), and usually has a 3-byte id
·· -- my GPS project, for example, will use the header "!GPS"
The rest is up to you.· If you follow these very simple guidelines then anything you build will happily coexist with Parallax AppMods.

Using Open-True mode causes the entities to only pull the line low; it is never driven, and when a device is done with SEROUT it leaves the pin in an output state. .....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax


So it appears to employ "Open Collector" (or now, MOSFET Open Drain) outputs, connected as "Wired OR" with a Pullup resistor, similar to the I2C bus and other applications. Note that even the term "Wired Or" can be misunderstood because it is "Active Low" (True), i.e. either the Master OR the Slave(s) can pull the wire (bus) Low. Strictly, no device should (be able to) pull the bus wire High, but this may not matter with a single-Master device which doesn't expect a Reply. But that condition can be met anyway, by connecting a diode (cathode) in series with the PICaxe pin, or of course an open-collector/drain transistor.

The protocol is presumably standard "RS232" timing at 2400 baud, which presumably is "Idle High" for the wired-OR to work, which implies "T" polarity. The program commands' syntax looks almost identical to PICaxe Basic, but with the lack of a proper specification, it's probably something you will just have to do by Trial and Error.

On your second question, the PICaxe RUN command has a "special" purpose and is not normally required: The program starts running automatically after a new Program Download, after a Reset, or when power is (re-) applied to the PICaxe circuit. To wait for a button to be pressed, you can simply use a DO : LOOP UNTIL pinC.2 = 1 (or 0 if an active-low switch) or use an Interrupt if there are other tasks whilst waiting for the press. Further delays may be needed to resist contact bounce, etc..

Cheers, Alan.
 

Jeff Haas

Senior Member
Hi David,

While the EFX-Tek board uses Parallax Basic, and the commands are similar to PicAxe Basic, there are some differences. You should get both sets of docs - download the Parallax Basic Stamp Editor so you can get their manual.

This link has the docs for the FC-4 (I think you've got these, but this is just in case):

Going through your questions...
1. The first example you show is similar to this line:
Code:
SEROUT Sio, OT2400, ("!FC4", %00, "G")  'Get Status
It's written for the Basic Stamp 1, which has a limit of 2400 baud. "Sio" is a definition for the pin sending the signal to the FC-4. In the parenthesis are commands to address the FC-4 at address 00 (instead of one of the other boards that could be on that serial bus at a different address), and then ask it for its status. ("G" = Get Status)

The PicAxe can communicate at 2400 baud or higher speeds if needed, but 2400 baud should be fine. The PicAxe version of the command (assuming you're using pin 2) would be:

Code:
SEROUT 2, T2400, ("!FC4", %00, "G")  'Get Status
See PicAxe manual 2, page 217 for details on the SEROUT command.

Once you get that command working, you can use variations of it for the other FC-4 commands.

2. Your second question is about menus and there are lots of choices, covered above.

3. It would be helpful if you described in more detail what you're trying to do. Obviously it's Halloween lighting, and using the FC-4 means you're controlling light brightness. Can you describe what the scene is? Are there actors involved or just automated props? What does the audience see? Etc.

Jeff
 

nhphantom

New Member
Hi David,

While the EFX-Tek board uses Parallax Basic, and the commands are similar to PicAxe Basic, there are some differences. You should get both sets of docs - download the Parallax Basic Stamp Editor so you can get their manual.

This link has the docs for the FC-4 (I think you've got these, but this is just in case):

Going through your questions...
1. The first example you show is similar to this line:
Code:
SEROUT Sio, OT2400, ("!FC4", %00, "G")  'Get Status
It's written for the Basic Stamp 1, which has a limit of 2400 baud. "Sio" is a definition for the pin sending the signal to the FC-4. In the parenthesis are commands to address the FC-4 at address 00 (instead of one of the other boards that could be on that serial bus at a different address), and then ask it for its status. ("G" = Get Status)

The PicAxe can communicate at 2400 baud or higher speeds if needed, but 2400 baud should be fine. The PicAxe version of the command (assuming you're using pin 2) would be:

Code:
SEROUT 2, T2400, ("!FC4", %00, "G")  'Get Status
See PicAxe manual 2, page 217 for details on the SEROUT command.

Once you get that command working, you can use variations of it for the other FC-4 commands.

2. Your second question is about menus and there are lots of choices, covered above.

3. It would be helpful if you described in more detail what you're trying to do. Obviously it's Halloween lighting, and using the FC-4 means you're controlling light brightness. Can you describe what the scene is? Are there actors involved or just automated props? What does the audience see? Etc.

Jeff
Thank you for the reply i do have the FC4 doc. and i believe I still have the Basic stamp at home now I think I have a better understanding of the bauds
David
 
Last edited:

nhphantom

New Member
So here is basically what I am hoping to do. Using the 40X2 chip, I would like to have 3 different programs containing different sequences for the light controller and have a menu so I may choose which sequence to run. This is why I chose the 40X2 chip as it is my understanding that it has 4 programing slots. My hope is to use #slot 0 to choose either #slot 1, #slot 2 or #slot 3 with each of the slots containing a different sequence. In a book that I have, it uses 3 buttons to step through and select. One button is up, one is down and the third is select/enter.
symbol up = pinB.1
symbol down = pinB.2
symbol btns = pinC.3
symbol slct = B0

main:
;which buttons up-down-select are being pressed
if down = 1 then
Slct =Slct + 1
if Slct > 2 then
Slct = 0
end if
if up = 1 then
Slct = Slct - 1
if Slct > 2 then
Slct = 2
end if
if btnS = 1 then
on Slct call Zone1, Zone2, Zone3 ;when teh select button is pressed then go to one of these
end if

The above code is a exerpt is from a book written by Ken Anderson.
This where I got my idea from but I don't know how to make it go to the different slots on the 40X2. This thing is just a walk thru with no actors. I just wish to vary the lighting from time to time so its not always the same if someone repeats a walk thru. This is just a home haunt situation not a proffesional haunt. I hope this explanation helps.


Thank you
David Warren
 

AllyCat

Senior Member
Hi David,
.. I would like to have 3 different programs containing different sequences for the light controller and have a menu so I may choose which sequence to run.
Are you sure it's the Program that you want to change, or is it just DATA ? Don't forget that each Program can be set (or modified) only by a new Download (e.g. from a PC), which also applies to the (separate) TABLE memory in each slot. But AFAIK the Whole 40X2 Chip has access to only 256 bytes of (slot-shared) "program-writable" EEPROM (and of course the volatile RAM and Scratchpad). I would have thought that it might be useful to have an ability to "Edit" at least the relative brightnesses or time delays of a sequence "on site"?

Particularly as you're sending the brightness control signals via a "Bus", a (much) smaller PICaxe might be sufficient, but with an external (8-pin) I2C serial EEPROM such as the 24LC256. Also, IMHO you're "jumping into the deep end" in using Slots, until you discover what can (and can't) be done in a single program slot. ;)

Of course, selecting one of two (other) "programs" could easily be detected with a single button (e.g. long-press/short-press) but DOWN / UP / ENTER (or a rotary encoder with a "fire" button) is a classic structure for menu-driven systems. This potentially gives the ability to Edit sequences, although some form of local embedded display would be helpful.

Cheers, Alan.
 

nhphantom

New Member
Hi Alan
Thank you for the input it did help see I maybe trying to do too much at one time . I think I will take a step back and work on getting the picaxe working with the Efx-tek Fc4 board and go from there as you said I can always use a pc to change the sequence and if by an imbedded display you mean something a AXE133y display that was going to be my plan. of course a way to select a different program with the use of one or two buttons would something to understand but baby steps is probably the best way.

David
 

Jeff Haas

Senior Member
Hi David,

I did some checking...I have some of the other EFX-Tek boards and wanted to see how they would work with the PicAxe. It's actually pretty simple, the command is almost the same. Here's a code snippet to get you started. This is for the AP-16 board:

Code:
' -----[ I/O Definitions ]-------------------------------------------------
    Symbol  sio      = 4           ' Pin to the AP-16 serial

' -----[ Constants ]-------------------------------------------------------
    Symbol  baud     = T2400    

INIT:
    Sertxd ("Set volume")                          
    Serout sio, baud, ("!AP16", %00, "L", 30, 30)
    Pause 500
   
MAIN:

    Sertxd ("Play SFX file 1")
    Serout sio, baud, ("!AP16", %00, "PS", 1, 1)
    Pause 3000

    Sertxd ("Play file named PLAY2")
    Serout sio, baud, ("!AP16", %00, "PW", "PLAY2", 13, 1)
    Pause 7000

    Goto MAIN


While there are commands to have the EFX-Tek board report its version number and status, I remembered that I really didn't use those. Just send the board the command you want. For example, to set all channels to full brightness on the FC-4:

Code:
' -----[ I/O Definitions ]-------------------------------------------------

    Symbol  sio      = 4           ' Pin to the FC-4 serial

' -----[ Constants ]-------------------------------------------------------

    Symbol  baud     = T2400  

' Set all channels to full brightness, as on page 5 of the docs:
    Serout sio, baud, ("!FC4", %00, "A")
Jeff
 
Top