Open-Source Robotics And Proces Control Cookbook Edwards L 242P Newnes Elsevier 2005 Part 6 ppt

20 227 0
Open-Source Robotics And Proces Control Cookbook Edwards L 242P Newnes Elsevier 2005 Part 6 ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter ; SEL line is HIGH Disable USI and switch PB1 to input to take ; us off-bus usi_disable: ; disable USI start and overflow interrupts cbi USICR, USISIE cbi USICR, USIOIE ; Disable output driver on PB1 (DO) cbi DDRB, PORTB_DO ; set PB1 to input iopin_done: out SREG, r3 reti Some averaging or filtering is advisable on the PC end of this equation Here’s a simple program that takes out continuous readings and prints them to a single line on the console (you’ll find the sourcecode and makefile for this program in the accel directory of the sample source archive): /* main.c Demonstration applet for E2BUS stepper interface code From “Open-Source Robotics and Process Control Cookbook” Lewin A.R.W Edwards (sysadm@zws.com) */ #include #include “e2bus.h” int main (int _argc, char *_argv[]) { unsigned char pkt[6]; int i=0,j; // Open port if (E2B_Acquire()) { printf(“Error opening E2BUS.\n”); return -1; } 88 Some Example Sensor, Actuator and Control Applications and Circuits (Hard Tasks) E2B_Reset(); printf(“Reset complete, pausing \n”); sleep(1); printf(“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”); while (1) { usleep(750000); pkt[0]=ACL_CMD_READ_STATUS; E2B_Tx_Bytes(pkt, 1, 0, 0); E2B_Rx_Bytes(pkt, 6, 0, 1); for (j=0;j

Ngày đăng: 10/08/2014, 05:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan