Yantrik Automation


Y A Development Board
Version- Ya1.01

User Manual www.yantrik.in

The Yantrik Automation Development Board is a handy, battery-powered microcontroller based board which is very ideal for personal, educational and research projects. Based on the Atmel ATmega8535/16/32 microcontroller, the Yantrik Automation Development Board includes 8/16/32K of FlashRAM, outputs for four DC motors or two stepper motors, inputs for a large variety of analog and digital sensors, and a 16*2 alphanumeric LCD screen and also supports computer communication using MAX232 IC. The Yantrik Automation Development Board runs BASCOM-AVR, a cross-platform, specialized AVR version of the BASIC programming language. It also supports the embedded C compiler for controllers of AVR family.

Copyright 2010: Yantrik Automation 1

Yantrik Automation

Section Name 1. Specifications and Feature 2. Ports and Connector Details 3. Quick Start 4. Programming in BASIC language 5. Precautions 6. Troubleshooting

1. Specifications and Features
The YA Development Board Features are: • 40 Pin Atmel ATmega16/32 microcontroller with internal system clock upto 8 MHz and externally upto 16 MHz • • • • • • • • • 16/32 KB FlashRAM memory for programs 1/2 KB of SRAM 512/1024 Bytes of EEPROM One 4x1 Pin SPI Relimate Header Eight 3x1 Pin Relimate header inputs for 8 analog sensors One 16 Pin header to connect 16*2 alphanumeric LCD Two onboard L293D drivers for motors 7805 Voltage regulator with heat sink Dual power input options (Through molex connector or through DC Jack)

• Two programmable Micro-Switches Copyright 2010: Yantrik Automation 2

Power will flow to voltage regulators only when the power switch is in down position. Be sure to use ONLY ONE power source. reset switch should be kept in up position Copyright 2010: Yantrik Automation 3 . power output from this jack may vary.yantrik. Ports and Connectors Details Here is the detailed information of the Yantrik Automation Development Board – Power Switch. In execution mode. 7805 will work only when the input power is at least 7 volts. Reset Switch: This switch is used to reset the program counter to zero and restart the program execution. Reset switch is needed to be kept in down position. While downloading the program to the chip. Power supply can be given either through the Power Connector or through the DC Jack. Regulated 5 Volts Power Output: This connector can be used to provide power to any external device. Taking into consideration.Yantrik Automation www. 7805 and Power Connector: Power Switch is used to turn on the power supply of the board.in Programmable LEDs Two DPDT switches (one for power on/off and one for reset) MAX 232 Level converter for RS232 communication One 3x1 Pin relimate header for RS2332 communication Four 8 Pin bergistick headers (male) from each port of ATmega16/32 Wide input power range from 7 volts to 12 volts at 0.5-2 Amps • • • • • • 2. that the board can only withdraw power up to 2 Amps. 7805 Voltage regulators will regulate the power supply to 5 volts.

Programmable Micro-Switches: These switches are connected with microcontroller and can be used as input device to the microcontroller.6 PortD. For more information on microcontroller. so it is required to use internal pull up registers to use these switches as input device. Connection details of these pins are given below – T1 T2 : : PortD. These connectors can also be used to drive two stepper motors.in LEDs: Four LEDs are provided on the board for the testing purpose. 40 Pin Base for microcontroller: This base is provided to install and remove microcontroller chip easily.7 Each individual LED can be programmed to glow or to blink by programming the corresponding microcontroller pin. 16 Pin Base for L293D Driver ICs: There are two bases provided onboard to use L293D H-Bridge with microcontroller. refer to its datasheet.5 PortC. Connection details of the LEDs and microcontroller pins are given below – LED 1 LED 2 LED 3 LED 4 : : : : PortC. This board supports ONLY L293D Driver. This board supports ONLY two microcontrollers – Atmel ATmega16 and Atmel ATmega32. These LEDs can be programmed to glow. refer to the respective datasheet. These connectors have following configuration – Copyright 2010: Yantrik Automation 4 .Yantrik Automation www. No other H-Bridge IC can be installed instead of L293D.4 PortC.2 PortD. they actually short the corresponding microcontroller pin with GND.3 When these switches are pressed. Both microcontrollers have exactly same pin configuration but they differ in terms of the memory. For more information on L293D. These switches can be used for testing purpose.yantrik. Motor Connectors: The YA Development Board’s four DC motor outputs are located bottom left side of the board by means of molex connectors.

