background image

ThinkLABS 

 

           

 

 

© TRI Technosolutions Pvt Ltd                                             Page 

63

 of 

129

                                             

http://thinklabs.in

 

 

 

Text Editor (programmer’s Notepad) 

Step 1:

 Select Programmer’s Notepad from Start menu->Programs->Win-avr->Programmers Notepad. 

 

Step 2:

 Type your code here and save the file as shown below: 

Summary of Contents for UNIBOARD V1.1

Page 1: ...rogramming TRI Technosolutions Pvt Ltd THINKLABS UNIBOARD V Licensed by Open platform for Embedded and Real Time Systems Programming TRI Technosolutions Pvt Ltd OARD V1 1 USER GUIDE 4 7 2009 Open platform for Embedded and Real Time Systems Programming ...

Page 2: ...recautions to be taken 12 Pre requisites 12 Hardware Connections 13 Features 14 Board Features 14 Controller Features 15 Setting up the Board configuration 16 Board Description 16 Atmega128 controller 16 Atmega8 controller with the firmware for programming through USB 16 I2C and RTC DS1307 with Backup Battery 16 Analog sensors Joystick and LDR 16 Buzzer 16 Onboard Motor Driver 16 External power 17...

Page 3: ...tions for Windows OS 39 WinAVR Includes avr gcc avr binutils avrdude 39 Installing USB drivers for uNiBoard 44 Programming the Board 48 Getting Started on Linux 48 Getting Started on Windows 62 Text Editor programmer s Notepad 63 Compile the code and program the board on Windows Command Prompt 67 Using hyper terminal of windows 75 Getting Started with RTOS uC OS II on Windows OS 79 uC OS II Hardwa...

Page 4: ...n ATmega128 pin connections 119 Buzzer section 120 Joystick and connectors section 120 LCD section 121 LDR section 121 LEDs section 121 Motor Driver section 122 Power supply section 122 RTC section 122 Sensor port section 123 Switches section 123 UART section 123 USB programmer section Courtesy http www fischl de usbasp 124 Licensing terms 125 Bill of Materials BOM 126 Appendix A References 128 Ap...

Page 5: ...lf supports protocols like SPI I2C on board I2C based RTC UART dual programmable UART which can be used for multi board communication Additionally the board also features an on board motor driver which allows to control up to two DC motors bidirectionally External supply if required for the motors can be provided with appropriate hardware configuration settings The board along with its content ric...

Page 6: ...with the peripherals listed below uNiBoard development board 1 unit 16x2 LCD 1 unit Serial cable DB9 1 unit USB cable 1 unit FRC connector cables 2 units CD consisting of uNiBoard user manual based on Linux Ubuntu Windows essential software packages and sample codes RTOS non OS applications 1 unit Pouch for storage 1 unit ...

Page 7: ...board s peripherals LCD UART LED s Buzzer and Joystick Testing the Board on Windows OS Follow the steps to confirm if the uNiBoard is OK STEP 1 Connect the LCD on the Board refer to section Hardware connections STEP 2 Use FRC cable to connect open LED port and Port C STEP 3 Using the serial cable connect uNiBoard to the PC STEP 4 If you are using Windows OS then you need install the USB drivers fo...

Page 8: ...TRI Technosolutions Pvt Ltd Page 8 of 129 http thinklabs in STEP 8 Select File menu New Connection then Enter Name for connection and click OK STEP 9 Select the COM Port where you have connected the serial cable ...

Page 9: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 9 of 129 http thinklabs in STEP 10 Select the settings as given below for this test program STEP 11 Select Apply and then OK ...

Page 10: ...ectly installed you should be able to see a game of SNAKE modified as well as play using the Joystick While the program is running you will also be able to see the SCORE being displayed on the LCD along with the version of the uNiBoard that you are currently using While the SNAKE eats up food you will be able to hear the buzzer Every time a new food is generated you will see the LEDs glowing there...

