Velleman VM142 User manual

VM142
Mini PIC-PLC application module 2
Mini PIC-PLC toepassingsmodule 12
MINI PIC-PLC APPLICATION MODULE
The translation of this manual and all other information concerning this module can be found on our website : www.velleman.be

2
WARRANTY
This product is guaranteed against defects in components and construction from the moment it is purchased and for a period of TWO YEAR starting from the date of sale. This
guarantee is only valid if the unit is submitted together with the original purchase invoice. VELLEMAN components Ltd limits its responsibility to the reparation of defects or,
as VELLEMAN components Ltd deems necessary, to the replacement or reparation of defective components. Costs and risks connected to the transport, removal or place-
ment of the product, or any other costs directly or indirectly connected to the repair, will not be reimbursed by VELLEMAN components Ltd. VELLEMAN components Ltd will
not be held responsible for any damages caused by the malfunctioning of a unit.
Safety and warning instructions
All repairs should be executed by qualified technicians.
Avoid the installation of the module in locations with standing or running water or excessive humidity. Indoor use only !
SAFETY INSTRUCTIONS
Handle the module gently and carefully. Dropping it can damage the circuit board and case.
Never exceed the protection limit values indicated in the specifications.
As safety requirement vary, please check with your local authorities.
No objects or liquids should be allowed to penetrate the housing.
Disconnect the module from the AC power before connecting new devices.
Wipe the device with a dry and clean cloth. Do not use detergents or other liquids that may damage the housing.
Keep the device away from children.
Facilitate the operation of the device by familiarising yourself with its adjustments and indications.
Velleman modules are not suitable for use or as part of life support systems, or systems that might create hazardous situations of kind.
WARNINGS
Repair under warranty is only possible with date and proof of purchase.

3
Specifications & features
SPECIFICATIONS & FEATURES
The VM142 is equipped with a popular 8-bit Microchip®microcontroller. The
PCB layout is designed in such way to include 4 buffered inputs and outputs, a
potential-free relay output and an onboard buzzer. The PIC™ microcontroller is
freely programmable and the software can be developed in Assembler,C or
even special versions of Basic,Pascal,... Note that a certain level of experi-
ence in PIC™ microcontrollers and their programming is required.
Visit www.velleman.be and download software examples.
FEATURES
9 freely programmable inputs and outputs (4 inputs, 5 outputs)
onboard Microchip®PIC16F630 microcontroller
LED indication for power supply and relay output
1 freely programmable LED indication
onboard buzzer
output transistor can be easily replaced
ICSP™ connector for direct controller programming
You need a PIC™ programmer supporting the PIC16F630, e.g. VM134 (K8076), for
programming this module.
SPECIFICATIONS
• Power supply: 12VDC / 100mA
• 4 NPN transistor inputs / 4 NPN transistor outputs
• 1 relay output with NO/NC contact (24VDC / 2A)
• MCU speed: fixed 4MHz internal oscillator
• Input signal voltage: 5 – 24VDC, max. 10mA
• max. transistor output current: 100mA each
• dimension: 80 x 70 x 25mm
-1- Diagnose LED
-2- Relaycontrol LED
-3- Power supply indication
-4- Terminal block
Description
See also connection diagram on page 7...9
4
2 31

4
Descriptions of the terminal block
DESCRIPTIONS OF THE TERMINAL BLOCK
GND-Vin:
Connect the power supply between connections GND and Vin. Apply a direct voltage of 12V (regulated or not
regulated) between the two pins. The electronics of the module are protected against polarity inversion.
The 12V DC must be connected to the “Vin” terminal, your ground level to the “GND” terminal.
In1,In2,In3,In4:
These are the four module inputs which can be activated by applying a direct voltage between 5 and 24V.
The input impedance is 4.7K.
Note that a voltage exceeding 24V can damage the input transistor.
I/O of the PIC16F630: PORT A
INPUT1 I/O 3
INPUT2 I/O 2
INPUT3 I/O 1
INPUT4 I/O 0
Programming example :
BTFSC PORTA,INPUT1 ;Read status of input 1
GOTO INPUT1_NOT_ACTIVE ;’1’ Not active
GOTO INPUT1_ACTIVE' ;’0’ active (5V ... 24VDC)

