question about modules
gentlemen,
i have a very elemetary question and please forgive my ignorance on netlinx as i will be posting several of these to come. I try and use the technotes etc. to the best of my ability but it dosent always explain or ilustrate things in a way that i understand them. (i require real step by step baby talk until i get it) So please bare with me, i wasnt a programmer before this , and ive been working on this netlinx thing going on 2 years now. I think ive developed enough of a programmer background now to finally do this right. here goes:
its a best practice to utilize modules when adding a device to a system be they pre-written or done on your own.
modules are seperate "mini" programs" in seperate files that work within the netlinx main program.
if i have 3 devices;
DVD player
media server
tivo
I use 3 modules. How do these modules work with each other if i have to create a macro to turn on TV, power on DVD, media server and Tivo?
Thanks in advance.
i have a very elemetary question and please forgive my ignorance on netlinx as i will be posting several of these to come. I try and use the technotes etc. to the best of my ability but it dosent always explain or ilustrate things in a way that i understand them. (i require real step by step baby talk until i get it) So please bare with me, i wasnt a programmer before this , and ive been working on this netlinx thing going on 2 years now. I think ive developed enough of a programmer background now to finally do this right. here goes:
its a best practice to utilize modules when adding a device to a system be they pre-written or done on your own.
modules are seperate "mini" programs" in seperate files that work within the netlinx main program.
if i have 3 devices;
DVD player
media server
tivo
I use 3 modules. How do these modules work with each other if i have to create a macro to turn on TV, power on DVD, media server and Tivo?
Thanks in advance.
0
Comments
Your touchpanel typically has three classes of button:
(a) Device transport - play, pause etc - pass these directly to the driver modules to action.
(b) Navigation - do this locally in the touchpanel if it's real simple.
(c) Device selection, etc - the control module handles these, and sends the appropriate collection of button pushes (power on/off, source selection etc) to the other modules.
I note that you don't have a TV module - you need one. I presume that switching is happening in the TV?
the devices i mentioned were just an imaginary example.
i suppose when you say control module, you mean everything thats not a "device" module ie, all your automation macros , subroutines , functions etc. The real program?
but if i had to create a macro to turn on 3 imaginary devices that each used netlinx modules , would my code say "hey module for DVD, execute your power on command" , "hey module for Media Server, execute your power on command", and so on.
how would this look?
thanks.
vDVD and vMediaServer are virtual devices passed from the mainline into the control module header and the relevant module headers.
tpXXX are the channel numbers used in the driver modules.
DO_PUSH[arqTP1,200] //connect to zone 1
All modules that I write use ON, OFF, PULSE, and TO. I try to stick to the AMX standard whenever possible for channels. Power on is always channel 27, Power off is always channel 28, etc. If simple channels aren?t enough then I?ll SEND_COMMANDs to the virtual device passed into the module. Some examples of what you would see are:
PULSE[vdvDVD,nPowerOn] //power on the dvd
PULSE[vdvMediaServer,nPowerOn] //power on the media server
TO[vdvReceiver,nVolUp] //ramp volume up while channel is held high
ON[vdvReceiver,nDebugChan] //turn module debugging on
OFF[vdvReceiver,nDebugChan] //turn module debugging off
SEND_COMMAND vdvReceiver,?VOL=25? //set volume to 25%
Curious as to why you recommend DO_PUSH to interface with modules?
Try doing a search for modules in the forum. There are some good examples and several enlightening discussions covering the topic as this forum has become a wealthy depository of valuable information. And of course you if don?t find what you?re looking for, feel free to post away.
NetLinx programming of device drivers appears to be a process of finding what does and doesn't work.
To be honest I actually use do_push_timed(xx,xx,1) and the comment I wrote some while ago says that the .1s timing prevents a hold from activating; it works and has worked for a while. When I wrote that post I couldn't thoroughly justify that choice so I didn't go there. If you reckon PULSE works that's fine by me.
If I have a UI module or a UI Comm combo module then I do use BUTTON_EVENTs, however, if necessary, I?ll also setup channels that call the same functions as some of the BUTTON_EVENTs to avoid the whole DO_PUSH thing. For example, let?s say I have a UI module that has a BUTTON_EVENT to do a refresh of some data (perhaps weather.) If the TP generates the BUTTON_EVENT for a refresh then all is good. But there may be times where I?ll want to generate a refresh via code in the main program. In that instance I?ll PULSE the refresh CHANNEL rather than DO_PUSH the refresh BUTTON.
I also find it much easier to TO a CHANNEL then to DO_PUSH/DO_RELEASE.a BUTTON.
I?ll use DO_PUSH if I have no other alternative as in the case you stated. I just never liked DO_PUSH, it doesn?t sit right with me. Maybe it?s partly because of the old Axcess days. It?s been a long time but I?m pretty sure DO_PUSH didn?t behave the same as a PUSH. Or maybe I?m just being pig headed.
To do the DO or not do the DO, that is the question.
Good topic of conversation?
I don't know why but I feel the same why too!
For example if you send "'SP',27" to the DVD, if I have a serially controlled DVD player the module will interpret that command and send the correct string.
im trying to load a module for the Escient FP1 (can be had here):
http://www.escient.com/support/intamx.html (its the first one.)
i figure its a good way to learn modules. I opened NLS and put files where they are supposed to go, Main file in the main folder in the work space, Module file in the module folder in the work space, 800x600 TP4 file in the UI folder in the work space.
when i hit "build active system" i get the following errors:
Starting NetLinx Compile - Version[2.3.0.0] [03-20-2007 13:33:02]
\\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\FireBall Module v5_0_1.axs
WARNING: \\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\FireBall Module v5_0_1.axs(0)The pre-processor is unable to find the directory \XP Shared\amx\EscientFireBallAMXDemov5\ in the Library path. Ignoring directory and continuing...
WARNING: \\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\FireBall Module v5_0_1.axs(0)The pre-processor is unable to find the directory \XP Shared\amx\EscientFireBallAMXDemov5\ in the given path. Ignoring directory and continuing...
ERROR: (0): C10580: Internal Error: Major system error occurred during code generation
\\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\FireBall Module v5_0_1.axs - 1 error(s), 2 warning(s)
NetLinx Compile Complete [03-20-2007 13:33:02]
Starting NetLinx Compile - Version[2.3.0.0] [03-20-2007 13:33:02]
\\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\Escient FireBall v5.0.1.axs
WARNING: \\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\Escient FireBall v5.0.1.axs(0)The pre-processor is unable to find the directory \XP Shared\amx\EscientFireBallAMXDemov5\ in the Library path. Ignoring directory and continuing...
WARNING: \\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\Escient FireBall v5.0.1.axs(0)The pre-processor is unable to find the directory \XP Shared\amx\EscientFireBallAMXDemov5\ in the given path. Ignoring directory and continuing...
ERROR: (0): C10580: Internal Error: Major system error occurred during code generation
\\.PSF\XP Shared\amx\EscientFireBallAMXDemov5\Escient FireBall v5.0.1.axs - 1 error(s), 2 warning(s)
NetLinx Compile Complete [03-20-2007 13:33:03]
>>>>--- NetLinx Compiles: 2 Files 2 Total Error(s) 4 Total Warnings(s) ---<<<<
It also looks like you have some bad paths in your workspace. Double check the properties and make sure they point to actual files.
i dont have any programming to do other than the escient. I just want to get one device up and running for practice. I did put a file labeled module in the module folder, and im sure i would have to edit the main file (Example to cut and paste from) and put that in the main folder (this module was written for 6 panels, i only want one 8400 setup).
as for the errors, i am using a Mac with a parallels session of XP. the "psf" directory stands for "parallels shared folder". This way its visible to both the windows session and mac. I think ill just put that escient file i downloaded into another folder all together.
Thanks!