iTOP-4412 development board - LinuxC - test routine for relay module

Publisher:Heavenly999Latest update time:2022-01-17 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Platform: iTOP-4412 development board

Implementation: Relay module test routine

 

Relay's C test program, C test program can be used on Android system, Qt system and minimal

It runs on the linux system. The document takes the test on the Android system as an example. The C test source code provided is "relay.c" and the compiled program "relay". The schematic diagram of the relay module is shown in the figure below. By controlling the level of the network XispSPIMISO, the relay is turned on and off. The elite version baseboard corresponds to the pin 10 of the expansion terminal J38 (the terminal is printed with "GPIO", next to the terminal of the audio interface), and the all-round board baseboard corresponds to the pin 10 of the expansion terminal J10 (the terminal is printed with "GPIO", next to the terminal of the buzzer and independent button).

 

Elite Edition hardware connection, as shown in the figure below, use the cable to connect the development board and relay module, connect the

"GPIO" port.

 

Next, compile the test program. As shown below, compile the relay.c test program. In the Ubuntu system, enter the compile command

"arm-none-linux-gnueabi-gcc -o relay relay.c -static" generates the relay executable program. The compiler used is "arm-2009q3". For details, please refer to Section 8.1 of the User Manual.

 

Upload the executable program relay to the development board's "/data" through adb. In the cmd command line, enter adb up

The command for transferring files is "adb push relay /data", as shown in the figure below. For details on adb file upload, please refer to Section 8.1 of the User Manual.

 

Modify the permissions of the test program. In the HyperTerminal, enter the command "cd /data" and enter the command to modify permissions.

"chmod 777 relay", as shown in the figure below.

 

In the HyperTerminal, enter the command "./relay 1" to run the program. As shown in the figure below, the terminal prints "tl sucess", which means

The program runs successfully. At this time, the network XispSPIMISO outputs a high level, the relay is turned on, and a crisp sound of the relay can be heard. The multimeter measures that the relay pins 2 and 5 are conducting, and the pin-A of the terminal J1 on the relay module outputs a 5V voltage.

 

 

 

In the HyperTerminal, enter the command "./relay 0" to run the program. The terminal prints "tl sucess".

XispSPIMISO outputs a low level, the relay is closed, and a crisp sound can be heard from the relay. The multimeter measures that relay pins 3 and 5 are conductive, and pin-B of terminal J3 on the relay module outputs a 5V voltage.

 

If you want to output other voltages (not 5V), you can remove the R3 resistor and change the voltage to be controlled from "COM"

Pin input is OK.


Reference address:iTOP-4412 development board - LinuxC - test routine for relay module

Previous article:Xunwei 4412 development board practical intelligent gateway project
Next article:iTOP-4412 development board-practical tutorial-ssh server ported to arm development board

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号