can any one send me code to my obstacle detection robot
it just works on 2 IRse nsors and 2 dc motors and robotic contoller m1,my code showing errors plzzzzzz help
//************************************************************************************
//**Â
//**Â File name:Â Â E:\pictures\Sethu\MY stufff\Projects\ODAR\Doc's\finallyigot.c
//**Â Title:Â Â Â Â Obstacle detecter and avoidance robot
//**Â Description:Â
//**Â
//**Â Generated by:Â Flowcode v5.3.0.0
//**Â Date:Â Â Â Â Â Friday, June 21, 2013 12:41:52
//**Â Licence:Â Â Â Professional
//**Â Registered to: nani
//**Â Licence key:Â AAJ2DB
//**Â
//**Â
//**Â http://www.matrixmultimedia.com
//**Â
//************************************************************************************
#define MX_AVR
#define MX_USES_UINT8 1
#define MX_USES_SINT16 0
#define MX_USES_CHAR 0
#define MX_USES_FLOAT 0
#define MX_USES_SINT32 0
#define MX_USES_BOOL 1
#define MX_USES_UINT16 0
#define MX_USES_UINT32 0
//Defines for microcontroller
#define FC_CAL_AVR
#define MX_ADC
#define MX_ADC_TYPE_2
#define MX_ADC_BITS_10
#define MX_EE
#define MX_EE_SIZE 512
#define MX_SPI_1
#define MX_SPI_1_MISO_PORT PORTB
#define MX_SPI_1_MISO_TRIS DDRB
#define MX_SPI_1_MISO_PIN 4
#define MX_SPI_1_MOSI_PORT PORTB
#define MX_SPI_1_MOSI_TRIS DDRB
#define MX_SPI_1_MOSI_PIN 3
#define MX_SPI_1_CLK_PORT PORTB
#define MX_SPI_1_CLK_TRIS DDRB
#define MX_SPI_1_CLK_PIN 5
#define MX_SPI_1_SS_PORT PORTB
#define MX_SPI_1_SS_TRIS DDRB
#define MX_SPI_1_SS_PIN 2
#define MX_UART_1
#define MX_UART_1_TX_PORT PORTD
#define MX_UART_1_TX_TRIS DDRD
#define MX_UART_1_TX_PIN 1
#define MX_UART_1_RX_PORT PORTD
#define MX_UART_1_RX_TRIS DDRD
#define MX_UART_1_RX_PIN 0
#define MX_MI2C
#define MX_I2C_1
#define MX_I2C_1_SDA_PORT PORTC
#define MX_I2C_1_SDA_TRIS DDRC
#define MX_I2C_1_SDA_PIN 4
#define MX_I2C_1_SCL_PORT PORTC
#define MX_I2C_1_SCL_TRIS DDRC
#define MX_I2C_1_SCL_PIN 5
#define MX_PWM
#define MX_PWMTYPE 1
#define MX_PWM_CNT 3
#define MX_PWM_TMR0_CNT 0
#define MX_PWM_TMR1_CNT 2
#define MX_PWM_TMR2_CNT 1
#define MX_PWM_PSCA1
#define MX_PWM_PSCA8
#define MX_PWM_PSCA64
#define MX_PWM_PSCA256
#define MX_PWM_PSCA1024
#define MX_PWM_1_PORT PORTB
#define MX_PWM_1_TRIS DDRB
#define MX_PWM_1_PIN 1
#define MX_PWM_2_PORT PORTB
#define MX_PWM_2_TRIS DDRB
#define MX_PWM_2_PIN 2
#define MX_PWM_3_PORT PORTB
#define MX_PWM_3_TRIS DDRB
#define MX_PWM_3_PIN 3
//Functions
#define F_CPU 20000000UL
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <avr\io.h>
#include <avr\interrupt.h>
#include <avr\eeprom.h>
#include <avr\wdt.h>
//Configuration data
#pragma DATA 0x0, 0xdf
#pragma DATA 0x1, 0xff
//Internal functions
#include "C:\Program Files (x86)\Flowcode(AVR)\v5\FCD\internals.c"
//Macro function declarations
//Variable declarations
#define FCV_FALSE (0)
#define FCV_TRUE (1)
volatile MX_UINT8 FCV_FIRSTSENSOR;
volatile MX_UINT8 FCV_SECONDSENSOR;
//Supplementary defines
#define OPTION OPTION_REG_REG
#include "C:\Program Files (x86)\Flowcode(AVR)\v5\CAL\includes.c"
//Macro implementations
//Supplementary implementations
int main()
{
//Initialization
MCUCSR=0x00;
wdt_disable();
//Interrupt initialization code
//Loop
//Loop: While 1
while (1)
{
//Input
//Input: D5 -> FirstSensor
DDRD = DDRD & 0xDF;
FCV_FIRSTSENSOR = ((PIND & 0x20) == 0x20);
//Input
//Input: D6 -> SecondSensor
DDRD = DDRD & 0xBF;
FCV_SECONDSENSOR = ((PIND & 0x40) == 0x40);
//Decision
//Decision: FirstSensor?
if (FCV_FIRSTSENSOR)
{
//Decision
//Decision: SecondSensor?
if (FCV_SECONDSENSOR)
{
//Output
//Output: 0x03 -> PORTB
DDRB = DDRB | 0x3F;
PORTB = (PORTB & 0xC0) | (0x03);
} else {
//Output
//Output: 0x03 -> PORTB
DDRB = DDRB | 0x3F;
PORTB = (PORTB & 0xC0) | (0x03);
}
} else {
//Decision
//Decision: SecondSensor?
if (FCV_SECONDSENSOR)
{
//Output
//Output: 0x14 -> PORTB
DDRB = DDRB | 0x3F;
PORTB = (PORTB & 0xC0) | (0x14);
} else {
//Output
//Output: 0x17 -> PORTB
DDRB = DDRB | 0x3F;
PORTB = (PORTB & 0xC0) | (0x17);
}
}
}
mainendloop: goto mainendloop;
}
Moderator edit: Download code made into visible code.
finallyigot.c (4.1 KB)