Page 11: ...install the USB drivers you don t need to do that at all since Linux kernel has those drivers inbuilt STEP 3 Open the Gtkterm refer to the sub section Installing Software for Linux OS STEP 4 Configure the Gtkterm to baud rate speed to 115200 parity to none and stop bits to 1 refer to the sub section Gtkterm Configurations for setting the Baud rate Parity Stop bits STEP 5 Turn ON the Board STEP 6 O...

Page 12: ...priate knowledge since locking the fuse section might render the board useless Do not program the Board while you are using SPI lines for communication which might also render the board useless Pre requisites Before you start you are expected to have some knowledge of AVR microcontrollers and its software tools up to a preliminary level We have not discussed the AVR architecture Datasheet is the b...

Page 13: ...h the PC The serial cable is optional as we are not using it for programming the hex file into the Atmega128 chip For any UART related activities having the serial cable is a must Programming Jumper Programming connector for USB programmer LDR Jumper 8 Sensor inputs Program Enable UART0 Selection switch USB power switch Test LEDs PORT Ext Power Connector UART 0 USB Port Serial Port UART 1 Motor 1 ...

Page 14: ...kup Battery Analog Joystick with centre click LDR sensor Buzzer beneath the processor board Onboard Motor Driver L293D LEDs for USB programmer ready indicator Programming status indicator and Power ON indicator Test LEDs open for interface with any PORT Open interface Ports such as PORTF ADC PORTC JTAG interface External JTAG hardware required USB Port for programming the Board Dual programmable U...

Page 15: ...e and Capture Mode Real Time Counter with Separate Oscillator Two 8 bit PWM Channels 6 PWM Channels with Programmable Resolution from 2 to 16 Bits 8 channel 10 bit ADC Byte oriented Two wire Serial Interface Dual Programmable Serial USARTs Master Slave SPI Serial Interface Programmable Watchdog Timer with On chip Oscillator Power on Reset and Programmable Brown out Detection External and Internal ...

Page 16: ... data are transferred serially through an I2C bidirectional bus The clock calendar provides seconds minutes hours day date month and year information Compensation Valid up to 2100 No special hardware configuration is required as it is mounted on our board and internally connected to the processors pins Analog sensors Joystick and LDR The Joystick Analog joystick used in PS2 consoles is connected t...

Page 17: ...eft open for communication between two Boards LCD LCD for uNiBoard is using 4 data lines 2 control lines and WR of LCD is connected to GND DATA LINES PA4 PA5 PA6 PA7 CONTROL LINES PA0 for RS PA2 for LCD EN Push Buttons External Interrupts SW3 INT6 SW4 INT7 General Purpose switch SW1 PD6 Active Low SW2 PD7 Active Low Reset SW Selection Switches USB Power Pressed External power Depressed Joystick Pr...

Page 18: ...tch position to depressed There is another jumper setting which you would need to do in order to take the LDR out of the circuit This configuration will be discussed while discussing jumper settings Program Enable Pressed UART0 Depressed While programming the board this is one switch that you should never forget to press failing which avrdude programming software will flash an error saying target ...

Page 19: ...ven below along with the manner in which we have utilized the port pins in case of uNiBoard Jumper Settings Apart from the configuration switches discussed above the jumper settings is another source of arriving to wrong conclusions provided that they have not been set correctly SPI lines LCD DATA UART0 1 I2C RTC PORTC Open Interface on FRC connector UART1 Max232 16 MHz Crystal MOTOR 2 MOTOR 1 MOT...

Page 20: ...shown in the figure below LDR jumper You can use them as per your application requirements In case you are connecting external sensors at the sensor port you will need to change the position of the LDR jumper so as to disassociate it from the circuit as shown below LDR Jumper 4 SPI Lines Programming Jumper Joystick External sensor Selection USB Power Selection Program Enable UART0 Selection ...

Page 21: ... be retained in the position shown below under all cases except when using the SPI communication lines While using the SPI communication lines the jumper can be either removed or placed in the adjoining pins provided which is NC No Connection as shown below The latter is a safer option to ensure that you do not misplace the jumper Position of jumper while using LDR sensor Position of jumper using ...

