{"id":731,"date":"2022-08-30T15:06:14","date_gmt":"2022-08-30T15:06:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/problem-about-avr-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:06:14","modified_gmt":"2022-08-30T15:06:14","slug":"problem-about-avr-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-avr-collection-of-common-programming-errors\/","title":{"rendered":"problem about avr-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6da6c3fe1821d7dace0432a7e5fb2af5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nverendra<br \/>\nc embedded switch-statement avr<br \/>\nI 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(&#8220;\\r\\n\\r\\n&#8221;);printf(&#8220;university\\r\\n&#8221;);printf(&#8220;sweden\\r\\n&#8221;);printf(&#8220;Ver. 1.0A\\r\\n&#8221;);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<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/50828b749852b2d15a2fb83ea67a84cb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWill03uk<br \/>\navr c library avr-gcc<br \/>\nI 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<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/483337f6227be12775e70179d6c1b7de?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPower-Mosfet<br \/>\nmicrocontroller avr c<br \/>\nIhave 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&#8217;t give any warnings or error#include &#8220;lbl_lcd.h&#8221; #include \/* One byte delay loop, one loop costs 3 cycles. *\/ void _lcd_delay_8(uint8_t t) {asm volatile ( &#8220;\\n&#8221;&#8221;L_dl0%=: subi %0,1&#8221; &#8220;\\n\\t&#8221;&#8221; brcc L_dl0%=&#8221; &#8220;\\n\\t&#8221;:: &#8220;r&#8221; (t)); }\/* Two byte delay loop, one loop costs 4 cycles. *\/ void _lcd_delay_16(uint16_t t) {asm vola<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6da6c3fe1821d7dace0432a7e5fb2af5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nverendra<br \/>\nc embedded avr<br \/>\nI 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) { \/* &#8230; *\/ case (muxsel):printf(muxselection);switch (c) {case 1:printf(&#8220;this is mux chaneel1&#8221;);DDRB = 0b10111111;PORTB = 0b00000000;printf(&#8220;adc Value&#8221;, ReadAdc());Command = 0;break;case 2:\/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-*\/break;}Command = 0; break; \/* &#8230; *\/ default:Command = 0;break;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/12790ee3b6ffe6d598e7a6a779e5c2d6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSVFeingold<br \/>\nc increment avr atmel<br \/>\nHaving a strange problem. I finally figured out how to turn a variable &#8220;i&#8221; 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&#8217;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<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:44:24. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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(&#8220;\\r\\n\\r\\n&#8221;);printf(&#8220;university\\r\\n&#8221;);printf(&#8220;sweden\\r\\n&#8221;);printf(&#8220;Ver. 1.0A\\r\\n&#8221;);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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-731","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=731"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/731\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}