1 / 24

CONROLIB

Learn about the new CONRO hardware, development environment, CONROLIB, APIs, and how to write your first CONRO program. Explore future work and see a demo.

ordell
Download Presentation

CONROLIB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CONROLIB

  2. Objective of presentation • CONRO Developer should be able to program a fully functional CONRO after this presentation

  3. Outline of Presentation • The Basics: What is the new CONRO Hardware? • What is the new development environment? • Where can I get this software environment? • What is CONROLIB? • Discussion of all APIs • Writing your first program …very easy • Modifying the Makefile • How do I add my contribution to CONROLIB? • Why use static libaries? • Future Work on CONROLIB • Demo

  4. The Basics: What is the new CONRO Hardware? • Atmega128 Low power MCU • All peripherals on chip (ADC, Timers, UART) • 4Mhz , 128Kb Program Flash, 4KB RAM • MICA2DOT = MCU + Wireless Chip + Serial Flash For Data Logging • Board under DOT -> IR LEDs / Transistor • Battery Powered

  5. Main Functionalities of CONRO’s Hardware Communicate using Software UART and Infrared Control 2 Servo Motors Measure Infrared Intensity at each port Control Each ports TX LED and Read Digital from Rx Send Debug Info to a PC Host Wireless Communication

  6. What is the new development environment? Serial Programmer PC Host with Cross Compiler CONRO Atmega128

  7. What is the new development environment?...contd. • Cross Compiler is avr-gcc + avr-linker + avr-binutils • Both *nix & Windows environments available. Bin-Utils converts assembly to Intel hex file C Code Avr-gcc UISP/Avrdude CONRO

  8. Where can I get this software environment? • Unix/Linux : http://www.isi.edu/~weiye/system/guide/avrtools.html • Note: instructions are old download latest versions of gcc, avr-libc, binutils, uisp. • Windows • http://sourceforge.net/projects/winavr • Instructions are available with s/w • NOTE! : Must have permissions for accessing /dev/ttyS0 (unix) or COM1 in Windows

  9. What is CONROLIB? • A precompiled static library with host of standard C APIS. • CONROLIB = libconro_lib.a + header files. That's all you need to program CONRO! • The library has API's for : • Reading Sensor from each port • Debug through printf to a host pc running hyperterminal(9600 8N1) in • Software UART for inter CONRO communication • Individual control of each port TX and reading the digital value of • Each port RX. • Controlling pitch and yaw servo

  10. Discussion of all APIs • 1 Header file for each oval functionality • adc.h • debugPrintf.h • portControl.h • servo.h • uartsw.h

  11. Discussion of all APIs • Uartsw (For Infrared Communication) • #include “uartsw.h” • int sendByte(uint8_t u08) • int receiveByte(void) • #define UARTSW_RX_BUFFER_SIZE 0x20

  12. Discussion of all APIs • Servos • #include “servo.h” • initializeServos(); • void controlServoNorth(uint16_t angle); • void controlServoSouth(uint16_t angle);

  13. Discussion of all APIs • Controlling PORT LEDS(TX) and reading a digital value from RX • #include “portControl.h” • initializePorts(); • void northPortTx(uint8_t status); //status =1 TX => ON status = 0 =>OFF. • uint8_t readNorthRx(void); //returns a HIGH or LOW

  14. Discussion of all APIs • Reading ADC sensor: intensity of received IR on any RX port • #include “adc.h” • initializeAdc(); • uint16_t readSensorNorth(void);

  15. Discussion of all APIs • Using printf to send data to PC: Hyperterminal • #include “debugPrintf.h” • initializeDebug(); • Printf(“Howdy CONRO\n\r”); OR • Printf(“value of angle is %d\n\r”,angle);

  16. Writing your first program • Example :you want to move the servo • Make any directory say.. testConro • mkdir testConcro • cd testConro • tar xvzf CONRO.tar.gz • Vi/emacs demo.c

  17. Writing your first program #include “servo.h” Int main(void) { initializeServos();//initiallize servo controlServoNorth(300);//servo middle return 1;//make sure u write return }

  18. Writing your first program To clean testConro>$ make clean To compile testConro>$ make Switch on CONRO ,Connect the programming cable testConro>$ make flash You’re done!

  19. Modifying the Makefile • Currently SRCS = demo.c OBJS = demo.o • Change to SRCS = cfile1.c cfile2.c OBJS = cfile1.o cfile2.o

  20. How do I add my contribution to CONROLIB? • U just made a cool *.o u want to add to libconro_lib.a • USE CVS! Do not overwrite the old library • Compile ure code to obj(-c option) do NOT link • avr-gcc –mmcu=atmega128 –c blah.c • ar qv libconro_lib.a blah.o • ranlib libconro_lib.a • Make a header file with ure API in it. Put header file in includes dir and update libconro_lib.a

  21. Why use static libaries? • Precompiled: Saves time • If a bug fix is found you only have to update 1 file ! • Insulates you from hardware. Don’t worry about hardware dependant C code • Note: only relevant object code is linked

  22. Future Work on CONROLIB • Modify APIs? • Wireless API • API code is stable according to me but bugs could still be lurking around. Report anything unusual to me • Fixed point Math Library :Speed and Accuracy

  23. Demo • How To install Winavr? • How To use it? • Installing CONROLIB • Running a Program

  24. HAVE FUN !

More Related