Given below is the connection details of all eight headers with corresponding microcontroller pin – ADC(0) ADC(1) ADC(2) ADC(3) ADC(4) ADC(5) ADC(6) ADC(7) = = = = = = = = PortA.1 PortA.2 PortA.3 PortA. ADC need to be configured and started while working with Analog sensors whereas ADC need to kept off while working with Digital sensor with same Port A.in TERMINAL-1 For Connector 1(left) – PWM Channel Direction Bit For Connector 2(left) – PWM Channel Direction Bit TERMINAL-2 For Connector 1(left) – PWM Channel Direction Bit For Connector 2(right) – PWM Channel Direction Bit = PortD. analog sensors should be on Port A (with ADC started) and digital sensors should be on any other port (with that port in input mode).7 Copyright 2010: Yantrik Automation 5 .4 PortA.7 = Pwm1B = PortD.2 = PortC. i.yantrik.5 PortA.6 = PortD.6 PortA. However types of sensors can be used at a time but they both should be different ports.0 PortA.Yantrik Automation www.6 = Pwm1A = PortD.7 Eight 3 Pin Headers for Sensors: This board provides capability to connect upto eight sensors directly to ADC port of the ATmega16/32.3 = PortC.e.

For other type of LCD this may vary.in RS232 Connector: This connector is provided for RS232 communication.1 16 Pin LCD Header: A 16 Pin header is provided to interface one 16 * 2 Alphanumeric LCD.7 E = Portb.yantrik.4 Db5 = Portb. • Install the drivers of the ISP USB cable Copyright 2010: Yantrik Automation 6 . 2. • Connect the USB cable on USB header on the board and connect it at USB port of the host computer. Pin configuration of RS232 is given below – RX TX = = PortD.0 PortD.Yantrik Automation www.6 Db7 = Portb.2 DB4 to DB7: Data Buses of LCD E: Enable pin of LCD Rs: Register Select of LCD These pin configuration are only for the LCD which is 16 * 2 alphanumeric display. Quick Start Here are the steps to getting started with The YA Development Board – • Connect the power supply to power terminal of the board.5 Db6 = Portb.3 Rs = Portb. Given below are the pin configuration details – Lcdpin = Pin Db4 = Portb. Refer to related datasheet of the LCD incase if you are using a different one.

It is very easy to write. make sure that power is coming to the board and Power LED is glowing. BASCOM uses BASIC programming language. 4. 4. start with following syntax – 1. The register files are stored in the BASCOM-AVR application directory with . disconnect the ISP cable.DAT extension. Define $regfile – instruct the compiler to use the specified register file.It refers to the name of register file. • Open AVRDUDE software and upload the HEX file generated by compiling the program in BascomAVR Software to Flash Option • • Click on Execute button Now.Yantrik Automation www. compile and download the program with BASCOM. Programming in BASIC Language using BASCOM-AVR and Sample codes 4.1 Overview BASCOM – AVR is an IDE based development platform and is developed by MCS Electronics. switch off the power button.in Keep the reset button at down position and switch on the power button. • Switch on the power button to run your program. The board is now ready to download the program from the computer. • • Follow the above steps to burn and run the code on the YA Development Board.2 Basics To write program with Basic language for AVR.yantrik. Copyright 2010: Yantrik Automation 7 . and change the reset button position. Syntax $REGFILE = "name_of_file" “Name_of_file” .

e. 20*2. 20*4 OR 40*4 alphanumeric LCDs.The CONFIG statement is used to configure the various hardware devices and other features of microcontroller. Syntax $CRYSTAL = Value Value . The Lcd provided on the YA Controller Board is of size 16*2 i.A numeric constant defining the Frequency of the crystal. Syntax for Configuring LCD: CONFIG LCD = LCD_type Copyright 2010: Yantrik Automation 8 .Yantrik Automation www. Config . Since we are using Atmega16 Microcontroller. You can configure various types of LCDs with BASCOM like 16*2. $crystal – It defines the clock speed at which you want to run your microcontroller. we will define $regfile= “8535def. We are required to configure the following hardware and features: a) LCD b) ADC c) Timer (a) Configuring LCD BASCOM allows us to configure LCD with ease.dat” 2.dat” ‘this file is loaded for Atmel atmega8535 Note: For Atmega32. Example – $crystal = 4000000 ‘it set the clock speed at 4MHz 3. we will define $regfile= “m32def.yantrik. 16*4. 16 char in one line and total of 2 lines of display.in The register file holds information about the chip such as the internal registers and interrupts addresses.