Page 22: ...scussing for Ubuntu Linux involves downloading packages through the synaptic manager Hence you need to have an internet connection in place before you begin with this of deb or rpm packages of the listed software and install it on your system following section describes the installation of the software packages on Ubuntu Linux Gedit Editor The Gedit text editor might be installed already on your s...

Page 23: ...kLABS TRI Technosolutions Pvt Ltd STEP 2 Enter root password STEP 3 It will show a list of all dependencies Page 23 of 129 It will show a list of all dependencies installed as shown below http thinklabs in ...

Page 24: ...ess ALT F2 and type gedit and press enter to open the Gedit application The Gedit application will open Embedded Terminal a gedit plug in which fits a terminal in the gedit window through whic execute Linux commands compile program using the MAKE utility and download it on to our chip Close all gedit application Open terminal and type sudo aptitude install gedit plugins and press en http thinklabs...

Page 25: ...chnosolutions Pvt Ltd STEP 2 Enter root password STEP 3 It will show a list of all dependencies installed as shown below Page 25 of 129 It will show a list of all dependencies installed as shown below http thinklabs in ...

Page 26: ...nter to open the Gedit application STEP 5 The Gedit application will open Page 26 of 129 Press ALT F2 and type gedit and press enter to open the Gedit application The Gedit application will open http thinklabs in Press ALT F2 and type gedit and press enter to open the Gedit application ...

Page 27: ...n gedit open Edit menu preferences and goto plugins tab STEP 7 Select Embedded Terminal and press close button Page 27 of 129 Then in gedit open Edit menu preferences and goto plugins tab Select Embedded Terminal and press close button http thinklabs in ...

Page 28: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 8 Go to the View menu and select Bottom pane Page 28 of 129 Go to the View menu and select Bottom pane http thinklabs in ...

Page 29: ...nkLABS TRI Technosolutions Pvt Ltd Compiler avr gcc STEP 1 Open terminal and type sudo aptitude install Page 29 of 129 Open terminal and type sudo aptitude install gcc avr and press enter http thinklabs in ...

Page 30: ...Technosolutions Pvt Ltd STEP 2 Enter root password STEP 3 It will show a list of all dependencies install as shown below Page 30 of 129 It will show a list of all dependencies install as shown below http thinklabs in ...

Page 31: ...andard C library for Atmel AVR development STEP 1 Open terminal and type sudo aptitude install avr Page 31 of 129 libc Standard C library for Atmel AVR development Open terminal and type sudo aptitude install avr libc and press enter http thinklabs in ...

Page 32: ...Technosolutions Pvt Ltd STEP 2 Enter root password STEP 3 It will show a list of all dependencies install as shown below Page 32 of 129 It will show a list of all dependencies install as shown below http thinklabs in ...

Page 33: ...trollers STEP 1 Open terminal and type sudo aptitude install avrdude and press Page 33 of 129 software for programming Atmel AVR microcontrollers Open terminal and type sudo aptitude install avrdude and press enter http thinklabs in software for programming Atmel AVR microcontrollers enter ...

Page 34: ...compatible serial terminal STEP 1 Open terminal and type sudo aptitude install gtkterm and press enter Page 34 of 129 It will show a list of all dependencies install as shown below Gtkterm is analogous to Windows HyperTerminal which is useful for serial commutations between PC It is a VT102 compatible serial terminal Open terminal and type sudo aptitude install gtkterm and press enter http thinkla...

Page 35: ...chnosolutions Pvt Ltd STEP 2 Enter root password STEP 3 It will show a list of all dependencies installed as shown below Page 35 of 129 It will show a list of all dependencies installed as shown below http thinklabs in ...

Page 36: ...EP 4 Press ALT F2 and type gtkterm and press enter to open the Gtkterm application Page 36 of 129 d type gtkterm and press enter to open the Gtkterm application http thinklabs in d type gtkterm and press enter to open the Gtkterm application ...

