Reading and Writing Text over USB A Colony Project Tutorial.

Slides:



Advertisements
Similar presentations
Linux Serial Programming for POSIX Operating Systems
Advertisements

Calera High School Dawn Bone
IO Interfaces and Bus Standards. Interface circuits Consists of the cktry required to connect an i/o device to a computer. On one side we have data bus.
Hardware and Python Steve Granda. Why would I want to do this? You want to make something interactive. You want to recreate sputnik. You want to measure.
Reading and Writing Text Files Svetlin Nakov Telerik Corporation
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Comm Operator Tutorial How to send sequence data at given time automatically Serial Port Tool
PC ADXL362Z- DB REV 2 USB cable 1. After turning the SW4 to VU, I can see follow picture. J1 : Ext Bat side J2 : USB side COM4.
Contest format 5 hours, around 8-12 problems One computer running (likely)Linux, plus printer 3 people on one machine No cell phones, calculators, USB.
How to use Arduino By: Andrew Hoffmaster.
An Introduction to C Adam Gleitman – IAP 2014.
 The central processing unit (CPU) interprets and executes instructions.  The “brains” of the computer.  The speed of the processor is how fast it.
CASH DRAWER CONFIGURATION GUIDE. 1.PRINTER PORT connect the drawer at the back of the printer using RJ11 connector 2.SERIAL PORT connect the drawer at.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
ECE Department: University of Massachusetts, Amherst ECE 354 Spring 2006 Lab 2: Capturing and Displaying Digital Image.
“Power Supply” Controls Voltage Difference in Voltage is set Output Current is “as requested” by attached device.
Eejit’s guide to using a LCD alphanumeric display with the CCS C compiler 1.Hardware connection 2.The LCD.C include file 3.An example.
University of Tehran 1 Interface Design Keyboard and Printer Omid Fatemi.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
How to use the CCS compiler with the serial port.
Comm Operator Tutorial How to send the data after receiving specific data automatically Serial Port Tool
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Chapter Introduction to Computers and Programming 1.
Serial Communication Lab 12 Module M21.1. Asynchronous Serial I/O ASCII code 54H = (“T”) sent with odd parity.
Comm Operator Tutorial How to send the same data at fixed interval time automatically Serial Port Tool
This is NUUO IO Device. Install IO Device IO Card Capture Card IO Box Converter USB RS485 PCI MPEG-4 Series H.264 Series.
What is a Computer HardwareStorageSoftware Random Questions.
Bluetooth Controller Setting up the BT controller and Arduino with Processing.
Practical Electronics & Programming
Computer Basics Terminology - Take Notes. What is a computer? well, what is the technical definition A computer is a machine that changes information.
Jim Ng 15/1/2014 CENG4480 TUTORIAL 1. ABOUT ME Current MPhil Student supervised by Prof. Mak You can find me at Rm116 in SHB
Development of a microprocessor project with LPC2388 development board.
Computer Ports Mouse Port (Input).
Lecture Contents I/O Streams. –Input/output streams. –Unformatted vs formatted streams. –Stream manipulators. –Stream error state. –Stream tying. –Examples.
Semester One 2001/2002 Sheffield Hallam University1 What does a PC do? computers collect, process, store, and communicate information Collect via input.
Quick guide to ASIMON configuration For version 3.0 or greater SAFETY AT WORK Date: 3/18/2009.
Programming with LabVIEW Intro to programming and.
Parts of a Computer. Keyboard: The input device that you use to type letters, numbers, and symbols into a computer.
Hands-on Session 1 Boot Linux Connect to Linux via USB-to-UART and Putty Compile and run a simple program.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Computer Basics Just How Does a Computer Work?. A computer is made up of many parts. Let’s explore the parts to see if you know what they are called!
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
Microcontroller basics Embedded systems for mortals.
Istituto Tecnico Industriale A.Monaco EURLAB European Robotic LABoratory HOW TO Transmit and RECEIVE Datas.
全面推开营业税改征 增值税试点政策培训. 什么是营改增? “营改增”中的“营”指的是营业税,“ 增”指的是增值税。对大多数企业来说,增 值税所带来的税负远低于营业税。 减税本身就是积极的财政政策。营改增所 实现的减税,不仅规模大、范围广,它本质 上是一种“结构性减税”,从而构成“结构 性改革”攻坚战中的实招。
Arduino Part 1 Topics: Microcontrollers
Introduction of Embedded C and demo programs
European Robotic LABoratory
By Rick Darby Sponsors: Geekspace Gwinnett The WorkSpot
Lunchtime Hackers Buffer Overflow Intro.
CS-401 Computer Architecture & Assembly Language Programming
PORTS Socket for external devices to connect to the system unit.
Microcontroller basics
Welcome to Arduino A Microcontroller.
RS232 Converter SB-DN-RS232N.
FGC3 controls for the TRIUMF 20kA 80V power converter
Vision for Robotic Applications
ADC32RF45 with KCU105 Internal Clock GHz.
COMPUTER BASICS Computer essentials 7-8.
Sensors Training.
Manipulators CSCE 121 J. Michael Moore
Communications channels تقديم المهندس سنان محمد حسن
CS703 - Advanced Operating Systems
Programmable Peripheral Interface
الوحدة الرابعة البرمجة وصياغة حل المسائل البرمجة وأهميتها أهداف الدرس الأول مفهوم البرمجة. الفرق بين المبرمج ومستخدم البرنامج. الحاجة إلى البرامج.
Communication Ports Created by Ed, VE7ED, ver. 1.0.
Debugging Debug environments Debug via serial
SPI Protocol and Programming
Presentation by Anthony Dotterer
Presentation transcript:

