Forum Replies Created
-
AuthorPosts
-
Shashank Rao.CParticipant
I am using cutecom for hyperterminal and to send data i press enter key.
other than enter key which key i can use to send data to mcu?
Shashank Rao.CParticipantSir,
hand shake is disabled. Iam sending screen shot of cutecom.wysiwyg_imageupload:9008:height=375,width=513
circuit is very similar to an article published in this website only with very little change.
change is that i am using port c also for device ctrl.
Shashank Rao.CParticipanthi,
at last i got how to generate .hex file and programing process in avr dude.
just follow these steps.
open a terminal and navigate to where the code is downloaded too. then run the following commands:
1.) avr-gcc -g -Os -mmcu=<mcu type> -c file_name.c
this produces an object file called flash.o which then needs to be linked using:
2.) avr-gcc -g -mmcu=<mcu type> -o file_name.elf file_name.o
this has now produced a binary file called flash.elf, which is a GNU executable file. we gotta mess with it a bit more and grab some bits out of it to make the hex file3.) avr-objcopy -j .text -j .data -O ihex file_name.elf file_name.hex
Note:mcu type can be ATmega8,ATmega16,ATmega328 etc in code written as
atmega8,atmega16 etc.In the home folder you wull get your .hex file
Now programing to ic using avr-dude
follow these step
4.)avrdude -p <microcontroller> -P /dev/ttyACM0 -c stk500v2 -u -U flash:w:filename.hex
Microcontroller can be ATmega8,ATmega16,ATmega32,ATmega328, etc..
and is written in code as atmega8,atmega16,atmega32,etc..
Note: I checked this only in ISP programmer. also this only for avrdude.
Shashank Rao.CParticipantmy need is 18V. I am not giving 32V insted i am giving 24V. In that i didnt get how current is varying, means action of that part
Shashank Rao.CParticipantHi NK,
I have written a code for this purpose. Actually these code were collected and rearrange from this site only. I have done small changes.
i have not tried this. can you please check this? Please tell me any any modifications are needed or not.
#define F_CPU 12000000UL // set CPU freq.
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) – 1)
#include<avr/io.h>
#include<util/delay.h>#define LCD_DATA PORTA // LCD DATA PORT.
#define ctrl PORTB // CONTROL PORT FOR LCD.
#define en PB2 // ENABLE SINGNAL FOR LCD.
#define rw PB1 // READ/WRITE SIGNAL FOR LCD.
#define rs PB0 // REGISTER SELECTION SIGNAL FOR LCD.
#define MOTOR_CONTROL PORTC // MOTOR CONTROL PORT.void LCD_cmd(unsigned char cmd);
void init_LCD(void);
void LCD_write(unsigned char data);void usart_init();
void usart_putch(unsigned char send);
unsigned int usart_getch();
void compare_string();unsigned int final_result;
unsigned char msg[] = “”;
unsigned char on[]=”MTR ON”;
unsigned char off[]=”MTR OFF”;int main(void);
{
while(1)
{
uart_init(); // initialize UART port.usart_message(“ATrn”); // Sent AT into USART.
_delay_ms(10000);
usart_message(“AT+CMGF=1rn”); //Select mesage mode in text mode.
_delay_ms(1000);
usart_message(“AT+CPMS=’SM’rn”); // Select the mesage memory.
_delay_ms(1000);
usart_message(“AT+CMGR=1rn”); // Read the message from index 1.
usart_getch(msg[]);
compare_string();
final_result=fresult;
if(final_result==0)
{
PORTC=0x01;
usart_message(“ATrn”); // Sent AT into USART.
_delay_ms(10000);
usart_message(“AT+CMGF=1rn”); //Select mesage mode in text mode.
_delay_ms(1000);
usart_message(“AT+CPMS=’SM’rn”); // Select the mesage memory.
_delay_ms(1000);
usart_message(“AT+CMGS=+918197103408rn”); // SEND the message.
usart_message(“MOTER IS ON.”);
init_LCD();
LCD_write(“MOTOR IS ON.”);
}
if(final_result==1)
{
PORTC=0x00;
usart_message(“ATrn”); // Sent AT into USART.
_delay_ms(10000);
usart_message(“AT+CMGF=1rn”); //Select mesage mode in text mode.
_delay_ms(1000);
usart_message(“AT+CPMS=’SM’rn”); // Select the mesage memory.
_delay_ms(1000);
usart_message(“AT+CMGS=+918197103408rn”); // SEND the message.
usart_message(“MOTER IS OFF.”);
init_LCD();
LCD_write(“MOTER IS OFF.”);
}
}
}LCD_write(“MOTER IS OFF.”);
void init_LCD(void) //Function to initialize LCD.
{
LCD_cmd(0x38);
mode
_delay_ms(1);
// initialization of 16X2 LCD in 8bit
LCD_cmd(0x01); // clear LCD
_delay_ms(1);
LCD_cmd(0x0E); // cursor ON
_delay_ms(1);
LCD_cmd(0x80);
0th position
_delay_ms(1);
return;
}void LCD_cmd(unsigned char cmd) //Function to LCD command.
{
LCD_DATA=cmd;
ctrl =(0<<rs)|(0<<rw)|(1<<en);
_delay_ms(1);
ctrl =(0<<rs)|(0<<rw)|(0<<en);
_delay_ms(50);
return;
}void LCD_write(unsigned char data) //Function to write a letter in LCD.
{
LCD_DATA= data;
ctrl = (1<<rs)|(0<<rw)|(1<<en);
_delay_ms(1);
ctrl = (1<<rs)|(0<<rw)|(0<<en);
_delay_ms(50);
return ;
}void LCD_write_string(unsigned char *str) //Function to write a string in LCD.
value of the string in pointer *str
{
int i=0;
while(str!=’