Page 37: ...STEP 2 Go to Configuration Menu and choose Port Page 37 of 129 Gtkterm Configurations for setting the Baud rate Parity Stop bits Press ALT F2 and type gtkterm and press enter to open the Gtkterm application Configuration Menu and choose Port http thinklabs in Stop bits Press ALT F2 and type gtkterm and press enter to open the Gtkterm application and click on Run ...

Page 38: ...red for the UART STEP 8 Select the Flow control to none STEP 9 Click on OK Page 38 of 129 Select the Port dev ttyS0 if you have connected to the serial communication Baud rate as per in your code you have configured Select the Parity as per in your code you have configured for the UART as per in your code you have configured for the UART Select the Bits as per in your code you have configured for ...

Page 39: ...e this package follow the steps given below Step 1 Run the file to install the package Page 39 of 129 oftware Installations for Windows OS gcc avr binutils avrdude Copy the software packages from the uNiBoard contents on CD or download latest version of WinAVR from After you have this package follow the steps given below un the file to install the package http thinklabs in or download latest versi...

Page 40: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 40 of 129 http thinklabs in Step 2 Select the language and press OK ...

Page 41: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 41 of 129 http thinklabs in Step 3 click on Next Step 4 Click on I Agree ...

Page 42: ...labs in Step 5 Type the destination Folder where you want to install WinAVR and click on Next Step 6 Check on all i e Install files Add Directories to path and Programmer s Notepad and click on Install Step 7 It will display as shown below and then click on finish ...

Page 43: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 43 of 129 http thinklabs in ...

Page 44: ...s for uNiBoard STEP 1 Insert the uNiBoard USB cable to PC STEP 2 If the drivers are not installed then it will display the installation wizard as shown below STEP 3 Select the options as install from a list or specific location Advanced and click on next It will display options as shown below ...

Page 45: ...ions Pvt Ltd Page 45 of 129 http thinklabs in STEP 4 Click on Browse and select the drivers from the CD UNIBOARD CONTENTS directory path as UNIBOARD CONTENTS UNIBOARD_DRIVERS WINDOWS usbasp and click on OK STEP 5 Click on Next ...

Page 46: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 46 of 129 http thinklabs in STEP 6 Give the same path of drivers and click on OK ...

Page 47: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 47 of 129 http thinklabs in STEP 7 Click on Finish After the drivers are installed you are ready to program the Board ...

Page 48: ...ave the hex file to be loaded into the flash section of the microcontroller For generating the hex file you have to write an error free code Then using USBasp firmware on Atmega8 microcontroller the Atmega128 microcontroller The following section will guide you on how to program using uNiBoard We will write a first program to test LEDs can be connected various test PORTs on UNiBoard using 5 we wil...

Page 49: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 3 Save the File as Xfilename c Page 49 of 129 Save the File as Xfilename c http thinklabs in ...

Page 50: ...TE are in script file called as Makefile in your working Page 50 of 129 NOTE Make is the Utility which calls all the compiler related options which are in script file called as Makefile in your working project directory http thinklabs in ompiler related options which ...

Page 51: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 5 Write your code Page 51 of 129 http thinklabs in ...

Page 52: ... 52 of 129 http thinklabs in STEP 6 Save the file STEP 7 Edit the Makefile in this file change TARGET Xfilename with no extensions and no quotes If you put any extensions it won t work NOTE Xfilename indicates any filename that a user will use ...

Page 53: ... in the project dir Page 53 of 129 On Linux based systems you can use one of the makefiles of the sample codes marked as by renaming it to Makefile failing which you will get an error saying No rule to make terminal goto the Project directory and type make clean the previously compiled files in the project directory http thinklabs in On Linux based systems you can use one of the makefiles of the s...

Page 54: ...osolutions Pvt Ltd STEP 10 Type make all this will compile the sourc code Page 54 of 129 this will compile the source file and generate hex file if http thinklabs in e file and generate hex file if there are no errors in ...