Reading and Writing Text over USB A Colony Project Tutorial

2 Differences between Windows and Linux On Windows, the robot is connected to a com port, usually com1 – com4 – This can be found in the device manager On Linux, the robot is connected to /dev/ttyUSB0 or higher numbers – Guess the number until you get it right

Tera Term Serial input and output program Lets you view stuff that the robot has printed to USB Can also write responses to robot 3

Open a Serial Connection In Tera Term, use Setup->Serial Port to start a session Use File->Disconnect to end a session The Baud rate should be

Basic USB Write Functions usb_putc(char c) – ex: usb_putc(‘a’); usb_puts(char* s) – ex: usb_puts(“testing”); usb_puti(int i) – ex: usb_puti(12); 5

Advanced USB Write Functions usb_puth8(int i) – print 8 bit hex value – ex: usb_puth8(0xA6); usb_puth16(int i) – also named usb_puth(int i) – print 16 bit hex value – ex: usb_puth16(0x5D2F); 6

USB Read Functions int usb_getc() – returns a character – ex: c = usb_getc(); int usb_getc_nb() – nonblocking form of usb_getc – returns -1 if no character present in input buffer – ex: c = usb_getc_nb(); 7

Example – test_usb.c usb_init(); usb_puts("usb turned on, test starting:\r\n"); usb_puts("\r\n\n"); delay_ms(1000); // print some values to usb usb_puts("Testing...\r\n"); usb_puti(1); usb_putc(','); usb_putc(' '); usb_puti(2); usb_putc(','); usb_putc(' '); usb_puti(3); usb_putc('\r'); usb_putc('\n'); usb_puth8(0x2A); usb_putc(','); usb_putc(' '); usb_puth16(0xF4); usb_putc(','); usb_putc(' '); usb_puth(0xC8E1); usb_putc('\r'); usb_putc('\n'); usb_puts("enter an 'a':"); if (usb_getc() == 'a') usb_puts("\r\ngetc() works\r\n"); else usb_puts("\r\ngetc() fails\r\n"); usb_puts("done.\r\n\r\n"); 8