Rs = Portb. To configure a 16*2 alphanumeric LCD of YA Development Board. Db7 = Portb.6.16 * 1. PRESCALER . REFERENCE = avcc ADC – It defines the Running mode. DB6=PN. 16 * 4. Prescaler = Auto. E = Portb. Reference = Avcc Start ADC (C) Configuring Timers to generate PWM Syntax CONFIG TIMER1 = COUNTER | TIMER | PWM.A numeric constant for the clock divider. See the data sheets for the different modes. the statement is – Config Adc = Single. RS=PN LCD_type – It is the type of LCD you want to configure. E=PN. Db4 = Portb. 16 * 4. Db6 = Portb. PRESCALER = AUTO.5. DB4= PN. the command is – Config LCD = 16*2 Config lcdpin = pin. Config Lcdpin . AVCC or INTERNAL.in CONFIG LCDPIN = PIN.2 (b) Configuring ADC Syntax CONFIG ADC = single. Configuring ADC in BASCOM is also very easy.7. Use AUTO to let the compiler generate the best value depending on the XTAL REFERENCE . Copyright 2010: Yantrik Automation 9 .3. Its value is SINGLE. It can be: 40 * 4. DB5=PN. 16 * 2. DB7=PN.Some chips like the M163 have additional reference options. Db5 = Portb.Override the LCD-PIN select options.Yantrik Automation www. To configure ADC in BASCOM.4.Its value may be OFF.yantrik. 20 * 2 or 20 * 4 or 16 * 1a or 20*4A.

3 . Same way timer 2 can be configured. Valid values are 1.2 // config the LCD pin Copyright 2010: Yantrik Automation 10 . You can select the division of the system clock with this parameter. each one of 8 bit. Configuration files: Config Lcd = 16 * 2 //config the LCD display Config Lcdpin = Pin . again it is very easy task. the statement is – Config Timer1 = Pwm.6 .in PRESCALE= 1|8|64|256|1024. Db7 = Portb.. Rs = Portb. 64. 256 or 1024 PWM .yantrik. COMPARE A (B) PWM – It refers to PWM compare mode.Can be 8. Refer ATmega16/32 datasheet and BASCOM help for more information regarding timers and PWM generation. Files: Header files: $regfile = "8535def. PWM = 8 | 9 |10. PRESCALE .. E = Portb.4 . 9 or 10. 8. Db4 = Portb. Pwm = 8. Db6 = Portb. It can be CLEAR UP or CLEAR DOWN With BASCOM.Yantrik Automation www. To generate PWM. Compare A Pwm = Clear Down. COMPARE A PWM = CLEAR UP| CLEAR DOWN | DISCONNECT COMPARE B PWM = CLEAR UP| CLEAR DOWN | DISCONNECT TIMER1: It is a 16 bit counter. So the above statement is actually generating two PWMs. simultaneously. Prescale = 1. Db5 = Portb. $crystal = 4000000 //set the internal crystal to 4 MHz.The TIMER is connected to the system clock in this case. Compare B Pwm = Clear Down Start Timer1 Timer1 is a 16 bit timer which actually works in two parts. PWM 1A and PWM 1B.dat" // instruct the compiler to use the amtega16 register file. Sample Program defining the header and conf.7 .5 .

