Relais Card

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
martijnj
Member
Posts: 61
Joined: Mon Nov 03, 2003 2:50 pm
Location: NL

Relais Card

Post by martijnj »

Hi Everybody,



I just bought a relay-card with 8 relays on it. It used RS-232 19200 baud....... etc. How does somebody set this up in housebot?



Best regards,



Martijn Janson
ScottBot
Site Admin
Posts: 2806
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Martijn,



If it's control protocol is not too complex, you should be able to use the HouseBot generic serial plugins to control it.



These plugins (Hardware Interface and Device) can be a bit tricky to configure as they are very flexible. They are part of the core HouseBot installation package, but you may have to re-run the setup and select them if you don't have them installed already.



Start by reading the online help for the Generic Serial support. If you have specific questions regarding the configuration, let us know.
Scott
Ceesmf
Member
Posts: 4
Joined: Fri Feb 06, 2004 7:31 pm

Post by Ceesmf »

Hi Martijn



Just bought one myself, guess you bought the Conrad board and ... youre Dutch too

As sson as I've figured it out will let you know
ScottBot
Site Admin
Posts: 2806
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

One nice thing about the Generic Serial plugins is that they allow you to create and export the definitions for the hardware and device. If one of you gets it working, you can share the definition files with the other.
Scott
martijnj
Member
Posts: 61
Joined: Mon Nov 03, 2003 2:50 pm
Location: NL

relay card

Post by martijnj »

Hi Cees



I will keep it english so other people can read it to. Does LEC PC work on you PC?? I will also try to figure it out. Any help is welcome.



Martijn
martijnj
Member
Posts: 61
Joined: Mon Nov 03, 2003 2:50 pm
Location: NL

Ok I can figure it out......

Post by martijnj »

Hi eveybody,



Since I can't get it to work I just typed the contol instuctions into my computer.



Please Help :oops: :?:



Many thanks,



Martijn Janson



Mode of operation and practical work with the relay board



Control of the relay board – serial data transfer

Date transfer from the superordinated control computer of the first relay board, as well as between the relay boards, is implemented according to the RS232 standard with 19200 baud, 8 data bits per byte, without parity bit, with a stop bit and without handshake.

A microcontroller operates on each board, which receives serial command data, evaluates these and, if required, forwards them. The commands are produced by the superordinated control computer. The relay boards gives a reply to the controller for each executed command. Commands and replies consist, in each case of a series of 4 bytes.

In the following, we refer to these subsequently as frames.



Frame organization:

Byte 0 - Command

Byte 1 - Board address

Byte 2 - Data

Byte 3 - Test sum (XOR)







Each relay board is addressed by means of a number. The number of the board is produced automatically during initialization (see below) from the position of the board in the serial ring



Word of advice: depending on the principle used, with the cascading of several relay boards, there are differences in the data transmit times and the time differences in the execution of the switching procedures on the boards.



Forwarding instructions

As a rule, the controller for a relay board only carries out commands which are addressed to it (for exceptions, see Initialization ans Broadcasting). Other instructions are forwarded by it, unchanged, following a check for transfer errors.



Checking for transfer errors

The test sum in byte 3 is produced, in each case, from the “exclusive or” logical operation (XOR) of byte 0, byte 1 and byte 2. if the relay board processor establishes, on the basis of the test sum, an error in the receiving frame, it sends a 4-byte-long error message:

255 – own address – x – new test sum.

The incorrect frame does not result in execution or forwarding



Broadcasting

A command frame with the address value 0 counts as broadcast (“broadcast to all”) and is implemented from each relay board(for an exception, see below). Following execution, the board controller first of all send the corresponding reply. The it regenerates the broadcast command for the subsequent board.



Commands

The relay board send a reply frame to each executed command:

Inverted command recognition – own address – data – new test sum





Commandlist

The following commands are defined (x stands in each case for “without meaning”):


Code: Select all

CMD	Meaning									Command frame			Reply
0 	No Operation - no action (NOP)		0 - Adr. - x - XOR		255 - Adr - x - XOR
1 	SETUP - initialisation				1 - Adr. - x- XOR			254 - Adr. - info - XOR
2 	GET PORT - query switch state		2 - Adr. - x - XOR			253 - Adr. - data - XOR
3 	SET PORT - switch relay				3 - Adr. - data - XOR		252 - Adr. -x - XOR
4 	GET OPTION - query options			4 - Adr. - x - XOR			251 - Adr.- opt.- XOR
5 	SET OPTION - set options				5 - Adr. - opt. - XOR		250 - Adr.- x - XOR

Command 0 – NOP
Word of advice: Please note that this command produces an error message (CMD=255) as a reply. The NOP command can be used for test purposes.

Command 1 – initialisation
The relay board takes over the address in the frame as now being its own. In the reply frame, the info value provides information about the version of the microcontroller software.
Following sending of the reply frame, the controller produces an initialisation command with an address increased by 1, and gives this to the subsequent board (or back to the control computer, in single operation). The control computer therefore receives, in the case of N connected relay boards, N+1 reply frames. The address value forwarded the first relay board must always be 1.

Commands 2 and 3 – set and read ports
These instructions refer to the relay of the board. Bit 0 in the data value corresponds to relay 1 (terminal KL1), bit 1 with relay 2 (terminal KL2) etc.

Instructions 4 and 5 – set and read options
Each relay board controller takes account of the following options in the execution of broadcast commands:

Option “broadcast enabled” (pre-setting ON). If this option is switched off, the boards controller carries out no broadcasts and only forwards these to subsequent boards.

Option “block broadcast” (Pre-setting OFF). If this option is switched on, the board controller sends, instead of the original broadcast, an NOP command to the subsequent board. The following combinatios are produced for the option value in the commands 4 and 5:

Code: Select all

Value		Execution of Broadcasts	Blocking of Broadcasts
0					no							no
1(pre-setting)	yes						no
2					no							yes
3					yes							yes






For more info download the following pfd file. http://www.produktinfo.conrad.com/daten ... eriell.pdf
Post Reply