Page 55: ...inkLABS TRI Technosolutions Pvt Ltd STEP 11 type make program Page 55 of 129 make program this will burn the hex into the microcontroller http thinklabs in this will burn the hex into the microcontroller ...

Page 56: ...g must be changed only if required The ATmega128 has three fuse bytes referred as High Fuse Byte Low Fuse Byte and Extended Fuse Refer the ATmega128 datasheet for information on what the fuse bits are To cut things short configure various options like EEPROM SAVE Programming Enable startup time clock source etc The following Table represents Extended Fuse Byte BIT No Description 7 6 5 4 http think...

Page 57: ...g enabled CKOPT 4 Oscillator options 1 unprogrammed EESAVE 3 EEPROM memory is preserved through chip erase 1 unprogrammed EEPROM not preserved BOOTSZ1 2 Select Boot Size 0 programmed BOOTSZ0 1 Select Boot Size 0 programmed BOOTRST 0 Select Reset Vector 1 unprogrammed The following Table represents Low Fuse Byte Low Fuse Byte BIT No Description Default Value BODLEVEL 7 Brown out detector trigger le...

Page 58: ...will be displayed as shown below Page 58 of 129 1 Select Clock source 0 Select Clock source The Make utility allows programming the fuse bits The following procedure will terminal type make readfuses This will read the fuse setting currently present on the The output will be displayed as shown below http thinklabs in 0 programmed 1 unprogrammed procedure will help you configuring terminal type mak...

Page 59: ...M MEMORY MIGHT BE LOCKED FOR WRITING Page 59 of 129 in the above picture as per the fuse setting HFUSE LFUSE and EFUSE are the terminal type make fuses This will read the fuse setting currently present on the board TH THE FUSE BITS UNLESS YOU ARE VERY SURE OF WHAT EFFECT IT WOULD HAVE FAILING WHICH THE PROGRAM MEMORY MIGHT BE LOCKED FOR WRITING http thinklabs in HFUSE LFUSE and EFUSE are the termi...

Page 60: ...n the embedded terminal type make readfuses to verify that fuse bit have been saved Page 60 of 129 terminal type make readfuses to verify that fuse bit have been saved http thinklabs in terminal type make readfuses to verify that fuse bit have been saved ...

Page 61: ...ThinkLABS TRI Technosolutions Pvt Ltd As shown below the fuse setting have been modified successfully Page 61 of 129 fuse setting have been modified successfully http thinklabs in ...

Page 62: ...IBOARD_SAMPLE_CODES UNIBOARD CONTENTS UNIBOARD_SAMPLE_CODES Or you can download it from our website at link Page 62 of 129 Getting Started on Windows been given in the CD folder named UNIBOARD_SAMPLE_CODES NON_RTOS and UNIBOARD_SAMPLE_CODES RTOS oad it from our website at link http thinklabs in download http thinklabs in ...

Page 63: ...ions Pvt Ltd Page 63 of 129 http thinklabs in Text Editor programmer s Notepad Step 1 Select Programmer s Notepad from Start menu Programs Win avr Programmers Notepad Step 2 Type your code here and save the file as shown below ...

Page 64: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 64 of 129 http thinklabs in STEP 3 Save the file as anyfilename c ...

Page 65: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 65 of 129 http thinklabs in STEP 4 You can view the line numbers by selecting view menu Line Numbers ...

Page 66: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 66 of 129 http thinklabs in ...

Page 67: ... Page 67 of 129 http thinklabs in Compile the code and program the board on Windows Command Prompt STEP 1 Open the command prompt by selecting Start Run and type cmd STEP 2 It will display the Command prompt and goto your project directory ...

Page 68: ...e the Makefile in your project directory In case of windows you would find a file named Makefile_WINDOWS which you can rename as Makefile Make sure that you have only a single Makefile in your working directory STEP 4 Edit the Makefile and set Target filename of your C file and save the file ...

Page 69: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 69 of 129 http thinklabs in STEP 5 In command prompt window type command as make clean and press enter ...