Bit.4 Defining Variables To define a variable in BASCOM. the syntax is: Syntax DIM var AS type Var. 4. Prescale = 1 . Double or String Example Dim A as Integer Dim B as String * 8 First statement is defining A variable as integer and second one is defining B variable as String of 8 characters long. Compare B Pwm = Clear Down //configure timer1 . Word. Single. Byte.TIMER0.yantrik.5 Start Command This command is use to start the specified device. Reference = Avcc // config A/D converter Start ADC Config Timer1 = Pwm . COUNTER0 or COUNTER1. Syntax START device Device . To know more about all data types. Pwm = 8 . Other than Integer and String there many data types available in BASCOM.in Config Adc = Single. TIMER1. Long. Prescaler = Auto.Name of Variable Type . to generate pwm Start Timer1 4. AC (Analog comparator power) or ADC(A/D converter power) Example – Start ADC 4. Compare A Pwm = Clear Down . Copyright 2010: Yantrik Automation 11 . Integer.6 CLS Command Clear the LCD display and set the cursor to home.Yantrik Automation www. refer the help provided in BASCOM. WATCHDOG.

in Syntax/ Example – Cls 4.For loop Copyright 2010: Yantrik Automation 12 . while and for. Concept of using these loops is same as using them in other languages like C.yantrik. If – else statement If (condition) then <Statements> else <statements> endif 5. Do until Loop Do <statements> Loop until (condition) 3. While Loop While (condition) <statements> Wend 4.Yantrik Automation www.7 If – Else statement. Loops and Select – case statement BASCOM allows using all types of loops in the program like do. If – elseif – else ladder statement If (condition) then <statements> else if (condition) <statements> else <statements> endif 6. Given below are syntaxes of all loops you can use in BASCOM – 1. Do Loop Do <statements> Loop 2.

