problem about avr-Collection of common programming errors


  • verendra
    c embedded switch-statement avr
    I am writing code for AVR ATmega32-A microcontroller. I am using switch case as shown below.unsigned char Command;unsigned int Param;void runCom(void){switch(Command){case(NO_COM):Command = 0;break;case(INF):printf(“\r\n\r\n”);printf(“university\r\n”);printf(“sweden\r\n”);printf(“Ver. 1.0A\r\n”);Command = 0;break;case (DB): Command = 0;break;case(CLEARM):Command = 0;break;default:Command = 0;break; } }the above code is working but now i want t

  • Will03uk
    avr c library avr-gcc
    I am attempting to create a library much like the Arduino in C.I have tried in the past and although I have lost the code, I remember simply getting loads of undefined references to functions spec

  • Power-Mosfet
    microcontroller avr c
    Ihave modify an existing lcd library, it only works on DDRA for exmple if i change:Update error Fixed:I have found the error in the code assembly delay was too short for port B, C and D. by changing delay time i was able to use all ports.Im using a AVR ATMEGA16. i have also wiring the pins correct to databus lines.#define DDR DDRA #define PORT PORTA #define PIN PINA #define RS_PIN 0 #define RW_PIN 1 #define E_PIN 2to this nothing happens#define DDR DDRC #define PORT PORTC #define PIN PINC #define RS_PIN 0 #define RW_PIN 1 #define E_PIN 2here is the link to libraryand this is what i have changed. p.s it doesn’t give any warnings or error#include “lbl_lcd.h” #include /* One byte delay loop, one loop costs 3 cycles. */ void _lcd_delay_8(uint8_t t) {asm volatile ( “\n””L_dl0%=: subi %0,1” “\n\t”” brcc L_dl0%=” “\n\t”:: “r” (t)); }/* Two byte delay loop, one loop costs 4 cycles. */ void _lcd_delay_16(uint16_t t) {asm vola

  • verendra
    c embedded avr
    I am trying to execute some commands using USART communication and reading some values using ATmega32-A. have a look at my code . My problem is i am trying to add some cases (nested switch case) but i am not getting what i want. I hope i am giving all most all information required to solve my problem.void uniCom(void) { switch (Command) { /* … */ case (muxsel):printf(muxselection);switch (c) {case 1:printf(“this is mux chaneel1”);DDRB = 0b10111111;PORTB = 0b00000000;printf(“adc Value”, ReadAdc());Command = 0;break;case 2:/*——————-*/break;}Command = 0; break; /* … */ default:Command = 0;break;

  • SVFeingold
    c increment avr atmel
    Having a strange problem. I finally figured out how to turn a variable “i” that increments inside a loop into a string that I can pass to a function which turns it into a character that is output to a display. The trouble is, the value increments by 2 rather than by 1! I have tried a few different things but I’m not sure where the problem lies. Initially, I thought that perhaps, if you have a function that calls another function, and they both use the same variable to increment (i.e. for(int i=0; i

Originally posted 2013-11-09 21:44:24.