5
Descriptions of the terminal block
Out1,Out2,Out3,Out4:
These are the four open-collector type outputs and can each handle a current of max. 100mA.
These transistors are grouped in a transistor array chip, IC2. In case of damage of one of the four inputs or
outputs, this IC type ULN2803A can be replaced easily and without soldering.
I/O of the PIC16F630: PORT C
OUTPUT1 I/O 5
OUTPUT2 I/O 4
OUTPUT3 I/O 3
OUTPUT4 I/O 2
Programming example:
BSF PORTC,OUTPUT1 ;activate output 1
BCF PORTC,OUTPUT2 ;deactivate output 2
N.O. - COM - N.C.
Output 5 is voltage-free relay contact with double operation. COM is the common contact, NO is the normally
open contact, NC is the normally closed contact
Programming example :
BSF PORTC,RELAY ;activate the relay.
BCF PORTC,RELAY ;deactivate the relay

6
Descriptions of the terminal block
BUZZER:
The built-in buzzer with fixed frequency can be activated and deactivated in your program.
Programming example:
BSF PORTC,BUZZER ;activate the buzzer
BCF PORTC,BUZZER ;deactivate the buzzer
Diagnose LED (LD3):
This LED is fixed connected to an I/O of the PIC controller and can be freely programmed.
The built-in LED can be activated as follows:
Programming example:
BSF PORTA,DIAGLED ;activate the led.
BCF PORTA,DIAGLED ;activate the led.

7
Connection examples
CONNECTION EXAMPLES
Connection of a load (e.g. Motor) In circuit connection between VM142 and VM134/K8076

8
Connection examples
Connection of a relay
GND
+12V
12V relay
Jumper “Jp3” closed
Connection of a switch, push button…
GND
+12V

9
Connection examples
Connection of a LED Connection of two or more LEDs to the same output
* Remove jumper "JP4"

10
Use
The controller (type PIC16F630) can be programmed in Microchip®PIC™ Assembler and other compilers.
The compiler HEX file can be programmed using one of our PIC™ programmers K8048, K8076, VM111, VM134.
The programming method whit the controller remaining onto the PCB is called in-circuit (via the ICSP connector).
The controller chip can also be removed out of the IC socket and be inserted into an external programmer.
Using the in-circuit method implies that no input may be activated during the programming process. The output status is also
undetermined. Make sure to avoid damages due to an uncontrolled energizing of the relays.
Please visit www.velleman.be and download an exemplary program with Assembler source code.
JUMPERS JP1 to JP4:
These jumpers allow you to limit the maximum output current so as to connect a LED directly to the output.
A 1K resistance will be placed in series with the output when you remove the jumper. This value is the value needed to
activate a standard LED at a power voltage of 12V.
I led = (U – Uled) / Rv (12 – 1.6) / 1000 = 0.0104 10mA.
JP1 Output1, …..
USE

11
Test
TEST
The VM142 is pre-programmed with a test program allowing you to test all inputs and outputs of the module.
The program can be read as follows:
The diagnose LED blinks when applying voltage to the module.
After the activation of the 4 inputs, the relay will energize a couple of times and the buzzer will sound.
This program will be erased when you overwrite it with your own program.
You will find the source code and a header file on our website.
Activate input 1
Output 1 is energized.
Activate input 2
Output 2 is energized.
Activate input 3
Output 3 is energized.
Activate input 4
Output 4 is energized.

