Advantech RSB-4220 handleiding

72 pagina's
PDF beschikbaar

Handleiding

Je bekijkt pagina 58 van 72
RSB-4220 User Manual 52
int fd;
int main(int argc, const char *argv[]) {
int timeout = 10;
/*open watchdog device, the watchdog device node is /dev/watchdog */
fd=open("/dev/watchdog",O_WRONLY);
/*set timeout to 10 seconds*/
/*when set timeout value, the watchdog driver will enable the
watchdog automatically.*/
ioctl (fd, WDIOC_SETTIMEOUT, &timeout);
while (1)
{
/*feed the watchdog every 5 seconds*/
/*when call this function to feed watchdog, the watchdog
will reset its internal timer so it doesn't trigger the
board reset. If do not feed the watchdog more than 10
seconds, the watchdog will timeout and the board will
reset.*/
ioctl( fd, WDIOC_KEEPALIVE, NULL );
sleep (5);
}
close (fd);
}
Other watchdog APIs also exist.
Disable the watchdog timer sample code.
/*if user want to disable the watchdog before timeout, call the fol-
lowing ioctl function*/
int i_dis = WDIOS_DISABLECARD;
ioctl( fd, WDIOC_SETOPTIONS, &i_dis );
Enable the watchdog timer sample code.
/*if user want to enable the watchdog again before timeout when it is
disabled, call the following ioctl function. */
int i_en = WDIOS_ENABLECARD;
ioctl( fd, WDIOC_SETOPTIONS, & i_en);
Obtain the current timeout value.
/*get the current timeout value the driver used*/
int timeout = 0;
ioctl (fd, WDIOC_GETTIMEOUT, &timeout);
Refer to the <BSP_PATH>/source/demo/watchdog folder for more information.
3.8.3.3 GPIO Programming
RSB-4220 features eight GPIOs. Refer to <BSP_PATH>/source/demo/gpio
Usage
./gpio_ctrl 200 out 1

Bekijk gratis de handleiding van Advantech RSB-4220, stel vragen en lees de antwoorden op veelvoorkomende problemen, of gebruik onze assistent om sneller informatie in de handleiding te vinden of uitleg te krijgen over specifieke functies.

Productinformatie

MerkAdvantech
ModelRSB-4220
CategorieNiet gecategoriseerd
TaalNederlands
Grootte6307 MB