Page 70: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 70 of 129 http thinklabs in STEP 6 This will remove all previously files created due to compilation as shown below ...

Page 71: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 71 of 129 http thinklabs in STEP 7 type make all and press enter ...

Page 72: ...ABS TRI Technosolutions Pvt Ltd Page 72 of 129 http thinklabs in STEP 8 This command will compile the file and generate a Hex file Type dir and press enter and check if there hex file generated as shown below ...

Page 73: ...inkLABS TRI Technosolutions Pvt Ltd Page 73 of 129 http thinklabs in STEP 9 For loading the compiled output to the board the board i e burning the hex file into the Atmega128 type command as make program ...

Page 74: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 74 of 129 http thinklabs in STEP 10 press enter ...

Page 75: ...e 75 of 129 http thinklabs in Using hyper terminal of windows STEP 1 Run Hyper Terminal start menu all programs accessories Communications HyperTerminal STEP 2 Type name for make new connection STEP 3 Select the serial port usually it is COM1 ...

Page 76: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 76 of 129 http thinklabs in ...

Page 77: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 77 of 129 http thinklabs in STEP 4 Select the Baud rate 9600 Data bits 8 bits parity none stop bits 1 and flow control none as shown below ...

Page 78: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 78 of 129 http thinklabs in STEP 5 You can even save this connection from File save so that you need not set all the settings again ...

Page 79: ...oftware Architecture Before starting of with the uC OS II programming you need to know its file structure i e how the uC OS II source code and its ports are structured The diagram below gives an idea of the way in which these files have been maintained For further information on this refer to MicroC OS II The Real Time Kernel by Jean Labrosse ...

Page 80: ... kernel code and utilizes kernel API s and functions exported by the OS for the users of the RTOS Code Compile and program the RTOS uC OS II programs on Linux OS NOTE You Should have the required software tools i e text editor compiler programmer and serial terminal as shown in the section sub section Software Installations for Linux OS Also refer to the sub section Getting started on Linux STEP 1...

Page 81: ...rminal and select change directory Page 81 of 129 program directory from Gedit Embedded terminal using cd on Bottom terminal and select change directory refer to the sub section getting started on Linux http thinklabs in using cd command or right click section getting started on Linux ...

Page 82: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 5 Type make clean on Gedit Embedded terminal Page 82 of 129 on Gedit Embedded terminal http thinklabs in ...

Page 83: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 6 Type make all on Gedit Embedded terminal Page 83 of 129 on Gedit Embedded terminal http thinklabs in ...

Page 84: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 7 Type make program on Gedit Embedded terminal Page 84 of 129 on Gedit Embedded terminal http thinklabs in ...

Page 85: ...RI Technosolutions Pvt Ltd STEP 8 Enter the root password to program the Board Page 85 of 129 Enter the root password to program the Board and press enter if prompted http thinklabs in and press enter if prompted ...

Page 86: ...RI Technosolutions Pvt Ltd STEP 9 Turn OFF the uNiBoard Page 86 of 129 after the program has been loaded successfully as shown below http thinklabs in after the program has been loaded successfully as shown below ...

Page 87: ...solutions Pvt Ltd STEP 10 Open Gtkterm refer to the sub Stop bits Page 87 of 129 refer to the sub section Gtkterm Configurations for settin http thinklabs in section Gtkterm Configurations for setting the Baud rate Parity ...

Page 88: ...ThinkLABS TRI Technosolutions Pvt Ltd STEP 11 Turn ON the uNiBoard and Page 88 of 129 the uNiBoard and Output will be displayed as shown below on Gtkterm http thinklabs in on Gtkterm ...

Page 89: ...ODES RTOS and copy it your disk STEP 3 Go to the RTOS directory that you have just loaded on your disk Select one of the sample code e g 3_SEMAPHORES Rename the Makefile_WINDOWS to Makefile in the current example directory STEP 4 Open the Makefile using Text Editor and search for the TARGET label In this example it is event_sem c so assign TARGET event_sem as shown below at line 47 NOTE 1 In Makef...