12
WAARBORG
Dit produkt is gewaarborgd wat betreft gebreken in materialen en vakmanschap op het ogenblik van de aankoop en dit gedurende een periode van TWEE JAAR vanaf de
aankoop. De waarborg geldt enkel indien het produkt voorgelegd wordt samen met het origineel aankoop bewijs. De verplichtingen van VELLEMAN COMPONENTS N.V.
beperken zich tot het herstellen van defecten of, naar vrije keuze van VELLEMAN COMPONENTS N.V., tot het vervangen of herstellen van defecte onderdelen. Kosten en
risico’s van transport; het wegnemen en terugplaatsen van het produkt, evenals om het even welke andere kosten die rechtstreeks of onrechtstreeks verband houden met de
herstelling, worden niet door VELLEMAN COMPONENTS N.V. vergoed. VELLEMAN COMPONENTS N.V. is niet verantwoordelijk voor schade van gelijk welke aard,
veroorzaakt door het falen van een product.
Veiligheidsaanwijzingen en waarschuwingen
Reparaties mogen uitsluitend uitgevoerd worden door vakkundige personen.
Installeer de module niet op plaatsen met staand of stromend water of in ruimtes met een te hoge vochtigheidsgraad.
Binnengebruik enkel!
VEILIGHEIDSAANWIJZINGEN
Vermijd een ruwe behandeling. Stoten of laten vallen kunnen ernstige schade aanbrengen.
Overschrijdt nooit de opgegeven veiligheidswaarden in de specificaties.
Vermits de veiligheid vereisten verschillen van plaats tot plaats, zorg daarom dat Uw montage voldoet aan de plaatselijke
geldende vereisten.
Let op dat er geen voorwerpen of vloeistoffen in het toestel dringen.
Zorg ervoor dat de netspanning altijd uitgeschakeld is bij het aansluiten van nieuwe toestellen.
Houdt vooral kinderen uit de buurt van het toestel dit ter veiligheid van hun zelf.
Zorgt ervoor dat u met alle bedieningselementen vertrouwd raakt, wanneer U met het toestel zal werken.
Velleman modules zijn niet geschikt voor gebruik in of als gedeelte van systemen welke levensfuncties in stand houden of
systemen welke gevaarlijke situaties van gelijk welke aard kunnen veroorzaken.
WAARSCHUWING
Herstelling onder garantie is enkel mogelijk met aankoopbewijs.

13
Technische gegevens & eigenschappen
TECHNISCHE GEGEVENS & EIGENSCHAPPEN
De VM142 heeft een zeer populaire 8-bit microcontroller van Microchip aan boord
en de hardware layout is zo ontworpen dat er 4 gebufferde in- en uitgangen zijn.
Verder is er ook een potentiaalvrije relaisuitgang en een zoemer geïntegreerd. Dit
alles maakt deze module veelzijdig. De PIC microcontroller is door U vrij te
programmeren. De software kan ontwikkeld worden in Assembler, C of zelfs
speciale versies van Basic, Pascal... Een zekere graad van ervaring met PIC
microcontrollers en hun programmatie is vereist.
Software voorbeelden kan je downloaden via onze website: www.velleman.be
EIGENSCHAPPEN
9 vrij programmeerbare in- en uitgangen. (4 in-, 5 uitgangen)
Geïntegreerde PIC16F630 Microcontroller van Microchip®
LED indicatie voor de voedingsspanning en relais uitgang.
1 vrij programmeerbare LED indicatie.
Ingebouwde zoemer.
Zeer eenvoudige vervanging van de uitgangstransistors.
ICSP™ connector voor rechtstreekse programmatie van de controller.
Om deze module te programmeren is er een PIC™ programmer vereist die de
PIC16F630, bv. de VM134 (K8076), ondersteunt.
TECHNISCHE GEGEVENS
• Voeding: 12V DC / 100mA.
• 4 NPN transistor ingangen - 4 NPN transistor uitgangen.
• 1 relais uitgang met NO/NC contact (24VDC / 2A).
• Klokfrequentie controller: 4MHz vaste interne oscillator.
• Ingangsspanning: 5 – 24VDC, max 10mA.
• Max schakelstroom: 100mA per kanaal.
• Afmetingen: 80x70x25mm.
-1- Diagnose LED
-2- Controle relais LED
-3- Voedingsindicatie
-4- Aansluitingsconnector
Beschrijving
Zie aansluitschema's pag. 17 … 19
4
2 31

14
Beschrijving aansluitklemmen
BESCHRIJVING VAN DE AANSLUITKLEMMEN
GND-Vin:
De voedingsspanning wordt aangesloten tussen de aansluitingen GND en Vin. Leg tussen deze pennen een
gelijkspanning aan van 12 (gestabiliseerd of ongestabiliseerd). De elektronica van de module zelf is
beschermd tegen polariteitinversie. Sluit de 12V DC aan de ‘Vin’-terminal; sluit de aarding aan de ‘GND’-
terminal.
In1,In2,In3,In4:
Dit zijn de 4 ingangen van de module. Deze ingangen kunnen worden actief gemaakt door er een
gelijkspanning tussen 5 en 24V op aan te bieden. De ingangsimpedantie van deze klemmen is 4,7 K.
Een spanning hoger dan 24V kan de ingangstransistor beschadigen.
I/O poort van de PIC16F630: POORT A
INPUT1 I/O 3
INPUT2 I/O 2
INPUT3 I/O 1
INPUT4 I/O 0
Programma voorbeeld:
BTFSC PORTA,INPUT1 ;Lees status van ingang 1
GOTO INPUT1_NOT_ACTIVE ;’1’ geen spanning
GOTO INPUT1_ACTIVE' ;’0’ Actief (5V ... 24VDC)