offset]) Var .Yantrik Automation www.in For (varname) = (starting point) To (end point) STEP (value) <statements> Next Example of For loop – For A = 1 To 5 STEP 1 Print “Hello” Next 7.The variable in which the value will be stored. Case – Select Statement select case varname case (test1 varname) <statement> case (test2 varname) <statement> case else <statement> End select 4. This command retrieves the analog value from channel 0-7 of port A. in above example.yantrik. Example p = Getadc(1) Here. Channel – It is the pin no of port A to which anolog sensor is connected. Offset – It is an optional numeric variable that specifies gain or mode. Copyright 2010: Yantrik Automation 13 . The range of analog value is from 0 to 1023. Syntax var = GETADC(channel [. the analog value of the input provided by the sensor connected to pin 2 of port A is stored in variable L.8 GETADC command This command is used to take input from the analog sensor connected to the development board.

Variable or constant to be displayed on LCD For displaying string / text.yantrik.Yantrik Automation www.in 4. (1-65535) Example Waitms 200 4.10 Waitms command Suspends program execution for a given time in mS. Use LCD “text” For displaying variable. Syntax LCD x X . Use LCD A (A refers to the variable) For displaying text/variable in next line.11 PWMXX command It is used to set the speed of motor Syntax PwmXX = value Copyright 2010: Yantrik Automation 14 . Yantrik Automation 4.9 LCD Command It is used to display a constant or variable on LCD screen. “ Yantrik” Lowerline Lcd “Automation” Output on LCD will be: “Value of Variable a “. Syntax WAITMS T T-The number of milliseconds to wait. we use command LOWERLINE Example Lcd a.

we can connect 2 DC motors to terminal 1of development board. Copyright 2010: Yantrik Automation 15 .Yantrik Automation www. Example Pwm1a = 130 // refer to Page 6 for details about motor connector 4. They are use to drive the motors as well they can be used to trigger any other event. Example: Pwm1b = 150 .7 = 0 . Wires of right motor will be inserted into last 2 connector of terminal 2. The speed and direction of motor can be controlled using commands defined in 4.set the speed of motor 1 Portd.it is the channel of a motor Value – any integer value ranging from 0 to255 (maximum speed).y for direction.y .y command PORTX.0 for clock rotation and 1 for anti clock rotation Example: Portd. Wires of left motor will be inserted into first 2 connector of terminal 2. To move the motor into Backward direction.12 PORTX.12 i.in Xx.e defining PWM for speed and configuring PortX. Similarly.‘X’ as port number and ‘y’ as pin number Value .y – it is used to set the direction of the motor Syntax PORTX.11 and 4.13 Controlling Output Ports The output ports in YA Development board are defined as Motor 1 and Motor 2.yantrik. set PWM1a=0 and PWM1b =0.set the direction of motor 2 Important Note: Here motor 1 and motor 2 refers to DC motors connected to terminal blocks.set the direction of motor 1 Pwm1a = 150 .set the speed of motor 2 Portd.6 = 1 // refer to page 6 for details about motor connector 4.y = value X.6 = 0 .

GUI looks like: After configuring.Yantrik Automation www. Step3Once the programming is done. click files >> new and write header files and the configuration files in it. Configure and Load the files in the GUI as per the instructions shown in image below. AVRDude. Just give the location of this folder when the computer asks for the driver. Step4Plug in the USB programming cable in you computer. Once the file is loaded. Step2Now make use of the desired loop and start with the programming. Now install the driver of the usb programmer which you will find in the folder named WINDRIVER. Step5Now open avrdude-gui which will help you to transfer the hex code of your programme to the microcontroller. please check the status in the window below. press F7 to compile. Copyright 2010: Yantrik Automation 16 . clicks execute to load the HEX file into microcontroller.in PROGRAMMING STEPS: Step1Open bascom avr from start menu.yantrik.

in SAMPLE CODES 1-LCD interface and display $regfile = "8535def. Db6 = Portb.4. Db4 = Portb. Prescaler = Auto. Db7 = Portb. Rs = Portb.yantrik. Db5 = Portb.2 Config Adc = Single. Compare B Pwm = Clear Down Copyright 2010: Yantrik Automation 17 .Yantrik Automation www. Compare A Pwm = Clear Down. Reference = Avcc Config Timer1 = Pwm.7.6. E = Portb.5.3. Pwm = 8.dat" ' $crystal = 4000000 Config Lcd = 16 * 2 Config Lcdpin = Pin. Prescale = 1.

4. Db4 = Portb. Db7 = Portb. Rs = Portb.3.in Start Adc Cls Start Timer1 Do cls Lcd "Yantrik” Lowerline Lcd “Automation” Waitms 200 End 2-Metro Train Prototype $regfile = "8535def.7.yantrik.6 = 0 Waitms 1000 Cls Lcd "right" Pwm1a = 50 Copyright 2010: Yantrik Automation 18 . Prescale = 1 .Yantrik Automation www. Db6 = Portb. Compare A Pwm = Clear Down . Compare B Pwm = Clear Down Start Timer1 Do Cls Lcd "forward" Pwm1a = 200 Portd. Pwm = 8 . E = Portb.6 = 0 Waitms 2000 Cls Lcd "left" Pwm1a = 200 Portd.5. Db5 = Portb.7 = 0 Pwm1b = 200 Portd.2 Config Timer1 = Pwm .6.dat" $crystal = 1000000 Config Lcd = 16 * 2 Config Lcdpin = Pin.7 = 0 Pwm1b = 50 Portd.

Prescale = 1 .6 . Db7 = Portb. Db4 = Portb. Reference = Avcc Start ADC Config Timer1 = Pwm .3 .2 Config Adc = Single .6 = 0 Waitms 1000 Cls Lcd "stop" Pwm1a = 0 Portd.7 = 1 Pwm1b = 50 Portd. Compare B Pwm = Clear Down Start Timer1 Dim S As integer // declaring variable “S” of type integer Cls // Clear screen Do // Start the loop Copyright 2010: Yantrik Automation 19 . E = Portb.7 .6 = 1 Waitms 2000 Cls Loop End 3-Sensor Calibration $regfile = "8535def. Pwm = 8 .4 .6 = 0 Waitms 1000 Cls Lcd "backward" Pwm1a = 50 Portd.Yantrik Automation www.5 . Compare A Pwm = Clear Down . Db6 = Portb.in Portd. Prescaler = Auto .dat" $crystal = 4000000 Config Lcd = 16 * 2 Config Lcdpin = Pin .7 = 0 Pwm1b = 200 Portd. Db5 = Portb.yantrik. Rs = Portb.7 = 0 Pwm1b = 0 Portd.

Reference = Avcc Start ADC Config Timer1 = Pwm.yantrik. Db4 = Portb. Prescaler = Auto.dat" $crystal = 4000000 Config Lcd = 16 * 2 Config Lcdpin = Pin. E = Portb.2 Config Adc = Single. Compare A Pwm = Clear Down.dat" $crystal = 1000000 Copyright 2010: Yantrik Automation 20 . Db7 = Portb. Here. Rs = Portb. in this case. Db6 = Portb.5. in this case. Db5 = Portb.7.4. Prescale = 1. Pwm = 8.6.Yantrik Automation www. Here. Pin 0 refers to ADC1connector of Development Board Lcd S // Display the value of variable S on LCD Waitms 200 Loop // End of Loop End // to end the program 4-Real Time Temperature Monitoring $regfile = "8535def. Pin 0 refers to ADC1 connector of Development Board Lcd “Current” // Display the value of variable S on LCD Lowerline Lcd “room temp”-S Waitms 200 Loop // End of Loop End // to end the program 5-Obstacle Avoidance $regfile = "8535def. Compare B Pwm = Clear Down Start Timer1 Dim S As integer // declaring variable “S” of type integer Cls // Clear screen Do cls // Start the loop S= GetADC (0) // the input of sensor connected to Pin 0 of port A will be Stored in variable S.in cls S= GetADC (0) // The input of sensor connected to Pin 0 of port A will be stored in variable S.3.

Db4 = Portb. Db5 = Portb.6.7. E = Portb.2 Config Adc = Single.6 = 0 Pwm1a = 255 Portd.yantrik. Db6 = Portb. E = Portb. Db4 = Portb.in Config Lcd = 16 * 2 Config Lcdpin = Pin. Db5 = Portb. Reference = Avcc Config Timer1 = Pwm . Pwm = 8 .7.6 = 0 Pwm1a = 0 Portd. Rs = Portb.7 = 0 Lcd "no obstacle found" Lowerline Lcd "move" End If Loop End 6-Object Follower $regfile = "8535def.Yantrik Automation www.4. Prescaler = Auto.2 Copyright 2010: Yantrik Automation 21 . Db7 = Portb. Db7 = Portb. Prescale = 1 . Compare B Pwm = Clear Down Start Adc Cls Start Timer1 Dim R As Integer Do Cls R = Getadc(0) If R > 600 Then Pwm1b = 0 Portd.4. Compare A Pwm = Clear Down .3.dat" $crystal = 1000000 Config Lcd = 16 * 2 Config Lcdpin = Pin.7 = 0 Lcd "obstacle found" Lowerline Lcd "stop" Elseif R < 600 Then Pwm1b = 255 Portd. Db6 = Portb.6.5.3. Rs = Portb.5.

6 .5 .yantrik. Prescaler = Auto.7 = 0 Lcd "follow object" Lowerline Lcd "move" End If Loop End 7-Line follower $regfile = "8535def. Pwm = 8 . Prescaler = Auto. Db6 = Portb.6 = 0 Pwm1a = 255 Portd. Reference = Avcc Config Timer1 = Pwm . E = Portb. Db4 = Portb.4 .2 Config Adc = Single.dat" $crystal = 4000000 Config Lcd = 16 * 2 Config Lcdpin = Pin . Db7 = Portb. Compare A Pwm = Clear Down . Prescale = 1 .6 = 0 Pwm1a = 0 Portd.7 = 0 Lcd "no object" Lowerline Lcd "stop" Elseif R < 600 Then Pwm1b = 255 Portd. Db5 = Portb.in Config Adc = Single. Compare B Pwm = Clear Down Start Adc Cls Start Timer1 Dim R As Integer Do Cls R = Getadc(0) If R > 600 Then Pwm1b = 0 Portd. Rs = Portb.3 .7 . Reference = Avcc Copyright 2010: Yantrik Automation 22 .Yantrik Automation www.

R as Integer Dim Lw as Integer.in Config Timer1 = Pwm . Lb as Integer. Compare A Pwm = Clear Down . Compare B Pwm = Clear Down Start Adc Cls Start Timer1 Dim L as Integer. Prescale = 1 .yantrik. Rm as Integer Lcd "caliberate on" Lowerline Lcd "white surface" Waitms 2000 Cls Lcd "configuring" Lw = Getadc(0) Cw = Getadc(1) Rw = Getadc(2) Waitms 500 Cls Lcd "caliberate on" Lowerline Lcd “black surface" Waitms 2000 Cls Lcd "configuring" Lb = Getadc(0) Cb = Getadc(1) Rb = Getadc(2) Waitms 500 Cls Lcd "mean" Lm = Lw + Lb Lm = Lm / 2 Rm = Rw + Rb Rm = Rm / 2 Cm = Cw + Cb Copyright 2010: Yantrik Automation 23 . C as Integer. Cb as Integer. Rb as Integer.Yantrik Automation www. Pwm = 8 . Cm as Integer Dim Rw as Integer. Lm as Integer Dim Cw as Integer.

in Cm = Cm / 2 Waitms 500 Cls Do Cls L = Getadc(0) C = Getadc(1) R = Getadc(2) Lcd L.7 = 0 Pwm1b = 120 Portd.7 = 0 Pwm1b = 100 Portd. "--”. C.6 = 0 Lowerline Copyright 2010: Yantrik Automation 24 .6 = 0 Pwm1a = 150 Portd.Yantrik Automation www.6 = 0 Lowerline Lcd "right" Elseif L < Lm and C < Cm and R > Rm Then Pwm1a = 30 Portd. R If L < Lm and C > Cm and R < Rm Then Pwm1b = 150 Portd.7 = 0 Lowerline Lcd "forward" Elseif L < Lm and C > Cm and R > Rm Then Pwm1a = 0 Portd.6 = 0 Lowerline Lcd "right" Elseif L > Lm and C < Cm and R < Rm Then Pwm1a = 120 Portd.yantrik. "--”.7 = 0 Pwm1b = 30 Portd.

7 = 0 Pwm1b = 0 Portd. Prescaler = Auto.5. Compare A Pwm = Clear Down .3.7 = 0 Copyright 2010: Yantrik Automation 25 . E = Portb. Db5 = Portb. Rs = Portb. Db6 = Portb.2 Config Adc = Single. Pwm = 8 .4. Prescale = 1 . Db4 = Portb.6.7. Reference = Avcc Config Timer1 = Pwm . &HD9 . &HC4 . Compare B Pwm = Clear Down Dim A as String * 10 Start Adc Cls Start Timer1 Do A = Waitkey() If A = "f" Then Print "moving forward" Cls Lcd "forward" Pwm1a = 255 Portd.in Lcd "left" Elseif L > Lm and C > Cm and R < Rm Then Pwm1a = 100 Portd. &H00 Config Lcd = 16 * 2 Config Lcdpin = Pin.Yantrik Automation www. Db7 = Portb.dat" $crystal = 4000000 $baud = 9600 $prog&Hff .6 = 0 Lowerline Lcd "left" End If Loop End 8-PC Controlled Code A (Wired) $regfile = "8535def.yantrik.

6 = 0 Cls Elseif A = "l" Then Print "moving left" Cls Lcd "left" Pwm1a = 255 Portd.7 = 1 Pwm1b = 0 Copyright 2010: Yantrik Automation 26 .7 = 0 Pwm1b = 0 Portd.6 = 0 Cls Elseif A = "s" Then Print "stop" Cls Lcd "stop" Pwm1a = 0 Portd.7 = 0 Pwm1b = 0 Portd.6 = 0 Cls Elseif A = "r" Then Print "moving right" Cls Lcd "right" Pwm1a = 0 Portd.6 = 0 Cls Elseif A = "b" Then Print "moving backward" Cls Lcd "backward" Pwm1a = 0 Portd.yantrik.in Pwm1b = 255 Portd.Yantrik Automation www.7 = 0 Pwm1b = 255 Portd.

in Copyright 2010: Yantrik Automation 27 . • This board works perfect with current range of 0.5 amps on full load conditions.5 – 1. always prefer to disconnect the usb cable before executing the program. After programming. • • Do not short any pin or any soldering point on the board.2 Amps only.Yantrik Automation www. 6. For any special query related to hardware or software please mail us at:info@yantrik. So it is advised to use the same.2 amps current as L293D is capable of upto 1.yantrik. Whenever you connecting any external device the exact pin connections are to be kept in mind. • • Always switch off while connecting or disconnecting ISP cable. Precautions Here are a few things you need to take care to prevent your board being damaged – • As in DC voltage polarity is of prime importance so the power terminals should be connected properly. Troubleshooting • • • For any problem in the code please refer the help section of bascom.in Portd. For any hardware problem please refer the component datasheet.6 = 1 Cls End If Loop End 5. • Do not use motors which need more than 1.

yantrik. NOTES Copyright 2010: Yantrik Automation 28 .in 7.Yantrik Automation www.