Page 90: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 90 of 129 http thinklabs in ...

Page 91: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 91 of 129 http thinklabs in ...

Page 92: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 92 of 129 http thinklabs in ...

Page 93: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 93 of 129 http thinklabs in ...

Page 94: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 94 of 129 http thinklabs in ...

Page 95: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 95 of 129 http thinklabs in ...

Page 96: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 96 of 129 http thinklabs in ...

Page 97: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 97 of 129 http thinklabs in STEP 5 Open event_sem c from the current directory and the code will be displayed as shown below ...

Page 98: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 98 of 129 http thinklabs in ...

Page 99: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 99 of 129 http thinklabs in ...

Page 100: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 100 of 129 http thinklabs in ...

Page 101: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 101 of 129 http thinklabs in ...

Page 102: ...named as void MyTask void pdata This code is initializing the timer0 i e required by scheduler for correct time delays and this macro named as CPU_CLOCK_HZ and OS_TICKS_PER_SEC are defined in the file os_cfg h as shown in next step STEP 6 Open os_cfg h from the current directory and the code will be displayed as shown below ...

Page 103: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 103 of 129 http thinklabs in ...

Page 104: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 104 of 129 http thinklabs in ...

Page 105: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 105 of 129 http thinklabs in ...

Page 106: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 106 of 129 http thinklabs in ...

Page 107: ...R_SEC which should be assigned as 61 NOTE 2 If you want to use any features API s of the uC OS II enable it i e for example in this code we have used semaphore so we need to enable the API in os_cfg h file as shown at line 105 macro named OS_SEM_EN should be set to 1 If you don t do this then compiler will prompt for undefined reference for that API call STEP 7 Go to prompt and type make clean NOT...

Page 108: ...s in make No rule to make target home XYZUSER ucos II software uCOS II Source ucos_ii c needed by ucos_ii d Stop Then you need to remove d files from current program directory Type rm d and then try to use make clean command again STEP 8 Go to prompt and type make all ...

Page 109: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 109 of 129 http thinklabs in STEP 9 Go to prompt and type make program ...

Page 110: ... Ltd Page 110 of 129 http thinklabs in STEP 10 Turn OFF the Board s Power Switch STEP 11 Open the HyperTerminal utility refer to section Using Hyper terminal of Windows STEP 12 Now turn it ON The output will be displayed as shown below ...

Page 111: ...11 of 129 http thinklabs in You can also download the latest uC OS II source code from Micrium website link as http www micrium com products rtos ucos ii_download html and ports for Atmel s Mega series from http www micrium com atmel ATmega html ...

Page 112: ...nected the FRC cable correctly to the port where you are planning to interface the LEDs UART Make sure that you are configuring the correct UART port Generally for serial communication you would be using UART 1 since DB9 connector is available only on UART 1 Make sure that baud rate that you are using is the same at both the ends Make sure that you have not opened multiple Gtkterm application or H...

Page 113: ...e enabled CH bit in RTC configuration 0x00 RTC s memory area Make sure that you have working backup battery for correct time even if board is power off SPI Make sure that your connections are proper you need to remove the program jumper and use the berg connector to connect the wire to another SPI device Make sure that the GND points of the master and slave have been connected Motor drivers Make s...

Page 114: ...solution of timer So for timer to overflow for every 1ms we need to load the count 256 15 241 as 0 000064 15 0 96 msec 1msec The clock is displayed on LCD and UART 3 Switches The Switches on the uNiBoard are connected to general purpose port pins of the controller So you can use this switches for reading the inputs from the user The SW1 is connected to PORTDS s PIN7 and SW2 is connected to PORTD s...

Page 115: ...re connections are as follows LCD control lines Enable PD2 R W Hardwired GND RS PD0 LCD data lines PD4 PD7 Therefore LCD is initialized using 4 line mode The given LCD library contains the API s for printing character string values decimal on LCD changing the LCD positions clearing the LCD screen 7 UART There are two UART s on controller On the uNiBoard UART1 is used to connect to the RS232 port a...