15
Beschrijving aansluitklemmen
Out1,Out2,Out3,Out4:
Dit zijn 4 uitgangen van het ‘open-collector’ type. Zij kunnen max 100mA per uitgang schakelen. Deze
transistoren zitten samen gebundeld in een transistor array chip, IC2. Bij een defect van één van de 4 in- of
uitgangen kan dit IC, type ULN2803A snel worden vervangen, dit zonder soldeerwerk.
I/O poort van de PIC16F630: POORT C
OUTPUT1 I/O 5
OUTPUT2 I/O 4
OUTPUT3 I/O 3
OUTPUT4 I/O 2
Programma voorbeeld:
BSF PORTC,OUTPUT1 ;Activeer uitgang 1
BCF PORTC,OUTPUT2 ;Deactiveer uitgang 2
N.O. - COM - N.C.
Dit is uitgang 5, dit is een spanningloos relaiscontact met dubbele werking. COM is de gemeenschappelijke,
NO is het normaal open contact, NC is het normaal gesloten contact.
Programma voorbeeld:
BSF PORTC,RELAY ;Activeer het relais
BCF PORTC,RELAY ;Deactiveer het relais

16
Beschrijving aansluitklemmen
BUZZER:
De ingebouwde zoemer met vaste frequentie kan in het programma geactiveerd en gedeactiveerd worden.
Programma voorbeeld:
BSF PORTC,BUZZER ;Activeer de zoemer
BCF PORTC,BUZZER ;Deactiveer de zoemer
Diagnose LED (LD3):
De vaste led is aangesloten op een in-/uitgang van de PIC™ controller en is vrij programmeerbaar.
De ingebouwde led wordt als volgt geactiveerd:
Programma voorbeeld:
BSF PORTA,DIAGLED ;Activeer de led
BCF PORTA,DIAGLED ;Deactiveer de led

17
Aansluitvoorbeelden
AANSLUITVOORBEELDEN
Aansluiten van een belasting (vb. motor) "In circuit" verbinding tussen VM142 en VM134/K8076

18
Aansluitvoorbeelden
Aansluiten van een relais
GND
+12V
12V relay
Jumper “Jp3” closed
Aansluiten van een schakelaar, drukknop, ...
GND
+12V

19
Aansluitvoorbeelden
Aansluiten van een led Aansluiten van 2 of meerdere LEDs op dezelfde uitgang
* verwijder shunt "JP4"

20
Gebruik
GEBRUIK
De controller van het type PIC16F630 kan worden geprogrammeerd in PIC assembler van Microchip, maar ook door andere
3rd party compilers.
Het afgeleverde HEX bestand door een compiler pakket kan met één van onze PIC programmers:
K8048,K8076,VM111,VM134 geprogrammeerd worden.
Als de controller op de print blijft zitten van de VM142 wordt de methode van programmering “in circuit” genoemd. (via de
ICSP connector), de controller chip kan ook uit het IC voet worden genomen en in een externe programmer worden gestopt.
Als de “in circuit” methode gebruikt mag tijdens het programmeringproces geen enkel ingang worden geactiveerd. Ook de
toestand van de uitgangen is onbepaald en men dient voorzorgen te nemen dat er geen schade kan ontstaan doordat bvb
relais ongecontroleerd aantrekken.
Een voorbeeld programma, met assembler source code kan je downloaden via onze website, www.velleman.be
JUMPER JP1 tot JP4:
Met deze jumpers kan je de maximale uitgangsstroom beperken zodat bvb een LED rechtstreeks op de uitgangs kan worden
aangesloten.
Verwijderd men deze jumper dan wordt in serie met de uitgang een weerstand van 1K geplaatst. Dit is de waarde nodig om
een standaard LED op te laten lichten bij een module voedingsspanning van 12V
I led = (U – Uled) / Rv (12 – 1.6) / 1000 = 0.0104 10mA.
JP1 Output1, …..
Table of contents
Languages:
Other Velleman Dimmer manuals