Page 116: ...rt what the code is meant for and what sort of output you should expect to be demonstrated while you are running a particular sample code 1 Multitasking random This is a sample program that displays random numbers on the screen The number is placed on the random positions on the screen Also displays the CPU utilization and number of tasks running on the Serial terminal 2 Snake This is a game for p...

Page 117: ...d this can be seen on serial terminal 5 Mail Box In this sample code the message is been updated by many tasks using MailBox while print task waits till the Message has been written and after that Message is printed by the print task So this shows how the message is not allowed to be modified by the other task once task owns the resource Message The higher priority task is the print task which wil...

Page 118: ... yourselves to these activities and explore the board s power further using accessories like SD MMC card interface SPI based or Ethernet interface SPI based You can interface these add http thinklabs in shop in a short while Embedded File System library can be done using the SD MMC card interface which comes along with Moreover if you feel that you want to make the board Ethernet enabled you shoul...

Page 119: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 119 of 129 http thinklabs in uNiBoard v1 1 Schematic Controller section ATmega128 pin connections ...

Page 120: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 120 of 129 http thinklabs in Buzzer section Joystick and connectors section ...

Page 121: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 121 of 129 http thinklabs in LCD section LDR section LEDs section ...

Page 122: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 122 of 129 http thinklabs in Motor Driver section Power supply section RTC section ...

Page 123: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 123 of 129 http thinklabs in Sensor port section Switches section UART section ...

Page 124: ...ThinkLABS TRI Technosolutions Pvt Ltd Page 124 of 129 http thinklabs in USB programmer section Courtesy http www fischl de usbasp ...

Page 125: ...nse for more details refer License txt in CD content which has the philosophy of Share Remix Reuse anyone is allowed to produce copies of the board to redesign it or even to sell boards that copy the design You don t need to pay a license fee to the ThinkLABS team or even ask permission However if you republish the reference design you have to credit the original group And if you tweak or change t...

Page 126: ... 1 3 Battery back up Battery 3V button cell 1 4 Crystal 16 MHz for Atmega128 1 12 MHz for usbasp 1 32 768 KHz for RTC 5 Sensors LDR 1 PS2 Analog Joystick 1 6 Sockets 16 pin IC base 1 Battery cell holder 1 7 LCD 16x2 Alphanumeric LCD 1 8 Cables Serial cable DB9F to DB9M 1 USB Cable 1 FRC Cables 2 9 LED Red LED SMD 11 10 Buzzer 5V Buzzer 1 11 Connectors DC Jack PCB mountable 1 PTR connector 3 DB9 Ri...

Page 127: ...e 1 13 Resistors 1K 3 10K 2 270K 2 330 Ohms 2 2K2 2 4K7 2 68 Ohm 2 1K SMD SIP 2 10K POT 1 14 Capacitors 100uF 10V 1 4 7uF 50V 1 470uF 16V 1 220uF 16V 1 15pF 2 22pF 2 0 1uF 15 0 22pF 2 15 Transistors 2N2222 1 16 Switches Power switches Push to ON 3 SMD Micro key 5 Two pin jumpers 2 17 Metal spacers 3x15 4 ...

Page 128: ...avrfreaks net www fishl de usbasp www maxim ic com http en wikibooks org wiki Embedded_Systems Atmel_AVR Books 1 MicroC OS II by JEAN J LABROSSE 2 Programming Customizing The AVR Microcontroller By Dhananjay V Gadre 3 Embedded C Programming and the Atmel AVR By Barnett and Cox 4 AVR RISC Microcontroller Handbook By Atmel ...

Page 129: ...ces and Support Our website support For any technical queries related to uNiBoard http www thinklabs in forums For articles activities and updates related to uNiBoard http www thinklabs in resources For purchasing uNiBoard accessories or other related components http www thinklabs in shop ...

Reviews: